From 05ce1eed0aabeed70c4b5ab96a5dcab3cc92141d Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Mon, 2 Feb 2015 23:35:39 +0000 Subject: [PATCH] Revert "Add some overloads so that floating point literals can be AST matched properly." Apparently the build bots get angry for some reason. Can't reproduce that in a local cmake/ninja build. Will look closer. Rolling back for now. llvm-svn: 227895 --- .../clang/ASTMatchers/ASTMatchersInternal.h | 26 ---------------------- clang/unittests/ASTMatchers/ASTMatchersTest.cpp | 8 ------- 2 files changed, 34 deletions(-) diff --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h index bc979b2..ebe5cdd 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h +++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h @@ -1456,32 +1456,6 @@ private: const ValueT ExpectedValue; }; -template <> -bool ValueEqualsMatcher::matchesNode( - const FloatingLiteral &Node) const { - if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle) - return Node.getValue().convertToFloat() == ExpectedValue; - if ((&Node.getSemantics()) == &llvm::APFloat::IEEEdouble) - return Node.getValue().convertToDouble() == ExpectedValue; - return false; -} - -template <> -bool ValueEqualsMatcher::matchesNode( - const FloatingLiteral &Node) const { - if ((&Node.getSemantics()) == &llvm::APFloat::IEEEsingle) - return Node.getValue().convertToFloat() == ExpectedValue; - if ((&Node.getSemantics()) == &llvm::APFloat::IEEEdouble) - return Node.getValue().convertToDouble() == ExpectedValue; - return false; -} - -template <> -bool ValueEqualsMatcher::matchesNode( - const FloatingLiteral &Node) const { - return ExpectedValue.compare(Node.getValue()) == llvm::APFloat::cmpEqual; -} - /// \brief A VariadicDynCastAllOfMatcher object is a /// variadic functor that takes a number of Matcher and returns a /// Matcher that matches TargetT nodes that are matched by all of the diff --git a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp index 9cc011d3..d2e9ee1 100644 --- a/clang/unittests/ASTMatchers/ASTMatchersTest.cpp +++ b/clang/unittests/ASTMatchers/ASTMatchersTest.cpp @@ -2104,16 +2104,8 @@ TEST(Matcher, FloatLiterals) { EXPECT_TRUE(matches("double i = 10.0;", HasFloatLiteral)); EXPECT_TRUE(matches("double i = 10.0L;", HasFloatLiteral)); EXPECT_TRUE(matches("double i = 1e10;", HasFloatLiteral)); - EXPECT_TRUE(matches("double i = 5.0;", floatLiteral(equals(5.0)))); - EXPECT_TRUE(matches("double i = 5.0;", floatLiteral(equals(5.0f)))); - EXPECT_TRUE( - matches("double i = 5.0;", floatLiteral(equals(llvm::APFloat(5.0))))); EXPECT_TRUE(notMatches("float i = 10;", HasFloatLiteral)); - EXPECT_TRUE(notMatches("double i = 5.0;", floatLiteral(equals(6.0)))); - EXPECT_TRUE(notMatches("double i = 5.0;", floatLiteral(equals(6.0f)))); - EXPECT_TRUE( - notMatches("double i = 5.0;", floatLiteral(equals(llvm::APFloat(6.0))))); } TEST(Matcher, NullPtrLiteral) { -- 2.7.4