https://github.com/xgupta created https://github.com/llvm/llvm-project/pull/67519
None >From 9a38bc6f7322d641daec8d323b502cd09b721c53 Mon Sep 17 00:00:00 2001 From: Shivam Gupta <shivam98....@gmail.com> Date: Wed, 27 Sep 2023 11:18:47 +0530 Subject: [PATCH] [Clang][InstrProf] Allow absolute path in fun.list of -fprofile-list= --- clang/lib/Basic/ProfileList.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/clang/lib/Basic/ProfileList.cpp b/clang/lib/Basic/ProfileList.cpp index 8fa16e2eb069a52..c3cb112cdf83922 100644 --- a/clang/lib/Basic/ProfileList.cpp +++ b/clang/lib/Basic/ProfileList.cpp @@ -139,9 +139,24 @@ 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); + llvm::dbgs() << "Parsing -fprofile-list option: " << CanonicalFileName << "\n"; + + // Check for "source:<regex>=<case>" using absolute path + if (auto V = inSection(Section, "source", CanonicalFileName)) + return V; + // If the absolute path didn't match, try the relative path (FileName) if (auto V = inSection(Section, "source", FileName)) return V; + + if (SCL->inSection(Section, "!src", CanonicalFileName)) + return Forbid; + if (SCL->inSection(Section, "src", CanonicalFileName)) + return Allow; + // If the absolute path didn't match, try the relative path (FileName) if (SCL->inSection(Section, "!src", FileName)) return Forbid; if (SCL->inSection(Section, "src", FileName)) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits