-
Notifications
You must be signed in to change notification settings - Fork 24
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
base: main
Are you sure you want to change the base?
Add support for GetIncludePaths #178
Conversation
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.
clang-tidy made some suggestions
There were too many comments to post at once. Showing the first 10 out of 11. Check the log or trigger a new build to see more.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #178 +/- ##
==========================================
- Coverage 77.55% 77.18% -0.37%
==========================================
Files 8 8
Lines 2887 3042 +155
==========================================
+ Hits 2239 2348 +109
- Misses 648 694 +46
... and 4 files with indirect coverage changes
|
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.
clang-tidy made some suggestions
6819ae4
to
e29e778
Compare
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.
clang-tidy made some suggestions
lib/Interpreter/Paths.cpp
Outdated
Paths.push_back(PathStr); | ||
|
||
// Avoid duplicates | ||
llvm::SmallVector<llvm::StringRef, val> PathsChecked; |
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.
warning: unused variable 'Path' [clang-diagnostic-unused-variable]
for (llvm::StringRef Path : PathsChecked)
^
19f6118
to
30b74b1
Compare
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.
clang-tidy made some suggestions
@@ -444,6 +444,9 @@ namespace Cpp { | |||
/// Returns the resource-dir path (for headers). | |||
const char* GetResourceDir(); | |||
|
|||
/// Get Include Paths | |||
void GetIncludePath(const char* dir, std::vector<std::string>& includePaths); |
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.
void GetIncludePath(const char* dir, std::vector<std::string>& includePaths); | |
void GetIncludePath(std::vector<std::string>& includePaths); |
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.
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.
clang-tidy made some suggestions
@@ -347,6 +347,10 @@ class Interpreter { | |||
const_cast<const Interpreter*>(this)->getDynamicLibraryManager()); | |||
} | |||
|
|||
/// @brief As a interface to store paths added in AddIncludePaths | |||
std::vector<std::string> include; |
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.
warning: member variable 'include' has public visibility [cppcoreguidelines-non-private-member-variables-in-classes]
std::vector<std::string> include;
^
@@ -449,5 +448,32 @@ | |||
#undef DEBUG_TYPE | |||
} | |||
|
|||
void GetIncludePaths( |
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.
warning: an assignment within an 'if' condition is bug-prone [bugprone-assignment-in-if-condition]
if ((Exists = E.Path == Path))
^
Additional context
lib/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))
^
else | ||
Paths.push_back(PathStr); | ||
|
||
// Avoid duplicates |
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.
warning: unused variable 'Path' [clang-diagnostic-unused-variable]
for (llvm::StringRef Path : PathsChecked)
^
Hi @vgvassilev, |
@@ -347,6 +347,10 @@ class Interpreter { | |||
const_cast<const Interpreter*>(this)->getDynamicLibraryManager()); | |||
} | |||
|
|||
/// @brief As a interface to store paths added in AddIncludePaths | |||
std::vector<std::string> include; |
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.
Why do we need this. The include paths are stored in the HeaderSearch already.
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.
So we know that AddincludePaths() is fetching the paths and giving it to HeaderSearch, now GetIncludePaths() had the aim of exposing all the paths which were added(not present in HeaderSearch) to the user, for this we had to get/store all those paths which were being added to HeaderSearch with a vector ( as an interface) as AddIncludePaths() does'nt store any paths (makes it available for HeaderSearch).
Initially, I tried other methods to store all the paths from AddIncludePaths() itself but for that we require a change in function definition and would not require another function GetIncludePaths(). I also tried creating wrappers around AddIncludePaths() but to maintain the function signature I could'nt find a way to store the paths.
This PR adds GetIncludePaths() to fetch the include paths