dgregor should write code that compiles.

llvm-svn: 110956
This commit is contained in:
John McCall 2010-08-12 21:23:27 +00:00
parent 3d87b69f7d
commit 0af2b7c93e
2 changed files with 9 additions and 7 deletions

View File

@ -67,6 +67,8 @@ void clang::ParseAST(Sema &S, bool PrintStats) {
Stmt::CollectingStats(true);
}
ASTConsumer *Consumer = &S.getASTConsumer();
Parser P(S.getPreprocessor(), S);
S.getPreprocessor().EnterMainSourceFile();
@ -93,15 +95,15 @@ void clang::ParseAST(Sema &S, bool PrintStats) {
Consumer->HandleTopLevelDecl(DeclGroupRef(*I));
// Dump record layouts, if requested.
if (PP.getLangOptions().DumpRecordLayouts)
DumpRecordLayouts(Ctx);
if (S.getLangOptions().DumpRecordLayouts)
DumpRecordLayouts(S.getASTContext());
Consumer->HandleTranslationUnit(Ctx);
Consumer->HandleTranslationUnit(S.getASTContext());
if (PrintStats) {
fprintf(stderr, "\nSTATISTICS:\n");
P.getActions().PrintStats();
Ctx.PrintStats();
S.getASTContext().PrintStats();
Decl::PrintStats();
Stmt::PrintStats();
Consumer->PrintStats();

View File

@ -18,7 +18,7 @@
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/APFloat.h"
#include "clang/Sema/ExternalSemaSource.h"
#include "clang/AST/ASTConsumer.h"
#include "clang/Sema/SemaConsumer.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/ASTDiagnostic.h"
#include "clang/AST/DeclObjC.h"
@ -145,7 +145,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
ExpressionEvaluationContextRecord(PotentiallyEvaluated, 0));
// Tell the AST consumer about this Sema object.
Consumer.Initialize(this);
Consumer.Initialize(Context);
// FIXME: Isn't this redundant with the initialization above?
if (SemaConsumer *SC = dyn_cast<SemaConsumer>(&Consumer))
@ -154,7 +154,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
// Tell the external Sema source about this Sema object.
if (ExternalSemaSource *ExternalSema
= dyn_cast_or_null<ExternalSemaSource>(Context.getExternalSource()))
ExternalSema->InitializeSema(S)
ExternalSema->InitializeSema(*this);
}
Sema::~Sema() {