diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-01 20:23:19 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-01 20:23:19 +0000 |
commit | 7018d5bcfb48502c5ab7d9bc89eb3d41dd8fb76d (patch) | |
tree | 8beb4c56592139275ffe69042526045cd0c85b50 /clang/lib/Frontend/ASTUnit.cpp | |
parent | 415e47dd6e51565fbddcc4974fd77e6f3b2aeabc (diff) | |
download | bcm5719-llvm-7018d5bcfb48502c5ab7d9bc89eb3d41dd8fb76d.tar.gz bcm5719-llvm-7018d5bcfb48502c5ab7d9bc89eb3d41dd8fb76d.zip |
Teach ASTContext and Preprocessor to hold on to references to the same
LangOptions, rather than making distinct copies of
LangOptions. Granted, LangOptions doesn't actually get modified, but
this will eventually make it easier to construct ASTContext and
Preprocessor before we know all of the LangOptions.
llvm-svn: 138959
Diffstat (limited to 'clang/lib/Frontend/ASTUnit.cpp')
-rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index eee5b1a7cca..b09c435c8a0 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -572,7 +572,6 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename, // Gather Info for preprocessor construction later on. - LangOptions LangInfo; HeaderSearch &HeaderInfo = *AST->HeaderInfo.get(); std::string TargetTriple; std::string Predefines; @@ -587,8 +586,8 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename, llvm::CrashRecoveryContextCleanupRegistrar<ASTReader> ReaderCleanup(Reader.get()); - Reader->setListener(new ASTInfoCollector(LangInfo, HeaderInfo, TargetTriple, - Predefines, Counter)); + Reader->setListener(new ASTInfoCollector(AST->ASTFileLangOpts, HeaderInfo, + TargetTriple, Predefines, Counter)); switch (Reader->ReadAST(Filename, serialization::MK_MainFile)) { case ASTReader::Success: @@ -615,8 +614,9 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename, TargetOpts.Triple = TargetTriple; AST->Target = TargetInfo::CreateTargetInfo(AST->getDiagnostics(), TargetOpts); - AST->PP = new Preprocessor(AST->getDiagnostics(), LangInfo, *AST->Target, - AST->getSourceManager(), HeaderInfo, *AST); + AST->PP = new Preprocessor(AST->getDiagnostics(), AST->ASTFileLangOpts, + *AST->Target, AST->getSourceManager(), HeaderInfo, + *AST); Preprocessor &PP = *AST->PP; PP.setPredefines(Reader->getSuggestedPredefines()); @@ -625,7 +625,7 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename, // Create and initialize the ASTContext. - AST->Ctx = new ASTContext(LangInfo, + AST->Ctx = new ASTContext(AST->ASTFileLangOpts, AST->getSourceManager(), *AST->Target, PP.getIdentifierTable(), |