diff options
author | Samuel Benzaquen <sbenza@google.com> | 2013-08-30 15:09:52 +0000 |
---|---|---|
committer | Samuel Benzaquen <sbenza@google.com> | 2013-08-30 15:09:52 +0000 |
commit | 998cda23b9c90e1e0aa0fe049283f77351c3fb34 (patch) | |
tree | 4c225d59429418c237188873eed9396995c21112 /clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp | |
parent | e22defe905818b69da481ddd657fa5a21ac4a937 (diff) | |
download | bcm5719-llvm-998cda23b9c90e1e0aa0fe049283f77351c3fb34.tar.gz bcm5719-llvm-998cda23b9c90e1e0aa0fe049283f77351c3fb34.zip |
Reduce the number of symbols by changing how templates are instantiated per function bound in the registry.
Summary:
Reduce the number of symbols by changing how templates are instantiated per function bound in the registry.
This change reduces the number of sections in Registry.cpp.o by a little over 10%.
Reviewers: klimek
CC: cfe-commits, revane
Differential Revision: http://llvm-reviews.chandlerc.com/D1557
llvm-svn: 189676
Diffstat (limited to 'clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp')
-rw-r--r-- | clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp b/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp index 168741ca4d9..d2b8a58bc86 100644 --- a/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp +++ b/clang/unittests/ASTMatchers/Dynamic/VariantValueTest.cpp @@ -28,8 +28,6 @@ TEST(VariantValueTest, Unsigned) { EXPECT_FALSE(Value.isString()); EXPECT_FALSE(Value.isMatcher()); - EXPECT_FALSE(Value.hasTypedMatcher<Decl>()); - EXPECT_FALSE(Value.hasTypedMatcher<UnaryOperator>()); } TEST(VariantValueTest, String) { @@ -51,24 +49,24 @@ TEST(VariantValueTest, DynTypedMatcher) { EXPECT_FALSE(Value.isString()); EXPECT_TRUE(Value.isMatcher()); - EXPECT_FALSE(Value.hasTypedMatcher<Decl>()); - EXPECT_TRUE(Value.hasTypedMatcher<UnaryOperator>()); + EXPECT_FALSE(Value.getMatcher().hasTypedMatcher<Decl>()); + EXPECT_TRUE(Value.getMatcher().hasTypedMatcher<UnaryOperator>()); EXPECT_EQ("Matcher<Stmt>", Value.getTypeAsString()); // Can only convert to compatible matchers. Value = VariantMatcher::SingleMatcher(recordDecl()); EXPECT_TRUE(Value.isMatcher()); - EXPECT_TRUE(Value.hasTypedMatcher<Decl>()); - EXPECT_FALSE(Value.hasTypedMatcher<UnaryOperator>()); + EXPECT_TRUE(Value.getMatcher().hasTypedMatcher<Decl>()); + EXPECT_FALSE(Value.getMatcher().hasTypedMatcher<UnaryOperator>()); EXPECT_EQ("Matcher<Decl>", Value.getTypeAsString()); Value = VariantMatcher::SingleMatcher(ignoringImpCasts(expr())); EXPECT_TRUE(Value.isMatcher()); - EXPECT_FALSE(Value.hasTypedMatcher<Decl>()); - EXPECT_FALSE(Value.hasTypedMatcher<Stmt>()); - EXPECT_TRUE(Value.hasTypedMatcher<Expr>()); - EXPECT_TRUE(Value.hasTypedMatcher<IntegerLiteral>()); - EXPECT_FALSE(Value.hasTypedMatcher<GotoStmt>()); + EXPECT_FALSE(Value.getMatcher().hasTypedMatcher<Decl>()); + EXPECT_FALSE(Value.getMatcher().hasTypedMatcher<Stmt>()); + EXPECT_TRUE(Value.getMatcher().hasTypedMatcher<Expr>()); + EXPECT_TRUE(Value.getMatcher().hasTypedMatcher<IntegerLiteral>()); + EXPECT_FALSE(Value.getMatcher().hasTypedMatcher<GotoStmt>()); EXPECT_EQ("Matcher<Expr>", Value.getTypeAsString()); } @@ -84,8 +82,8 @@ TEST(VariantValueTest, Assignment) { EXPECT_FALSE(Value.isUnsigned()); EXPECT_FALSE(Value.isString()); EXPECT_TRUE(Value.isMatcher()); - EXPECT_TRUE(Value.hasTypedMatcher<Decl>()); - EXPECT_FALSE(Value.hasTypedMatcher<UnaryOperator>()); + EXPECT_TRUE(Value.getMatcher().hasTypedMatcher<Decl>()); + EXPECT_FALSE(Value.getMatcher().hasTypedMatcher<UnaryOperator>()); EXPECT_EQ("Matcher<Decl>", Value.getTypeAsString()); Value = 17; @@ -104,32 +102,39 @@ TEST(VariantValueTest, Assignment) { TEST(VariantValueTest, Matcher) { EXPECT_TRUE(matches("class X {};", VariantValue(VariantMatcher::SingleMatcher( recordDecl(hasName("X")))) + .getMatcher() .getTypedMatcher<Decl>())); - EXPECT_TRUE(matches("int x;", - VariantValue(VariantMatcher::SingleMatcher(varDecl())) - .getTypedMatcher<Decl>())); + EXPECT_TRUE( + matches("int x;", VariantValue(VariantMatcher::SingleMatcher(varDecl())) + .getMatcher() + .getTypedMatcher<Decl>())); EXPECT_TRUE( matches("int foo() { return 1 + 1; }", VariantValue(VariantMatcher::SingleMatcher(functionDecl())) + .getMatcher() .getTypedMatcher<Decl>())); // Can't get the wrong matcher. EXPECT_FALSE(VariantValue(VariantMatcher::SingleMatcher(varDecl())) + .getMatcher() .hasTypedMatcher<Stmt>()); #if !defined(NDEBUG) && GTEST_HAS_DEATH_TEST && !defined(_MSC_VER) // Trying to get the wrong matcher fails an assertion in Matcher<T>. We don't // do this test when building with MSVC because its debug C runtime prints the // assertion failure message as a wide string, which gtest doesn't understand. EXPECT_DEATH(VariantValue(VariantMatcher::SingleMatcher(varDecl())) + .getMatcher() .getTypedMatcher<Stmt>(), "hasTypedMatcher"); #endif EXPECT_FALSE(matches( "int x;", VariantValue(VariantMatcher::SingleMatcher(functionDecl())) + .getMatcher() .getTypedMatcher<Decl>())); EXPECT_FALSE( matches("int foo() { return 1 + 1; }", VariantValue(VariantMatcher::SingleMatcher(declRefExpr())) + .getMatcher() .getTypedMatcher<Stmt>())); } |