[PATCH] D102270: [CUDA][HIP] Fix device template variables
Artem Belevich via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 12 10:07:04 PDT 2021
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 << /*variable*/ 1 << Var << Target;
+ if (Var && Var->hasGlobalStorage()) {
+ if (!IsEmittedOnDeviceSide(Var)) {
----------------
Revisiting my comment from https://reviews.llvm.org/D102237#inline-967732
I think this can be combined with the `if (SemaRef.LangOpts.CUDA)` above.
Unless I'm missing something obvious, what we have now is
```
if (SemaRef.LangOpts.CUDA) {
<vars>
if (Var && Var->hasGlobalStorage()) {
}
}
```
You've mentioned that they can't be combined because of an `else`, but there's no else in the `if (Var && Var->hasGlobalStorage()) ` as far as I can see, and `<vars>` could be moved inside it.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D102270/new/
https://reviews.llvm.org/D102270
More information about the cfe-commits
mailing list