diff options
| author | Artem Belevich <tra@google.com> | 2015-09-22 17:23:22 +0000 |
|---|---|---|
| committer | Artem Belevich <tra@google.com> | 2015-09-22 17:23:22 +0000 |
| commit | b5bc923af407cbe7e1d96fcb884c7ef5c6897bc0 (patch) | |
| tree | a9c6e261ed99150fc40f767d7ec017ca104b6b8d /clang/lib/Lex | |
| parent | ccf0d699f02710c75556bf74229a1bc4ce85547c (diff) | |
| download | bcm5719-llvm-b5bc923af407cbe7e1d96fcb884c7ef5c6897bc0.tar.gz bcm5719-llvm-b5bc923af407cbe7e1d96fcb884c7ef5c6897bc0.zip | |
[CUDA] Allow parsing of host and device code simultaneously.
* adds -aux-triple option to specify target triple
* propagates aux target info to AST context and Preprocessor
* pulls in target specific preprocessor macros.
* pulls in target-specific builtins from aux target.
* sets appropriate host or device attribute on builtins.
Differential Revision: http://reviews.llvm.org/D12917
llvm-svn: 248299
Diffstat (limited to 'clang/lib/Lex')
| -rw-r--r-- | clang/lib/Lex/Preprocessor.cpp | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/clang/lib/Lex/Preprocessor.cpp b/clang/lib/Lex/Preprocessor.cpp index 29a00d3ca34..82fcde545b8 100644 --- a/clang/lib/Lex/Preprocessor.cpp +++ b/clang/lib/Lex/Preprocessor.cpp @@ -62,20 +62,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 +169,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); } |

