Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Make paths absolute when using compile_commands.json file #199

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

CaoZhongZ
Copy link

@CaoZhongZ CaoZhongZ commented May 7, 2021

As title. Also add a searching directory for lua library. @jeaye

Signed-off-by: caozhong <zhong.z.cao@intel.com>
Copy link
Owner

@jeaye jeaye left a 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.

@@ -41,6 +41,20 @@ namespace color_coded

return line;
}

void make_absolute(std::string &line, std::string &next, const fs::path &base) {
Copy link
Owner

@jeaye jeaye May 16, 2021

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)

Copy link
Author

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);
}
}
}
Copy link
Owner

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 <zhong.z.cao@intel.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants