The canonical declaration of a NULL declaration is NULL

llvm-svn: 71409
This commit is contained in:
Douglas Gregor 2009-05-10 22:59:12 +00:00
parent e362cea568
commit 5e4e50c280
1 changed files with 3 additions and 0 deletions

View 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)