r227895 - Revert "Add some overloads so that floating point literals can be AST matched properly."

Daniel Jasper djasper at google.com
Mon Feb 2 15:35:39 PST 2015


Author: djasper
Date: Mon Feb  2 17:35:39 2015
New Revision: 227895

URL: http://llvm.org/viewvc/llvm-project?rev=227895&view=rev
Log:
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.

Modified:
    cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
    cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp

Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h?rev=227895&r1=227894&r2=227895&view=diff
==============================================================================
--- cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h (original)
+++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersInternal.h Mon Feb  2 17:35:39 2015
@@ -1456,32 +1456,6 @@ private:
   const ValueT ExpectedValue;
 };
 
-template <>
-bool ValueEqualsMatcher<FloatingLiteral, double>::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<FloatingLiteral, float>::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<FloatingLiteral, llvm::APFloat>::matchesNode(
-    const FloatingLiteral &Node) const {
-  return ExpectedValue.compare(Node.getValue()) == llvm::APFloat::cmpEqual;
-}
-
 /// \brief A VariadicDynCastAllOfMatcher<SourceT, TargetT> object is a
 /// variadic functor that takes a number of Matcher<TargetT> and returns a
 /// Matcher<SourceT> that matches TargetT nodes that are matched by all of the

Modified: cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp?rev=227895&r1=227894&r2=227895&view=diff
==============================================================================
--- cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp (original)
+++ cfe/trunk/unittests/ASTMatchers/ASTMatchersTest.cpp Mon Feb  2 17:35:39 2015
@@ -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) {





More information about the cfe-commits mailing list