]> granicus.if.org Git - clang/commitdiff
The canonical declaration of a NULL declaration is NULL
authorDouglas Gregor <dgregor@apple.com>
Sun, 10 May 2009 22:59:12 +0000 (22:59 +0000)
committerDouglas Gregor <dgregor@apple.com>
Sun, 10 May 2009 22:59:12 +0000 (22:59 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71409 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/ASTContext.cpp

index f9d648b816b392f6328a49f07c3245887bfb4b0c..52eadef75ab9e60e0f0e745fa7600c2335af4412 100644 (file)
@@ -1704,6 +1704,9 @@ QualType ASTContext::getCanonicalType(QualType T) {
 }
 
 Decl *ASTContext::getCanonicalDecl(Decl *D) {
+  if (!D)
+    return 0;
+
   if (TagDecl *Tag = dyn_cast<TagDecl>(D)) {
     QualType T = getTagDeclType(Tag);
     return cast<TagDecl>(cast<TagType>(T.getTypePtr()->CanonicalType)