summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorArtem Belevich <tra@google.com>2015-04-28 20:31:49 +0000
committerArtem Belevich <tra@google.com>2015-04-28 20:31:49 +0000
commita0473a547918ef3537cd58e52760f0e8da5e43ab (patch)
treebc3205a288a2d0a69c64a1bc61fb52b57a1efb95 /clang/lib/Sema/SemaDecl.cpp
parentad3cfaaa20703dfed11945e26f7f9ca0afc06566 (diff)
downloadbcm5719-llvm-a0473a547918ef3537cd58e52760f0e8da5e43ab.tar.gz
bcm5719-llvm-a0473a547918ef3537cd58e52760f0e8da5e43ab.zip
[cuda] Preserve TLS storage class of host variable even if it's a
device-side compilation. llvm-svn: 236029
Diffstat (limited to 'clang/lib/Sema/SemaDecl.cpp')
-rw-r--r--clang/lib/Sema/SemaDecl.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index e11b4e14c58..34e5784e862 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -5769,12 +5769,16 @@ Sema::ActOnVariableDeclarator(Scope *S, Declarator &D, DeclContext *DC,
diag::err_thread_non_global)
<< DeclSpec::getSpecifierName(TSCS);
else if (!Context.getTargetInfo().isTLSSupported()) {
- if (getLangOpts().CUDA)
+ if (getLangOpts().CUDA) {
// Postpone error emission until we've collected attributes required to
// figure out whether it's a host or device variable and whether the
// error should be ignored.
EmitTLSUnsupportedError = true;
- else
+ // We still need to mark the variable as TLS so it shows up in AST with
+ // proper storage class for other tools to use even if we're not going
+ // to emit any code for it.
+ NewVD->setTSCSpec(TSCS);
+ } else
Diag(D.getDeclSpec().getThreadStorageClassSpecLoc(),
diag::err_thread_unsupported);
} else
OpenPOWER on IntegriCloud