diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Lex/Preprocessor.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Lex/Preprocessor.cpp | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/contrib/llvm/tools/clang/lib/Lex/Preprocessor.cpp b/contrib/llvm/tools/clang/lib/Lex/Preprocessor.cpp index e2db638..142d9ce 100644 --- a/contrib/llvm/tools/clang/lib/Lex/Preprocessor.cpp +++ b/contrib/llvm/tools/clang/lib/Lex/Preprocessor.cpp @@ -38,6 +38,7 @@ #include "clang/Lex/MacroArgs.h" #include "clang/Lex/MacroInfo.h" #include "clang/Lex/ModuleLoader.h" +#include "clang/Lex/PTHManager.h" #include "clang/Lex/Pragma.h" #include "clang/Lex/PreprocessingRecord.h" #include "clang/Lex/PreprocessorOptions.h" @@ -62,20 +63,19 @@ Preprocessor::Preprocessor(IntrusiveRefCntPtr<PreprocessorOptions> PPOpts, IdentifierInfoLookup *IILookup, bool OwnsHeaders, TranslationUnitKind TUKind) : PPOpts(PPOpts), Diags(&diags), LangOpts(opts), Target(nullptr), - FileMgr(Headers.getFileMgr()), SourceMgr(SM), - ScratchBuf(new ScratchBuffer(SourceMgr)),HeaderInfo(Headers), + AuxTarget(nullptr), FileMgr(Headers.getFileMgr()), SourceMgr(SM), + ScratchBuf(new ScratchBuffer(SourceMgr)), HeaderInfo(Headers), TheModuleLoader(TheModuleLoader), ExternalSource(nullptr), Identifiers(opts, IILookup), PragmaHandlers(new PragmaNamespace(StringRef())), - IncrementalProcessing(false), TUKind(TUKind), - CodeComplete(nullptr), CodeCompletionFile(nullptr), - CodeCompletionOffset(0), LastTokenWasAt(false), - ModuleImportExpectsIdentifier(false), CodeCompletionReached(0), - MainFileDir(nullptr), SkipMainFilePreamble(0, true), CurPPLexer(nullptr), - CurDirLookup(nullptr), CurLexerKind(CLK_Lexer), CurSubmodule(nullptr), - Callbacks(nullptr), CurSubmoduleState(&NullSubmoduleState), - MacroArgCache(nullptr), Record(nullptr), - MIChainHead(nullptr), DeserialMIChainHead(nullptr) { + IncrementalProcessing(false), TUKind(TUKind), CodeComplete(nullptr), + CodeCompletionFile(nullptr), CodeCompletionOffset(0), + LastTokenWasAt(false), ModuleImportExpectsIdentifier(false), + CodeCompletionReached(0), MainFileDir(nullptr), + SkipMainFilePreamble(0, true), CurPPLexer(nullptr), CurDirLookup(nullptr), + CurLexerKind(CLK_Lexer), CurSubmodule(nullptr), Callbacks(nullptr), + CurSubmoduleState(&NullSubmoduleState), MacroArgCache(nullptr), + Record(nullptr), MIChainHead(nullptr), DeserialMIChainHead(nullptr) { OwnsHeaderSearch = OwnsHeaders; CounterValue = 0; // __COUNTER__ starts at 0. @@ -170,13 +170,18 @@ Preprocessor::~Preprocessor() { delete &HeaderInfo; } -void Preprocessor::Initialize(const TargetInfo &Target) { +void Preprocessor::Initialize(const TargetInfo &Target, + const TargetInfo *AuxTarget) { assert((!this->Target || this->Target == &Target) && "Invalid override of target information"); this->Target = &Target; - + + assert((!this->AuxTarget || this->AuxTarget == AuxTarget) && + "Invalid override of aux target information."); + this->AuxTarget = AuxTarget; + // Initialize information about built-ins. - BuiltinInfo.InitializeTarget(Target); + BuiltinInfo.InitializeTarget(Target, AuxTarget); HeaderInfo.setTarget(Target); } @@ -515,7 +520,7 @@ void Preprocessor::EnterMainSourceFile() { llvm::MemoryBuffer::getMemBufferCopy(Predefines, "<built-in>"); assert(SB && "Cannot create predefined source buffer"); FileID FID = SourceMgr.createFileID(std::move(SB)); - assert(!FID.isInvalid() && "Could not create FileID for predefines?"); + assert(FID.isValid() && "Could not create FileID for predefines?"); setPredefinesFileID(FID); // Start parsing the predefines. @@ -712,7 +717,7 @@ bool Preprocessor::HandleIdentifier(Token &Identifier) { } void Preprocessor::Lex(Token &Result) { - // We loop here until a lex function retuns a token; this avoids recursion. + // We loop here until a lex function returns a token; this avoids recursion. bool ReturnedToken; do { switch (CurLexerKind) { |