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, diag::err_ref_bad_target) - << /*host*/ 2 << /*variable*/ 1 << Var << Target; + if (Var && Var->hasGlobalStorage()) { + if (!IsEmittedOnDeviceSide(Var)) { ---------------- tra wrote: > 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. > You are right. I missed `if (Var && Var->hasGlobalStorage())`. The patch has been committed. Will make the change by a commit directly. Thanks. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D102270/new/ https://reviews.llvm.org/D102270 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits