[PATCH] D49725: [OpenCL] Forbid size dependent types used as kernel arguments
Anastasia Stulova via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 24 06:53:05 PDT 2018
Anastasia added inline comments.
================
Comment at: lib/Sema/SemaDecl.cpp:8186
- const RecordDecl *PD = PT->castAs<RecordType>()->getDecl();
- VisitStack.push_back(PD);
+ // At this point we already handled everything except of a RecordType or
+ // an ArrayType[RecordType].
----------------
I am a bit confused about this comment, `do you mean a PointerType to a RecordType or an ArrayType of a RecordType`?
================
Comment at: lib/Sema/SemaDecl.cpp:8186
- const RecordDecl *PD = PT->castAs<RecordType>()->getDecl();
- VisitStack.push_back(PD);
+ // At this point we already handled everything except of a RecordType or
+ // an ArrayType[RecordType].
----------------
Anastasia wrote:
> I am a bit confused about this comment, `do you mean a PointerType to a RecordType or an ArrayType of a RecordType`?
Also is there any test case covering this change?
================
Comment at: lib/Sema/SemaDecl.cpp:8189
+ const RecordType *RecTy =
+ PT->getPointeeOrArrayElementType()->getAs<RecordType>();
+ const RecordDecl *OrigRecDecl = RecTy->getDecl();
----------------
yaxunl wrote:
> Can we have a test for this change? e.g. an array of structs
I am wondering if `PT->getPointeeOrArrayElementType()` is `nullptr`? Do we need to add an extra check?
Repository:
rC Clang
https://reviews.llvm.org/D49725
More information about the cfe-commits
mailing list