summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-05-02 03:43:30 +0000
committerAlp Toker <alp@nuanti.com>2014-05-02 03:43:30 +0000
commit1ae02f68bea80c5114b808455b922667339f4c90 (patch)
tree214507eed3fc56622146dcfaf9962ac5043a71a7 /clang/lib
parent23aa3532919dfcfea2b12fbd8c8d8b820104744c (diff)
downloadbcm5719-llvm-1ae02f68bea80c5114b808455b922667339f4c90.tar.gz
bcm5719-llvm-1ae02f68bea80c5114b808455b922667339f4c90.zip
Factor TargetInfo pointer/DelayInitialization bool pair out of Preprocessor ctor
The Preprocessor::Initialize() function already offers a clear interface to achieve this, further reducing the confusing number of states a newly constructed preprocessor can have. llvm-svn: 207825
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp5
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp4
-rw-r--r--clang/lib/Lex/Preprocessor.cpp11
3 files changed, 7 insertions, 13 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 009b200472b..6437c3e8b24 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -718,11 +718,10 @@ ASTUnit *ASTUnit::LoadFromASTFile(const std::string &Filename,
AST->PP = new Preprocessor(PPOpts,
AST->getDiagnostics(), AST->ASTFileLangOpts,
- /*Target=*/0, AST->getSourceManager(), HeaderInfo,
+ AST->getSourceManager(), HeaderInfo,
*AST,
/*IILookup=*/0,
- /*OwnsHeaderSearch=*/false,
- /*DelayInitialization=*/true);
+ /*OwnsHeaderSearch=*/false);
Preprocessor &PP = *AST->PP;
AST->Ctx = new ASTContext(AST->ASTFileLangOpts,
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index aa2e07e668b..d20c1a417e8 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -240,11 +240,11 @@ void CompilerInstance::createPreprocessor(TranslationUnitKind TUKind) {
getLangOpts(),
&getTarget());
PP = new Preprocessor(&getPreprocessorOpts(),
- getDiagnostics(), getLangOpts(), &getTarget(),
+ getDiagnostics(), getLangOpts(),
getSourceManager(), *HeaderInfo, *this, PTHMgr,
/*OwnsHeaderSearch=*/true,
- /*DelayInitialization=*/false,
TUKind);
+ PP->Initialize(getTarget());
// Note that this is different then passing PTHMgr to Preprocessor's ctor.
// That argument is used as the IdentifierInfoLookup argument to
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp
index adbee6e3a94..ae28fc01e26 100644
--- a/clang/lib/Lex/Preprocessor.cpp
+++ b/clang/lib/Lex/Preprocessor.cpp
@@ -56,11 +56,11 @@ ExternalPreprocessorSource::~ExternalPreprocessorSource() { }
Preprocessor::Preprocessor(IntrusiveRefCntPtr<PreprocessorOptions> PPOpts,
DiagnosticsEngine &diags, LangOptions &opts,
- const TargetInfo *target, SourceManager &SM,
+ SourceManager &SM,
HeaderSearch &Headers, ModuleLoader &TheModuleLoader,
IdentifierInfoLookup *IILookup, bool OwnsHeaders,
- bool DelayInitialization, TranslationUnitKind TUKind)
- : PPOpts(PPOpts), Diags(&diags), LangOpts(opts), Target(target),
+ TranslationUnitKind TUKind)
+ : PPOpts(PPOpts), Diags(&diags), LangOpts(opts), Target(0),
FileMgr(Headers.getFileMgr()), SourceMgr(SM), HeaderInfo(Headers),
TheModuleLoader(TheModuleLoader), ExternalSource(0),
Identifiers(opts, IILookup), IncrementalProcessing(false),
@@ -132,11 +132,6 @@ Preprocessor::Preprocessor(IntrusiveRefCntPtr<PreprocessorOptions> PPOpts,
Ident___exception_info = Ident___exception_code = Ident___abnormal_termination = 0;
Ident_GetExceptionInfo = Ident_GetExceptionCode = Ident_AbnormalTermination = 0;
}
-
- if (!DelayInitialization) {
- assert(Target && "Must provide target information for PP initialization");
- Initialize(*Target);
- }
}
Preprocessor::~Preprocessor() {
OpenPOWER on IntegriCloud