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/Sema/SemaDecl.cpp | |
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/Sema/SemaDecl.cpp')
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index 22d2d3469f6..9195a060dbf 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -11293,11 +11293,11 @@ void Sema::AddKnownFunctionAttributes(FunctionDecl *FD) { if (getLangOpts().CUDA && getLangOpts().CUDATargetOverloads && Context.BuiltinInfo.isTSBuiltin(BuiltinID) && !FD->hasAttr<CUDADeviceAttr>() && !FD->hasAttr<CUDAHostAttr>()) { - // Target-specific builtins are assumed to be intended for use - // in this particular CUDA compilation mode and should have - // appropriate attribute set so we can enforce CUDA function - // call restrictions. - if (getLangOpts().CUDAIsDevice) + // Assign appropriate attribute depending on CUDA compilation + // mode and the target builtin belongs to. E.g. during host + // compilation, aux builtins are __device__, the rest are __host__. + if (getLangOpts().CUDAIsDevice != + Context.BuiltinInfo.isAuxBuiltinID(BuiltinID)) FD->addAttr(CUDADeviceAttr::CreateImplicit(Context, FD->getLocation())); else FD->addAttr(CUDAHostAttr::CreateImplicit(Context, FD->getLocation())); |