[PATCH] Adding hasDeclaration overload for TemplateSpecializationType

Edwin Vane edwin.vane at intel.com
Wed Feb 20 11:17:31 PST 2013


Hi klimek,

TemplatespecializationType doesn't quite have getDecl(). Need to go
through TemplateName to get a TemplateDecl.

http://llvm-reviews.chandlerc.com/D432

Files:
  include/clang/ASTMatchers/ASTMatchersInternal.h

Index: include/clang/ASTMatchers/ASTMatchersInternal.h
===================================================================
--- include/clang/ASTMatchers/ASTMatchersInternal.h
+++ include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -394,6 +394,7 @@
     return matchesDecl(Node.getDecl(), Finder, Builder);
   }
 
+
   /// \brief Extracts the CXXRecordDecl or EnumDecl of a QualType and returns
   /// whether the inner matcher matches on it.
   bool matchesSpecialized(const QualType &Node, ASTMatchFinder *Finder,
@@ -406,6 +407,15 @@
     return matchesDecl(Node->getAsCXXRecordDecl(), Finder, Builder);
   }
 
+  /// \brief Gets the TemplateDecl from a TemplateSpecializationType
+  /// and returns whether the inner matches on it.
+  bool matchesSpecialized(const TemplateSpecializationType &Node,
+                          ASTMatchFinder *Finder,
+                          BoundNodesTreeBuilder *Builder) const {
+    return matchesDecl(Node.getTemplateName().getAsTemplateDecl(),
+                       Finder, Builder);
+  }
+
   /// \brief Extracts the Decl of the callee of a CallExpr and returns whether
   /// the inner matcher matches on it.
   bool matchesSpecialized(const CallExpr &Node, ASTMatchFinder *Finder,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D432.1.patch
Type: text/x-patch
Size: 1229 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130220/f3ffbc96/attachment.bin>


More information about the cfe-commits mailing list