[PATCH] D33094: [ASTMatchers] Add clang-query support for equals matcher

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 21 11:12:57 PDT 2017


aaron.ballman added inline comments.


================
Comment at: include/clang/ASTMatchers/ASTMatchers.h:3846
+                                                          CXXBoolLiteralExpr,
+                                                          IntegerLiteral),
+                          unsigned, Value, 1) {
----------------
Is there a reason to not allow the equals matcher to do something like `floatingLiteral(equals(1))`? Sure, the user could always write `1.0`, but it seems somewhat hostile to require it.


================
Comment at: unittests/ASTMatchers/Dynamic/RegistryTest.cpp:534
+  EXPECT_TRUE(matches("double x = 12e-1;", DoubleStmt));
+  EXPECT_FALSE(matches("double x = 1.23;", DoubleStmt));
+
----------------
Can you add tests for floating literals with suffixes (f, l)?


================
Comment at: unittests/ASTMatchers/Dynamic/RegistryTest.cpp:545
+      .getTypedMatcher<Stmt>();
+  EXPECT_TRUE(matches("int x = 'x';", CharStmt));
+  EXPECT_FALSE(matches("int x = 120;", CharStmt));
----------------
Can you add some tests involving the other character literal types (L, u, U, u8)?


https://reviews.llvm.org/D33094





More information about the cfe-commits mailing list