Adding basic printing to StmtPrinter::PrintRawDecl().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44208
91177308-0d34-0410-b5e6-
96231b3b80d8
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");
}
}
} 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";
}
// TODO: emit error on 'typedef int;'
// if (!DS.isMissingDeclaratorOk()) Diag(...);
- return 0;
+ return DS.getTypeRep();
}
bool Sema::CheckSingleInitializer(Expr *&Init, bool isStatic,