Author: rtrieu
Date: Fri Mar  3 20:42:41 2017
New Revision: 296956

URL: http://llvm.org/viewvc/llvm-project?rev=296956&view=rev
Log:
Handle null QualType better in Stmt::Profile

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.

Modified:
    cfe/trunk/lib/AST/StmtProfile.cpp

Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=296956&r1=296955&r2=296956&view=diff
==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Fri Mar  3 20:42:41 2017
@@ -128,7 +128,7 @@ namespace {
     }
 
     void VisitType(QualType T) override {
-      if (Canonical)
+      if (Canonical && !T.isNull())
         T = Context.getCanonicalType(T);
 
       ID.AddPointer(T.getAsOpaquePtr());


_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to