diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-04-08 02:59:56 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-04-08 02:59:56 +0000 |
commit | 8ee6760971085f63258bca2777da61adfe446afe (patch) | |
tree | 5c311e6395f36d3fd333bbf7592648c79384928e /clang/lib/Sema/ParseAST.cpp | |
parent | aa423afffcb55be23c4ba76e18c0c22411b01a39 (diff) | |
download | bcm5719-llvm-8ee6760971085f63258bca2777da61adfe446afe.tar.gz bcm5719-llvm-8ee6760971085f63258bca2777da61adfe446afe.zip |
Fronted: Kill overly specialized RecordLayoutDumper, just make -dump-record-layouts a bit that Sema honors.
llvm-svn: 100747
Diffstat (limited to 'clang/lib/Sema/ParseAST.cpp')
-rw-r--r-- | clang/lib/Sema/ParseAST.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/clang/lib/Sema/ParseAST.cpp b/clang/lib/Sema/ParseAST.cpp index 7cd39895f6f..f620927a8dd 100644 --- a/clang/lib/Sema/ParseAST.cpp +++ b/clang/lib/Sema/ParseAST.cpp @@ -24,6 +24,26 @@ using namespace clang; +static void DumpRecordLayouts(ASTContext &C) { + for (ASTContext::type_iterator I = C.types_begin(), E = C.types_end(); + I != E; ++I) { + const RecordType *RT = dyn_cast<RecordType>(*I); + if (!RT) + continue; + + const CXXRecordDecl *RD = dyn_cast<CXXRecordDecl>(RT->getDecl()); + if (!RD || RD->isImplicit() || RD->isDependentType() || + RD->isInvalidDecl() || !RD->getDefinition()) + continue; + + // FIXME: Do we really need to hard code this? + if (RD->getQualifiedNameAsString() == "__va_list_tag") + continue; + + C.DumpRecordLayout(RD, llvm::errs()); + } +} + //===----------------------------------------------------------------------===// // Public interface to the file //===----------------------------------------------------------------------===// @@ -82,6 +102,10 @@ void clang::ParseAST(Preprocessor &PP, ASTConsumer *Consumer, E = S.WeakTopLevelDecls().end(); I != E; ++I) Consumer->HandleTopLevelDecl(DeclGroupRef(*I)); + // Dump record layouts, if requested. + if (PP.getLangOptions().DumpRecordLayouts) + DumpRecordLayouts(Ctx); + Consumer->HandleTranslationUnit(Ctx); if (ExternalSemaSource *ESS = |