forked from OSchip/llvm-project
Make SpecialCaseList match full strings, as documented, using anchors.
Differential Revision: http://llvm-reviews.chandlerc.com/D1149 llvm-svn: 186431
This commit is contained in:
parent
18191ceb54
commit
8b77f18da0
|
@ -99,7 +99,7 @@ void SpecialCaseList::init(const MemoryBuffer *MB) {
|
|||
// Add this regexp into the proper group by its prefix.
|
||||
if (!Regexps[Prefix][Category].empty())
|
||||
Regexps[Prefix][Category] += "|";
|
||||
Regexps[Prefix][Category] += Regexp;
|
||||
Regexps[Prefix][Category] += "^" + Regexp + "$";
|
||||
}
|
||||
|
||||
// Iterate through each of the prefixes, and create Regexs for them.
|
||||
|
|
|
@ -139,4 +139,20 @@ TEST_F(SpecialCaseListTest, GlobalIsIn) {
|
|||
EXPECT_TRUE(SCL->isIn(*Bar, "init"));
|
||||
}
|
||||
|
||||
TEST_F(SpecialCaseListTest, Substring) {
|
||||
Module M("othello", Ctx);
|
||||
Function *F = makeFunction("tomfoolery", M);
|
||||
GlobalVariable *GV = makeGlobal("bartender", "t", M);
|
||||
|
||||
OwningPtr<SpecialCaseList> SCL(makeSpecialCaseList("src:hello\n"
|
||||
"fun:foo\n"
|
||||
"global:bar\n"));
|
||||
EXPECT_FALSE(SCL->isIn(M));
|
||||
EXPECT_FALSE(SCL->isIn(*F));
|
||||
EXPECT_FALSE(SCL->isIn(*GV));
|
||||
|
||||
SCL.reset(makeSpecialCaseList("fun:*foo*\n"));
|
||||
EXPECT_TRUE(SCL->isIn(*F));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue