[PATCH] D102270: [CUDA][HIP] Fix device template variables

2021-05-12 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl closed this revision. yaxunl marked an inline comment as done. yaxunl added inline comments. Comment at: clang/lib/Sema/SemaExpr.cpp:17145 }; -if (Var && Var->hasGlobalStorage() && !IsEmittedOnDeviceSide(Var)) { - SemaRef.targetDiag(Loc,

[PATCH] D102270: [CUDA][HIP] Fix device template variables

2021-05-12 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision. tra added inline comments. Comment at: clang/lib/Sema/SemaExpr.cpp:17145 }; -if (Var && Var->hasGlobalStorage() && !IsEmittedOnDeviceSide(Var)) { - SemaRef.targetDiag(Loc, diag::err_ref_bad_target) - << /*host*/ 2 <<

[PATCH] D102270: [CUDA][HIP] Fix device template variables

2021-05-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 344629. yaxunl edited the summary of this revision. yaxunl added a comment. fix lint warning CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102270/new/ https://reviews.llvm.org/D102270 Files: clang/include/clang/AST/ASTContext.h

[PATCH] D102270: [CUDA][HIP] Fix device template variables

2021-05-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 344605. yaxunl added a comment. Revised by Artem's comments CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102270/new/ https://reviews.llvm.org/D102270 Files: clang/include/clang/AST/ASTContext.h clang/lib/AST/ASTContext.cpp

[PATCH] D102270: [CUDA][HIP] Fix device template variables

2021-05-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D102270#2751852 , @tra wrote: > LGTM in general. > Perhaps it would make sense to combine this patch with D102237 > as both patches are changing the same code > for the same reason, just for

[PATCH] D102270: [CUDA][HIP] Fix device template variables

2021-05-11 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision. tra added a comment. This revision is now accepted and ready to land. LGTM in general. Perhaps it would make sense to combine this patch with D102237 as both patches are changing the same code for the same reason, just for slightly

[PATCH] D102270: [CUDA][HIP] Fix device template variables

2021-05-11 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl created this revision. yaxunl added a reviewer: tra. yaxunl requested review of this revision. Currently clang does not emit device template variables instantiated only in host functions, however, nvcc is able to do that: https://godbolt.org/z/fneEfferY This patch fixes this issue by