[PATCH] Make SpecialCaseList match full strings, as documented, using anchors.
Peter Collingbourne
peter at pcc.me.uk
Mon Jul 15 17:58:47 PDT 2013
Hi samsonov,
http://llvm-reviews.chandlerc.com/D1149
Files:
lib/Transforms/Utils/SpecialCaseList.cpp
unittests/Transforms/Utils/SpecialCaseList.cpp
Index: lib/Transforms/Utils/SpecialCaseList.cpp
===================================================================
--- lib/Transforms/Utils/SpecialCaseList.cpp
+++ lib/Transforms/Utils/SpecialCaseList.cpp
@@ -99,7 +99,7 @@
// 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.
Index: unittests/Transforms/Utils/SpecialCaseList.cpp
===================================================================
--- unittests/Transforms/Utils/SpecialCaseList.cpp
+++ unittests/Transforms/Utils/SpecialCaseList.cpp
@@ -139,4 +139,17 @@
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));
+}
+
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1149.1.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130715/4247e8fa/attachment.bin>
More information about the llvm-commits
mailing list