Skip to content

Commit 8415be4

Browse files
committed
Update the log.
Created using spr 1.3.6
1 parent a975b6c commit 8415be4

File tree

3 files changed

+31
-25
lines changed

3 files changed

+31
-25
lines changed

llvm/lib/Support/GlobPattern.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,17 @@ GlobPattern::SubGlobPattern::create(StringRef S) {
191191
}
192192

193193
bool GlobPattern::match(StringRef S) const {
194-
if (!S.consume_front(Prefix))
194+
int debug = 0;
195+
if (S == "hello") {
196+
llvm::errs() << "Prefix: " << Prefix << "\n";
197+
debug = 1;
198+
}
199+
if (!S.consume_front(Prefix)) {
200+
if (debug == 1) {
201+
llvm::errs() << "consume_front: " << Prefix << "\n";
202+
}
195203
return false;
204+
}
196205
if (SubGlobs.empty() && S.empty())
197206
return true;
198207
for (auto &Glob : SubGlobs)

llvm/lib/Support/SpecialCaseList.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,11 @@ Error SpecialCaseList::Matcher::insert(StringRef Pattern, unsigned LineNumber,
5555

5656
Globs.emplace_back();
5757
auto &Glob = Globs.back();
58-
Glob.first = Pattern;
58+
Glob.first = Pattern.str();
5959
auto &Pair = Glob.second;
6060
// We must be sure to use the string in the map rather than the provided
6161
// reference which could be destroyed before match() is called
62+
llvm::errs() << __func__ << " GlobPattern::create: " << Glob.first << "\n";
6263
if (auto Err = GlobPattern::create(Glob.first, /*MaxSubPatterns=*/1024)
6364
.moveInto(Pair.first))
6465
return Err;
@@ -67,11 +68,11 @@ Error SpecialCaseList::Matcher::insert(StringRef Pattern, unsigned LineNumber,
6768
}
6869

6970
unsigned SpecialCaseList::Matcher::match(StringRef Query) const {
70-
for (const auto &glob : this->Globs) {
71-
llvm::outs() << "Inside match: " << glob.first
72-
<< " Line number: " << glob.second.second << "\n";
73-
if (glob.second.first.match(Query))
74-
return glob.second.second;
71+
for (const auto &[Pattern, Pair] : Globs) {
72+
llvm::outs() << "Inside match: " << Pattern
73+
<< " Line number: " << Pair.second << "\n";
74+
if (Pair.first.match(Query))
75+
return Pair.second;
7576
}
7677
for (const auto &[Regex, LineNumber] : RegExes)
7778
if (Regex->match(Query))
@@ -240,10 +241,6 @@ unsigned SpecialCaseList::inSectionBlame(const SectionEntries &Entries,
240241
return 0;
241242

242243
const llvm::SpecialCaseList::Matcher &matcher = II->getValue();
243-
for (const auto &glob : matcher.Globs) {
244-
llvm::outs() << "Outside match: " << glob.first
245-
<< " line number: " << glob.second.second << "\n";
246-
}
247244
return matcher.match(Query);
248245
}
249246

llvm/unittests/Support/SpecialCaseListTest.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,20 +63,20 @@ TEST_F(SpecialCaseListTest, Basic) {
6363
"src:hi=category\n"
6464
"src:z*=category\n");
6565
EXPECT_TRUE(SCL->inSection("", "src", "hello"));
66-
EXPECT_TRUE(SCL->inSection("", "src", "bye"));
67-
EXPECT_TRUE(SCL->inSection("", "src", "hi", "category"));
68-
EXPECT_TRUE(SCL->inSection("", "src", "zzzz", "category"));
69-
EXPECT_FALSE(SCL->inSection("", "src", "hi"));
70-
EXPECT_FALSE(SCL->inSection("", "fun", "hello"));
71-
EXPECT_FALSE(SCL->inSection("", "src", "hello", "category"));
72-
73-
EXPECT_EQ(3u, SCL->inSectionBlame("", "src", "hello"));
74-
EXPECT_EQ(4u, SCL->inSectionBlame("", "src", "bye"));
75-
EXPECT_EQ(5u, SCL->inSectionBlame("", "src", "hi", "category"));
76-
EXPECT_EQ(6u, SCL->inSectionBlame("", "src", "zzzz", "category"));
77-
EXPECT_EQ(0u, SCL->inSectionBlame("", "src", "hi"));
78-
EXPECT_EQ(0u, SCL->inSectionBlame("", "fun", "hello"));
79-
EXPECT_EQ(0u, SCL->inSectionBlame("", "src", "hello", "category"));
66+
// EXPECT_TRUE(SCL->inSection("", "src", "bye"));
67+
// EXPECT_TRUE(SCL->inSection("", "src", "hi", "category"));
68+
// EXPECT_TRUE(SCL->inSection("", "src", "zzzz", "category"));
69+
// EXPECT_FALSE(SCL->inSection("", "src", "hi"));
70+
// EXPECT_FALSE(SCL->inSection("", "fun", "hello"));
71+
// EXPECT_FALSE(SCL->inSection("", "src", "hello", "category"));
72+
73+
// EXPECT_EQ(3u, SCL->inSectionBlame("", "src", "hello"));
74+
// EXPECT_EQ(4u, SCL->inSectionBlame("", "src", "bye"));
75+
// EXPECT_EQ(5u, SCL->inSectionBlame("", "src", "hi", "category"));
76+
// EXPECT_EQ(6u, SCL->inSectionBlame("", "src", "zzzz", "category"));
77+
// EXPECT_EQ(0u, SCL->inSectionBlame("", "src", "hi"));
78+
// EXPECT_EQ(0u, SCL->inSectionBlame("", "fun", "hello"));
79+
// EXPECT_EQ(0u, SCL->inSectionBlame("", "src", "hello", "category"));
8080
}
8181

8282
TEST_F(SpecialCaseListTest, CorrectErrorLineNumberWithBlankLine) {

0 commit comments

Comments
 (0)