https://github.com/xgupta updated https://github.com/llvm/llvm-project/pull/67519
>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 1/2] [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)) >From 166e2ad0cb045c3f8970560d215d3cda95532876 Mon Sep 17 00:00:00 2001 From: Shivam Gupta <shivam98....@gmail.com> Date: Wed, 27 Sep 2023 11:36:34 +0530 Subject: [PATCH 2/2] clang-format --- clang/lib/Basic/ProfileList.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clang/lib/Basic/ProfileList.cpp b/clang/lib/Basic/ProfileList.cpp index c3cb112cdf83922..ad90651dafc7ef9 100644 --- a/clang/lib/Basic/ProfileList.cpp +++ b/clang/lib/Basic/ProfileList.cpp @@ -143,7 +143,8 @@ ProfileList::isFileExcluded(StringRef FileName, // 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"; + llvm::dbgs() << "Parsing -fprofile-list option: " << CanonicalFileName + << "\n"; // Check for "source:<regex>=<case>" using absolute path if (auto V = inSection(Section, "source", CanonicalFileName)) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits