зеркало из https://github.com/microsoft/clang.git
Make sure Sema::ParsedFreeStandingDeclSpec() returns a decl representing the type.
Adding basic printing to StmtPrinter::PrintRawDecl(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44208 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
c37bdf08a1
Коммит
91578f3cdb
|
@ -133,8 +133,16 @@ void StmtPrinter::PrintRawDecl(Decl *D) {
|
|||
PrintExpr(V->getInit());
|
||||
}
|
||||
}
|
||||
} else if (TagDecl *TD = dyn_cast<TagDecl>(D)) {
|
||||
// print a free standing tag decl (e.g. "struct x;").
|
||||
OS << TD->getKindName();
|
||||
OS << " ";
|
||||
if (const IdentifierInfo *II = TD->getIdentifier())
|
||||
OS << II->getName();
|
||||
else
|
||||
OS << "<anonymous>";
|
||||
// FIXME: print tag bodies.
|
||||
} else {
|
||||
// FIXME: "struct x;"
|
||||
assert(0 && "Unexpected decl");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -536,7 +536,7 @@ namespace {
|
|||
} else if (FileVarDecl *FVD = dyn_cast<FileVarDecl>(D)) {
|
||||
CodeGen::CodeGenGlobalVar(Builder, FVD);
|
||||
} else {
|
||||
assert(isa<TypedefDecl>(D) && "Only expected typedefs here");
|
||||
assert(isa<TypeDecl>(D) && "Only expected type decls here");
|
||||
// don't codegen for now, eventually pass down for debug info.
|
||||
//std::cerr << "Read top-level typedef decl: '" << D->getName() << "'\n";
|
||||
}
|
||||
|
|
|
@ -347,7 +347,7 @@ Sema::DeclTy *Sema::ParsedFreeStandingDeclSpec(Scope *S, DeclSpec &DS) {
|
|||
// TODO: emit error on 'typedef int;'
|
||||
// if (!DS.isMissingDeclaratorOk()) Diag(...);
|
||||
|
||||
return 0;
|
||||
return DS.getTypeRep();
|
||||
}
|
||||
|
||||
bool Sema::CheckSingleInitializer(Expr *&Init, bool isStatic,
|
||||
|
|
Загрузка…
Ссылка в новой задаче