summaryrefslogtreecommitdiff
path: root/unittests
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
parent17c95a217d359a48a95b35730829e870fe8491eb (diff)
downloadllvm-71981ef040dd94438449aeca726cab5839d8ec3c.tar.gz
llvm-71981ef040dd94438449aeca726cab5839d8ec3c.tar.bz2
llvm-71981ef040dd94438449aeca726cab5839d8ec3c.tar.xz
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')
-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 d87dab00db..9deee3c1e9 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));
+}
+
}