]> granicus.if.org Git - clang/commitdiff
Prevent crashes from hasCanonicalType matcher
authorEdwin Vane <edwin.vane@intel.com>
Tue, 7 May 2013 15:53:23 +0000 (15:53 +0000)
committerEdwin Vane <edwin.vane@intel.com>
Tue, 7 May 2013 15:53:23 +0000 (15:53 +0000)
Adding an QualType::isNull() check.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181329 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/ASTMatchers/ASTMatchers.h

index ab62dd0c3e81e31dca380e6e72d768e5bd607708..70f539be79443adafa6fd04af646c9745e615f05 100644 (file)
@@ -1841,6 +1841,8 @@ AST_MATCHER_P(QualType, references, internal::Matcher<QualType>,
 /// varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
 AST_MATCHER_P(QualType, hasCanonicalType, internal::Matcher<QualType>,
               InnerMatcher) {
+  if (Node.isNull())
+    return false;
   return InnerMatcher.matches(Node.getCanonicalType(), Finder, Builder);
 }