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/
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();
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to