aboutsummaryrefslogtreecommitdiff
path: root/lib/Frontend/ASTUnit.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-09-01 20:23:19 +0000
committerDouglas Gregor <dgregor@apple.com>2011-09-01 20:23:19 +0000
commit3e3cd93b2fd9644e970c389e715c13883faf68b6 (patch)
tree1735be93ebc02ded757b6205b30c54b10d5282db /lib/Frontend/ASTUnit.cpp
parente3685fd4c2546cfd450de6484ed4125adc1476c0 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/ASTUnit.cpp')
-rw-r--r--lib/Frontend/ASTUnit.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Frontend/ASTUnit.cpp b/lib/Frontend/ASTUnit.cpp
index eee5b1a7cc..b09c435c8a 100644
--- a/lib/Frontend/ASTUnit.cpp
+++ b/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(),