Skip to content

Conversation

vitalybuka
Copy link
Collaborator

No description provided.

@llvmbot
Copy link
Member

llvmbot commented Oct 8, 2025

@llvm/pr-subscribers-llvm-support

Author: Vitaly Buka (vitalybuka)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/162511.diff

2 Files Affected:

  • (modified) llvm/lib/Support/SpecialCaseList.cpp (+3-1)
  • (modified) llvm/unittests/Support/SpecialCaseListTest.cpp (+5-5)
diff --git a/llvm/lib/Support/SpecialCaseList.cpp b/llvm/lib/Support/SpecialCaseList.cpp
index 636dc5e651f56..98307cc7b9d23 100644
--- a/llvm/lib/Support/SpecialCaseList.cpp
+++ b/llvm/lib/Support/SpecialCaseList.cpp
@@ -154,7 +154,7 @@ SpecialCaseList::addSection(StringRef SectionStr, unsigned FileNo,
 
 bool SpecialCaseList::parse(unsigned FileIdx, const MemoryBuffer *MB,
                             std::string &Error) {
-  unsigned long long Version = 2;
+  unsigned long long Version = 3;
 
   StringRef Header = MB->getBuffer();
   if (Header.consume_front("#!special-case-list-v"))
@@ -214,6 +214,8 @@ bool SpecialCaseList::parse(unsigned FileIdx, const MemoryBuffer *MB,
     auto &Entry = CurrentSection->Entries[Prefix][Category];
     Entry.RemoveDotSlash =
         RemoveDotSlash && llvm::is_contained(PathPrefixes, Prefix);
+    if (Entry.RemoveDotSlash)
+      Pattern = llvm::sys::path::remove_leading_dotslash(Pattern);
     if (auto Err = Entry.insert(Pattern, LineNo, UseGlobs)) {
       Error =
           (Twine("malformed ") + (UseGlobs ? "glob" : "regex") + " in line " +
diff --git a/llvm/unittests/Support/SpecialCaseListTest.cpp b/llvm/unittests/Support/SpecialCaseListTest.cpp
index 750fedaf0a436..220a2c2d44de2 100644
--- a/llvm/unittests/Support/SpecialCaseListTest.cpp
+++ b/llvm/unittests/Support/SpecialCaseListTest.cpp
@@ -313,14 +313,14 @@ TEST_F(SpecialCaseListTest, DotSlash) {
                                                               "src:./bar\n"
                                                               "[not]\n"
                                                               "fun:foo\n"
-                                                              "src:bar\n");
+                                                              "src:bar\n",
+                                                              /*Version=*/2);
   std::unique_ptr<SpecialCaseList> SCL3 = makeSpecialCaseList("[dot]\n"
                                                               "fun:./foo\n"
                                                               "src:./bar\n"
                                                               "[not]\n"
                                                               "fun:foo\n"
-                                                              "src:bar\n",
-                                                              /*Version=*/3);
+                                                              "src:bar\n");
 
   EXPECT_TRUE(SCL2->inSection("dot", "fun", "./foo"));
   EXPECT_TRUE(SCL3->inSection("dot", "fun", "./foo"));
@@ -329,10 +329,10 @@ TEST_F(SpecialCaseListTest, DotSlash) {
   EXPECT_FALSE(SCL3->inSection("dot", "fun", "foo"));
 
   EXPECT_TRUE(SCL2->inSection("dot", "src", "./bar"));
-  EXPECT_FALSE(SCL3->inSection("dot", "src", "./bar"));
+  EXPECT_TRUE(SCL3->inSection("dot", "src", "./bar"));
 
   EXPECT_FALSE(SCL2->inSection("dot", "src", "bar"));
-  EXPECT_FALSE(SCL3->inSection("dot", "src", "bar"));
+  EXPECT_TRUE(SCL3->inSection("dot", "src", "bar"));
 
   EXPECT_FALSE(SCL2->inSection("not", "fun", "./foo"));
   EXPECT_FALSE(SCL3->inSection("not", "fun", "./foo"));

AaronBallman and others added 2 commits October 8, 2025 10:57
Created using spr 1.3.6

[skip ci]
Created using spr 1.3.6
@vitalybuka vitalybuka marked this pull request as draft October 8, 2025 17:57
@vitalybuka vitalybuka changed the base branch from users/vitalybuka/spr/main.wip-dotslash-backward-compartible to main October 8, 2025 17:57
Created using spr 1.3.6
Created using spr 1.3.6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants