The canonical declaration of a NULL declaration is NULL
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71409 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index f9d648b..52eadef 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -1704,6 +1704,9 @@
}
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)