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

Peter Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 7 14:42:05 PDT 2017


Lekensteyn updated this revision to Diff 101817.
Lekensteyn marked 7 inline comments as done.
Lekensteyn added a comment.

diff from previous patch:

  diff --git a/unittests/ASTMatchers/Dynamic/RegistryTest.cpp b/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
  index 29fcdec6c1..84e31f721a 100644
  --- a/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
  +++ b/unittests/ASTMatchers/Dynamic/RegistryTest.cpp
  @@ -530,6 +530,8 @@ TEST_F(RegistryTest, EqualsMatcher) {
         "floatLiteral", constructMatcher("equals", VariantValue(1.2)))
         .getTypedMatcher<Stmt>();
     EXPECT_TRUE(matches("double x = 1.2;", DoubleStmt));
  +  EXPECT_TRUE(matches("double x = 1.2f;", DoubleStmt));
  +  EXPECT_TRUE(matches("double x = 1.2l;", DoubleStmt));
     EXPECT_TRUE(matches("double x = 12e-1;", DoubleStmt));
     EXPECT_FALSE(matches("double x = 1.23;", DoubleStmt));
   
  @@ -543,6 +545,9 @@ TEST_F(RegistryTest, EqualsMatcher) {
         "characterLiteral", constructMatcher("equals", VariantValue('x')))
         .getTypedMatcher<Stmt>();
     EXPECT_TRUE(matches("int x = 'x';", CharStmt));
  +  EXPECT_TRUE(matches("int x = L'x';", CharStmt));
  +  EXPECT_TRUE(matches("int x = u'x';", CharStmt));
  +  EXPECT_TRUE(matches("int x = U'x';", CharStmt));
     EXPECT_FALSE(matches("int x = 120;", CharStmt));
   }


https://reviews.llvm.org/D33094

Files:
  docs/LibASTMatchersReference.html
  include/clang/ASTMatchers/ASTMatchers.h
  lib/ASTMatchers/Dynamic/Registry.cpp
  unittests/ASTMatchers/Dynamic/RegistryTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33094.101817.patch
Type: text/x-patch
Size: 18484 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170607/34e7b276/attachment-0001.bin>


More information about the cfe-commits mailing list