Skip to content

Commit

Permalink
Handle error when resolving paths
Browse files Browse the repository at this point in the history
  • Loading branch information
kiron1 committed Dec 22, 2024
1 parent deae668 commit 5b29c8f
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 2 deletions.
57 changes: 57 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"files.associations": {
"__bit_reference": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__node_handle": "cpp",
"__split_buffer": "cpp",
"__threading_support": "cpp",
"__verbose_abort": "cpp",
"array": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"complex": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"execution": "cpp",
"memory": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"locale": "cpp",
"mutex": "cpp",
"new": "cpp",
"optional": "cpp",
"ostream": "cpp",
"print": "cpp",
"queue": "cpp",
"ratio": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"string_view": "cpp",
"tuple": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"variant": "cpp",
"vector": "cpp",
"algorithm": "cpp"
}
}
5 changes: 3 additions & 2 deletions bcc/compile_commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ compile_commands_builder::build(analysis::ActionGraphContainer const& action_gra
// input file is required
if (file.has_value()) {
if (resolve_) {
auto const resolved = std::filesystem::canonical(execution_root_ / file.value());
if (starts_with(resolved.string(), workspace_path_.string())) {
std::error_code ec;
auto const resolved = std::filesystem::canonical(execution_root_ / file.value(), ec);
if (!ec && starts_with(resolved.string(), workspace_path_.string())) {
file = resolved.string();
}
}
Expand Down

0 comments on commit 5b29c8f

Please sign in to comment.