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
/// LangOpts - The language options used to create the AST associated with
/// this ASTContext object.
- LangOptions LangOpts;
+ LangOptions &LangOpts;
/// \brief The allocator used to create AST objects.
///
mutable QualType AutoDeductTy; // Deduction against 'auto'.
mutable QualType AutoRRefDeductTy; // Deduction against 'auto &&'.
- ASTContext(const LangOptions& LOpts, SourceManager &SM, const TargetInfo &t,
+ ASTContext(LangOptions& LOpts, SourceManager &SM, const TargetInfo &t,
IdentifierTable &idents, SelectorTable &sels,
Builtin::Context &builtins,
unsigned size_reserve);
/// \brief Whether we want to include nested macro expansions in the
/// detailed preprocessing record.
bool NestedMacroExpansions;
-
+
+ /// \brief The language options used when we load an AST file.
+ LangOptions ASTFileLangOpts;
+
static void ConfigureDiags(llvm::IntrusiveRefCntPtr<Diagnostic> &Diags,
const char **ArgBegin, const char **ArgEnd,
ASTUnit &AST, bool CaptureDiagnostics);
///
class Preprocessor : public llvm::RefCountedBase<Preprocessor> {
Diagnostic *Diags;
- LangOptions Features;
+ LangOptions &Features;
const TargetInfo &Target;
FileManager &FileMgr;
SourceManager &SourceMgr;
MacroInfo *getInfoForMacro(IdentifierInfo *II) const;
public:
- Preprocessor(Diagnostic &diags, const LangOptions &opts,
+ Preprocessor(Diagnostic &diags, LangOptions &opts,
const TargetInfo &target,
SourceManager &SM, HeaderSearch &Headers,
ModuleLoader &TheModuleLoader,
SourceManager &SourceMgr;
FileManager &FileMgr;
Diagnostic &Diags;
-
+
/// \brief The semantic analysis object that will be processing the
/// AST files and the translation unit that uses it.
Sema *SemaObj;
}
}
-ASTContext::ASTContext(const LangOptions& LOpts, SourceManager &SM,
+ASTContext::ASTContext(LangOptions& LOpts, SourceManager &SM,
const TargetInfo &t,
IdentifierTable &idents, SelectorTable &sels,
Builtin::Context &builtins,
// Gather Info for preprocessor construction later on.
- LangOptions LangInfo;
HeaderSearch &HeaderInfo = *AST->HeaderInfo.get();
std::string TargetTriple;
std::string Predefines;
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:
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());
// Create and initialize the ASTContext.
- AST->Ctx = new ASTContext(LangInfo,
+ AST->Ctx = new ASTContext(AST->ASTFileLangOpts,
AST->getSourceManager(),
*AST->Target,
PP.getIdentifierTable(),
//===----------------------------------------------------------------------===//
ExternalPreprocessorSource::~ExternalPreprocessorSource() { }
-Preprocessor::Preprocessor(Diagnostic &diags, const LangOptions &opts,
+Preprocessor::Preprocessor(Diagnostic &diags, LangOptions &opts,
const TargetInfo &target, SourceManager &SM,
HeaderSearch &Headers, ModuleLoader &TheModuleLoader,
IdentifierInfoLookup* IILookup,