-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for GetIncludePaths #178
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -449,5 +449,32 @@ | |
#undef DEBUG_TYPE | ||
} | ||
|
||
void GetIncludePaths( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: an assignment within an 'if' condition is bug-prone [bugprone-assignment-in-if-condition] if ((Exists = E.Path == Path))
^ Additional contextlib/Interpreter/Paths.cpp:450: if it should be an assignment, move it out of the 'if' condition if ((Exists = E.Path == Path))
^ lib/Interpreter/Paths.cpp:450: if it is meant to be an equality check, change '=' to '==' if ((Exists = E.Path == Path))
^ |
||
std::vector<std::string>& includePaths, llvm::StringRef PathStr, | ||
clang::HeaderSearchOptions& HOpts, | ||
const char* Delim /* = Cpp::utils::platform::kEnvDelim */) { | ||
#define DEBUG_TYPE "GetIncludePaths" | ||
const int val = 10; | ||
llvm::SmallVector<llvm::StringRef, val> Paths; | ||
if ((Delim != nullptr) && (*Delim != 0)) | ||
SplitPaths(PathStr, Paths, kAllowNonExistant, Delim, HOpts.Verbose); | ||
else | ||
Paths.push_back(PathStr); | ||
|
||
// Avoid duplicates | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: unused variable 'Path' [clang-diagnostic-unused-variable] for (llvm::StringRef Path : PathsChecked)
^ |
||
for (llvm::StringRef Path : Paths) { | ||
Krishna-13-cyber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
bool Exists = false; | ||
for (const clang::HeaderSearchOptions::Entry& E : HOpts.UserEntries) { | ||
if ((E.Path == Path)) | ||
Exists = true; | ||
break; | ||
} | ||
if (!Exists) { | ||
includePaths.push_back((std::string)Path); | ||
Krishna-13-cyber marked this conversation as resolved.
Show resolved
Hide resolved
Krishna-13-cyber marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} | ||
#undef DEBUG_TYPE | ||
} | ||
|
||
} // namespace utils | ||
} // namespace Cpp |
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.
This function should only have a single output parameter.
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.
Oh okay, I will make the required changes.