[PATCH] Add clang-query check for hasUnderlyingType() narrowing matcher

Richard legalize at xmission.com
Sun Mar 8 08:34:22 PDT 2015


Hi chapuni, pcc, craig.topper, aprantl,

Gives an example of how to use `hasUnderlyingType()` in `clang-query` and also serves as an integration test for that narrowing matcher

http://reviews.llvm.org/D8150

Files:
  test/clang-query/has-underlying-type.cpp

Index: test/clang-query/has-underlying-type.cpp
===================================================================
--- /dev/null
+++ test/clang-query/has-underlying-type.cpp
@@ -0,0 +1,25 @@
+// RUN: clang-query -c "match typedefDecl(hasUnderlyingType(asString(\"int\")))" %s -- -std=c++11 | FileCheck %s
+
+typedef char Character;
+typedef const char ConstCharacter;
+typedef volatile char VolatileCharacter;
+typedef short Short;
+typedef const short ConstShort;
+typedef volatile short VolatileShort;
+typedef int Integer;
+// CHECK: has-underlying-type.cpp:[[@LINE-1]]:1: note: "root" binds here
+typedef const int ConstInteger;
+typedef volatile int VolatileInteger;
+typedef long Long;
+typedef const long ConstLong;
+typedef volatile long VolatileLong;
+
+typedef float Float;
+typedef const float ConstFloat;
+typedef volatile float VolatileFloat;
+typedef double Double;
+typedef const double ConstDouble;
+typedef volatile double VolatileDouble;
+
+typedef void NullaryFunctionReturningVoid();
+typedef int NullaryFunctionReturningInt();

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8150.21448.patch
Type: text/x-patch
Size: 1049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150308/71bfc4ad/attachment.bin>


More information about the cfe-commits mailing list