summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Lex/Preprocessor.h2
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp5
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp4
-rw-r--r--clang/lib/Lex/Preprocessor.cpp11
-rw-r--r--clang/unittests/Basic/SourceManagerTest.cpp18
-rw-r--r--clang/unittests/Lex/LexerTest.cpp6
-rw-r--r--clang/unittests/Lex/PPCallbacksTest.cpp10
-rw-r--r--clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp6
8 files changed, 26 insertions, 36 deletions
diff --git a/clang/include/clang/Lex/Preprocessor.h b/clang/include/clang/Lex/Preprocessor.h
index 883de783e19..7c832dda1bc 100644
--- a/clang/include/clang/Lex/Preprocessor.h
+++ b/clang/include/clang/Lex/Preprocessor.h
@@ -455,12 +455,10 @@ private: // Cached tokens state.
public:
Preprocessor(IntrusiveRefCntPtr<PreprocessorOptions> PPOpts,
DiagnosticsEngine &diags, LangOptions &opts,
- const TargetInfo *target,
SourceManager &SM, HeaderSearch &Headers,
ModuleLoader &TheModuleLoader,
IdentifierInfoLookup *IILookup = 0,
bool OwnsHeaderSearch = false,
- bool DelayInitialization = false,
TranslationUnitKind TUKind = TU_Complete);
~Preprocessor();
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() {
diff --git a/clang/unittests/Basic/SourceManagerTest.cpp b/clang/unittests/Basic/SourceManagerTest.cpp
index 88c3fb76ca0..5f39bd41f68 100644
--- a/clang/unittests/Basic/SourceManagerTest.cpp
+++ b/clang/unittests/Basic/SourceManagerTest.cpp
@@ -80,11 +80,11 @@ TEST_F(SourceManagerTest, isBeforeInTranslationUnit) {
VoidModuleLoader ModLoader;
HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags, LangOpts,
&*Target);
- Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, Target.getPtr(),
+ Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts,
SourceMgr, HeaderInfo, ModLoader,
/*IILookup =*/ 0,
- /*OwnsHeaderSearch =*/false,
- /*DelayInitialization =*/ false);
+ /*OwnsHeaderSearch =*/false);
+ PP.Initialize(*Target);
PP.EnterMainSourceFile();
std::vector<Token> toks;
@@ -195,11 +195,11 @@ TEST_F(SourceManagerTest, getMacroArgExpandedLocation) {
VoidModuleLoader ModLoader;
HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags, LangOpts,
&*Target);
- Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, Target.getPtr(),
+ Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts,
SourceMgr, HeaderInfo, ModLoader,
/*IILookup =*/ 0,
- /*OwnsHeaderSearch =*/false,
- /*DelayInitialization =*/ false);
+ /*OwnsHeaderSearch =*/false);
+ PP.Initialize(*Target);
PP.EnterMainSourceFile();
std::vector<Token> toks;
@@ -293,11 +293,11 @@ TEST_F(SourceManagerTest, isBeforeInTranslationUnitWithMacroInInclude) {
VoidModuleLoader ModLoader;
HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags, LangOpts,
&*Target);
- Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, Target.getPtr(),
+ Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts,
SourceMgr, HeaderInfo, ModLoader,
/*IILookup =*/ 0,
- /*OwnsHeaderSearch =*/false,
- /*DelayInitialization =*/ false);
+ /*OwnsHeaderSearch =*/false);
+ PP.Initialize(*Target);
std::vector<MacroAction> Macros;
PP.addPPCallbacks(new MacroTracker(Macros));
diff --git a/clang/unittests/Lex/LexerTest.cpp b/clang/unittests/Lex/LexerTest.cpp
index 0faad459837..57b5c909e0a 100644
--- a/clang/unittests/Lex/LexerTest.cpp
+++ b/clang/unittests/Lex/LexerTest.cpp
@@ -69,10 +69,10 @@ protected:
VoidModuleLoader ModLoader;
HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags, LangOpts,
Target.getPtr());
- Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts, Target.getPtr(),
+ Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts,
SourceMgr, HeaderInfo, ModLoader, /*IILookup =*/ 0,
- /*OwnsHeaderSearch =*/ false,
- /*DelayInitialization =*/ false);
+ /*OwnsHeaderSearch =*/ false);
+ PP.Initialize(*Target);
PP.EnterMainSourceFile();
std::vector<Token> toks;
diff --git a/clang/unittests/Lex/PPCallbacksTest.cpp b/clang/unittests/Lex/PPCallbacksTest.cpp
index bdc026a223c..c5013a7671c 100644
--- a/clang/unittests/Lex/PPCallbacksTest.cpp
+++ b/clang/unittests/Lex/PPCallbacksTest.cpp
@@ -173,11 +173,10 @@ protected:
IntrusiveRefCntPtr<PreprocessorOptions> PPOpts = new PreprocessorOptions();
Preprocessor PP(PPOpts, Diags, LangOpts,
- Target.getPtr(),
SourceMgr, HeaderInfo, ModLoader,
/*IILookup =*/ 0,
- /*OwnsHeaderSearch =*/false,
- /*DelayInitialization =*/ false);
+ /*OwnsHeaderSearch =*/false);
+ PP.Initialize(*Target);
InclusionDirectiveCallbacks* Callbacks = new InclusionDirectiveCallbacks;
PP.addPPCallbacks(Callbacks); // Takes ownership.
@@ -208,11 +207,10 @@ protected:
OpenCLLangOpts, Target.getPtr());
Preprocessor PP(new PreprocessorOptions(), Diags, OpenCLLangOpts,
- Target.getPtr(),
SourceMgr, HeaderInfo, ModLoader,
/*IILookup =*/ 0,
- /*OwnsHeaderSearch =*/false,
- /*DelayInitialization =*/ false);
+ /*OwnsHeaderSearch =*/false);
+ PP.Initialize(*Target);
// parser actually sets correct pragma handlers for preprocessor
// according to LangOptions, so we init Parser to register opencl
diff --git a/clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp b/clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
index bacc899becc..3028f60b57f 100644
--- a/clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
+++ b/clang/unittests/Lex/PPConditionalDirectiveRecordTest.cpp
@@ -97,11 +97,11 @@ TEST_F(PPConditionalDirectiveRecordTest, PPRecAPI) {
VoidModuleLoader ModLoader;
HeaderSearch HeaderInfo(new HeaderSearchOptions, SourceMgr, Diags, LangOpts,
Target.getPtr());
- Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts,Target.getPtr(),
+ Preprocessor PP(new PreprocessorOptions(), Diags, LangOpts,
SourceMgr, HeaderInfo, ModLoader,
/*IILookup =*/ 0,
- /*OwnsHeaderSearch =*/false,
- /*DelayInitialization =*/ false);
+ /*OwnsHeaderSearch =*/false);
+ PP.Initialize(*Target);
PPConditionalDirectiveRecord *
PPRec = new PPConditionalDirectiveRecord(SourceMgr);
PP.addPPCallbacks(PPRec);
OpenPOWER on IntegriCloud