Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion llvm/lib/Support/SpecialCaseList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,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"))
Expand Down Expand Up @@ -237,6 +237,10 @@ bool SpecialCaseList::parse(unsigned FileIdx, const MemoryBuffer *MB,
auto [It, _] = CurrentSection->Entries[Prefix].try_emplace(
Category, UseGlobs,
RemoveDotSlash && llvm::is_contained(PathPrefixes, Prefix));
if (It->second.RemoveDotSlash) {
// FIXME: On Windows remove_leading_dotslash will break escape sequences.
Pattern = llvm::sys::path::remove_leading_dotslash(Pattern);
}
Pattern = Pattern.copy(StrAlloc);
if (auto Err = It->second.insert(Pattern, LineNo)) {
Error =
Expand Down
10 changes: 5 additions & 5 deletions llvm/unittests/Support/SpecialCaseListTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand All @@ -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"));
Expand Down