yaxunl marked 2 inline comments as done.
yaxunl added inline comments.

================
Comment at: clang/lib/Sema/Sema.cpp:1540
+    } else if (auto *VD = dyn_cast<VarDecl>(D)) {
+      if (auto *Init = VD->getInit()) {
+        auto DevTy = OMPDeclareTargetDeclAttr::getDeviceType(VD);
----------------
rjmccall wrote:
> yaxunl wrote:
> > rjmccall wrote:
> > > yaxunl wrote:
> > > > rjmccall wrote:
> > > > > Can there also be deferred diagnostics associated with this 
> > > > > initializer?
> > > > Yes. A global variable may be marked by omp declare target directive to 
> > > > be emitted on device. If the global var is initialized with the address 
> > > > of a function, the function will be emitted on device. If the device 
> > > > function calls a host device function which contains a deferred diag, 
> > > > that diag will be emitted. This can only be known after everything is 
> > > > parsed.
> > > I meant directly with the initializer.  Is there a way today to defer a 
> > > diagnostic that you would emit while processing an initializer 
> > > expression?  If so, this needs to trigger that.
> > I don't think the initializer itself (without a target declare directive) 
> > will cause a deferred diagnostic since it does not cause change of emission 
> > states of functions. 
> Okay, so if I'm getting this right: only functions are emitted lazily, and 
> variables have to be marked specially in order to get emitted on the device, 
> so there's no need to defer diagnostics within variable initializations 
> because we always know at the time of processing the variable where it will 
> be emitted?
right.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70172/new/

https://reviews.llvm.org/D70172



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to