Also added a cast to be safe...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44209
91177308-0d34-0410-b5e6-
96231b3b80d8
}
}
fprintf(F, "\"");
+ } else if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
+ // print a free standing tag decl (e.g. "struct x;").
+ const char *tagname;
+ if (const IdentifierInfo *II = TD->getIdentifier())
+ tagname = II->getName();
+ else
+ tagname = "<anonymous>";
+ fprintf(F, "\"%s %s;\"", TD->getKindName(), tagname);
+ // FIXME: print tag bodies.
} else {
- // FIXME: "struct x;"
assert(0 && "Unexpected decl");
}
}
// TODO: emit error on 'typedef int;'
// if (!DS.isMissingDeclaratorOk()) Diag(...);
- return DS.getTypeRep();
+ return dyn_cast_or_null<TagDecl>(static_cast<Decl *>(DS.getTypeRep()));
}
bool Sema::CheckSingleInitializer(Expr *&Init, bool isStatic,