================ @@ -139,9 +139,23 @@ std::optional<ProfileList::ExclusionType> ProfileList::isFileExcluded(StringRef FileName, CodeGenOptions::ProfileInstrKind Kind) const { StringRef Section = getSectionName(Kind); - // Check for "source:<regex>=<case>" + + // Convert the input file path to its canonical (absolute) form + llvm::SmallString<128> CanonicalFileName(FileName); + llvm::sys::fs::make_absolute(CanonicalFileName); ---------------- hnrklssn wrote:
> IIRC you mean first check the relative file name and then use the relative > filename to get the absolute file name and then finally check for the > absolute filename. > > Like this - > > ``` > diff --git a/clang/lib/Basic/ProfileList.cpp b/clang/lib/Basic/ProfileList.cpp > index 1853a3e34ec3..a561db4e7e49 100644 > --- a/clang/lib/Basic/ProfileList.cpp > +++ b/clang/lib/Basic/ProfileList.cpp > @@ -139,21 +139,21 @@ std::optional<ProfileList::ExclusionType> > ProfileList::isFileExcluded(StringRef FileName, > CodeGenOptions::ProfileInstrKind Kind) const { > StringRef Section = getSectionName(Kind); > - // Convert the input file path to its canonical (absolute) form > - llvm::SmallString<128> CanonicalFileName(FileName); > - llvm::sys::fs::make_absolute(CanonicalFileName); > - > // Check for "source:<regex>=<case>" > if (auto V = inSection(Section, "source", FileName)) > return V; > - if (auto V = inSection(Section, "source", CanonicalFileName)) > - return V; > if (SCL->inSection(Section, "!src", FileName)) > return Forbid; > - if (SCL->inSection(Section, "!src", CanonicalFileName)) > - return Forbid; > if (SCL->inSection(Section, "src", FileName)) > return Allow; > + > + // Convert the input file path to its canonical (absolute) form > + llvm::SmallString<128> CanonicalFileName(FileName); > + llvm::sys::fs::make_absolute(CanonicalFileName); > + if (auto V = inSection(Section, "source", CanonicalFileName)) > + return V; > + if (SCL->inSection(Section, "!src", CanonicalFileName)) > + return Forbid; > if (SCL->inSection(Section, "src", CanonicalFileName)) > return Allow; > return std::nullopt; > ``` > > For me both are fine, let me know if you think the same as I understand and > want this version. Yeah that's what I meant. I won't block on it though, because the performance aspect probably doesn't matter too much. But please do add tests. https://github.com/llvm/llvm-project/pull/67519 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits