[PATCH] D114483: [SYCL] Add support for sycl_special_class attribute
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 24 12:13:00 PST 2022
aaron.ballman added inline comments.
================
Comment at: clang/lib/Sema/SemaDecl.cpp:16686-16687
+ if (RD->hasAttr<SYCLSpecialClassAttr>()) {
+ auto *Def = RD->getDefinition();
+ if (Def && !Def->hasInitMethod())
+ Diag(RD->getLocation(),
----------------
zahiraam wrote:
> aaron.ballman wrote:
> > I think we can assert there is a definition given that this is called from "ActOnTagFinishDefinition".
> @aaron.ballman Not sure what you mean by "that this is called from". We are inside the ActOnTagFinishDefinition function.
Sorry for being unclear -- yes, we're inside `ActOnTagFinishDefinition()` and we just called `FinishClass()`, so I don't think we need to test `if (Def)`. Instead, I think we can do:
```
const TagDecl *Def = RD->getDefinition();
assert(Def && "Expected to have a completed definition");
if (!Def->hasInitMethod())
```
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D114483/new/
https://reviews.llvm.org/D114483
More information about the cfe-commits
mailing list