Skip to content

Commit

Permalink
chore: relative paths during visit
Browse files Browse the repository at this point in the history
  • Loading branch information
vinniefalco authored and sdkrystian committed Jun 14, 2023
1 parent 0458f28 commit 971dcd1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion source/AST/ASTVisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ shouldExtract(

// file has not been previously visited
if(inserted)
ff.include = config_.shouldVisitFile(File_, ff.prefix);
ff.include = config_.shouldExtractFromFile(File_, ff.prefix);

// don't extract if the declaration is in a file
// that should not be visited
Expand Down
12 changes: 10 additions & 2 deletions source/Tool/ConfigImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,22 @@ shouldVisitTU(

bool
ConfigImpl::
shouldVisitFile(
shouldExtractFromFile(
llvm::StringRef filePath,
std::string& prefixPath) const noexcept
{
namespace path = llvm::sys::path;

SmallPathString temp;
temp = filePath;
if(! files::isAbsolute(filePath))
{
temp = files::makePosixStyle(
files::makeAbsolute(filePath, workingDir));
}
else
{
temp = filePath;
}
if(! path::replace_path_prefix(temp, sourceRoot_, "", path::Style::posix))
return false;
MRDOX_ASSERT(files::isDirsy(sourceRoot_));
Expand Down
8 changes: 5 additions & 3 deletions source/Tool/ConfigImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,16 @@ class ConfigImpl
set to the portion of the file path which
should be be removed for matching files.
@param filePath The posix-style full path
to the file being processed.
@param filePath A posix-style full or
relative path to the file being processed.
Relative paths are resolved against the
working directory.
@param prefix The prefix which should be
removed from subsequent matches.
*/
bool
shouldVisitFile(
shouldExtractFromFile(
llvm::StringRef filePath,
std::string& prefix) const noexcept;

Expand Down

0 comments on commit 971dcd1

Please sign in to comment.