llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-llvm-support Author: Vitaly Buka (vitalybuka) <details> <summary>Changes</summary> --- 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 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")); `````````` </details> https://github.com/llvm/llvm-project/pull/162511 _______________________________________________ llvm-branch-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits
