]> granicus.if.org Git - clang/commitdiff
Handle null QualType better in Stmt::Profile
authorRichard Trieu <rtrieu@google.com>
Sat, 4 Mar 2017 02:42:41 +0000 (02:42 +0000)
committerRichard Trieu <rtrieu@google.com>
Sat, 4 Mar 2017 02:42:41 +0000 (02:42 +0000)
If the QualType is null, calling ASTContext::getCanonicalType on it will lead
to an assert.  This was found while testing a new use for Stmt::Profile, so
there is no test case for this.

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

lib/AST/StmtProfile.cpp

index 1ac2a5bf5e1df0e32f235a13f919915e00f378b4..5f3a50b155bcc4c6efa9d486ae54537e7723031f 100644 (file)
@@ -128,7 +128,7 @@ namespace {
     }
 
     void VisitType(QualType T) override {
-      if (Canonical)
+      if (Canonical && !T.isNull())
         T = Context.getCanonicalType(T);
 
       ID.AddPointer(T.getAsOpaquePtr());