summaryrefslogtreecommitdiffstats
path: root/unittests/Transforms
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2013-07-16 17:56:07 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2013-07-16 17:56:07 +0000
commit71981ef040dd94438449aeca726cab5839d8ec3c (patch)
tree5aa92a3c28dd33ecfde4b7f8e2dfee1e54a53d47 /unittests/Transforms
parent17c95a217d359a48a95b35730829e870fe8491eb (diff)
downloadexternal_llvm-71981ef040dd94438449aeca726cab5839d8ec3c.zip
external_llvm-71981ef040dd94438449aeca726cab5839d8ec3c.tar.gz
external_llvm-71981ef040dd94438449aeca726cab5839d8ec3c.tar.bz2
Make SpecialCaseList match full strings, as documented, using anchors.
Differential Revision: http://llvm-reviews.chandlerc.com/D1149 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186431 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Transforms')
-rw-r--r--unittests/Transforms/Utils/SpecialCaseList.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/unittests/Transforms/Utils/SpecialCaseList.cpp b/unittests/Transforms/Utils/SpecialCaseList.cpp
index d87dab0..9deee3c 100644
--- a/unittests/Transforms/Utils/SpecialCaseList.cpp
+++ b/unittests/Transforms/Utils/SpecialCaseList.cpp
@@ -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));
+}
+
}