[PATCH] D46651: [OpenCL] Support new/delete in Sema
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 9 19:28:13 PDT 2018
rjmccall added inline comments.
================
Comment at: lib/Sema/SemaDeclCXX.cpp:13010
+ if (SemaRef.getLangOpts().OpenCLCPlusPlus) {
+ if (auto *PtrTy = ResultType.getTypePtr()->getAs<PointerType>()) {
+ ResultType = RemoveAddressSpaceFromPtr(SemaRef, PtrTy);
----------------
`getTypePtr()` is done automatically by `operator->` on `QualType`. This can be fixed in multiple places in this patch.
================
Comment at: lib/Sema/SemaExprCXX.cpp:2030
+ }
+ }
----------------
Anastasia wrote:
> svenvh wrote:
> > rjmccall wrote:
> > > I think a better interpretation of this rule would be to just error on attempts to use the standard non-placement operator new/delete instead of trying to outlaw the operator declarations. For example, I don't know why a user-defined non-global operator new would be problematic.
> > Good point, I have raised this with Khronos, so I will hold this off until we have clarification.
> The decision by Khronos is to allow all user defined new/delete operators (even global). I have submitted the change to the spec. The next publishing date is however in July.
Okay. I agree with your decision in this patch to treat this as a defect in the spec and thus to go ahead and do the right thing now.
https://reviews.llvm.org/D46651
More information about the cfe-commits
mailing list