-
Notifications
You must be signed in to change notification settings - Fork 53
Make paths absolute when using compile_commands.json file #199
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: caozhong <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! I've some stylistic requests, but I think the change makes sense.
include/conf/load.hpp
Outdated
@@ -41,6 +41,20 @@ namespace color_coded | |||
|
|||
return line; | |||
} | |||
|
|||
void make_absolute(std::string &line, std::string &next, const fs::path &base) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since make_absolute
makes a lot of assumptions about the data it's working with, with both line
and next
and their relationship, I think it'd be a cleaner approach to just have make_absolute
work with the whole range. i.e.
template <typename It>
void make_absolute(It const &begin, It const &end, fs::path const &base)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I followed, make_absolute line/next is for the case where:
-I | -isystem | ...
../some/path/to/include
You mean there would be a case where:
-I | -isystem | ...
<empty line>
<empty line>
../some/path/to/include
Or just a single API make all directories absolute.
} else { | ||
line = make_absolute(line, base); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will you please update the braces and const
positioning to match the rest of the file? We use Allman-like braces, with a one-line exception, and const
always goes to the right. You can find examples of each of these within this file.
…on file Signed-off-by: caozhong <[email protected]>
As title. Also add a searching directory for lua library. @jeaye