[PATCH] D64569: [OpenCL] Improve destructor support in C++ for OpenCL

Marco Antognini via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 09:39:38 PDT 2019


mantognini reopened this revision.
mantognini added a subscriber: ilya-biryukov.
mantognini added a comment.
This revision is now accepted and ready to land.

While investigating PR42665, I've noticed that `getImplicitObjectArgument` doesn't always return a pointer type. For example, when dealing with `shared_ptr`. In libc++'s test std/utilities/memory/util.smartptr/util.smartptr.shared/util.smartptr.shared.create/make_shared.pass.cpp, dumping `CE` in `EmitVirtualDestructorCall` shows that the callee is `.~Bar` (mind the `.`):

  CXXMemberCallExpr 0x29d10a0 'void'
  `-MemberExpr 0x29d1070 '<bound member function type>' .~Bar 0x23f5250
    `-CXXMemberCallExpr 0x29d1040 'struct Bar':'struct Bar' lvalue
      `-MemberExpr 0x29d1010 '<bound member function type>' .second 0x2883328
        `-MemberExpr 0x29d0f80 '__compressed_pair<class std::__1::allocator<struct Bar>, struct Bar>':'class std::__1::__compressed_pair<class std::__1::allocator<struct Bar>, struct Bar>' lvalue ->__data_ 0x2896960
          `-CXXThisExpr 0x29d0f70 'class std::__1::__shared_ptr_emplace<struct Bar, class std::__1::allocator<struct Bar> > *' implicit this

However, for CodeGenCXX/virtual-pseudo-destructor-call.cpp in clang test suite, `CE` is this (mind the `->` this time):

  CXXMemberCallExpr 0x7787a8 'void'
  `-MemberExpr 0x778750 '<bound member function type>' ->~A 0x778288
    `-ImplicitCastExpr 0x778738 'struct A *' <LValueToRValue>
      `-DeclRefExpr 0x778708 'struct A *' lvalue ParmVar 0x778558 'a' 'struct A *'

Tomorrow, I'll try to reduce libc++ failing tests and add it to Clang's suite as part of this review. For now, I've run `check-all` and it seems that no test are failing anymore (with the patch I'm about to upload).

However, I'm not sure whether `getImplicitObjectArgument` is expected to have either pointer or non-pointer type. I guess it is, but, John, Ilya, could either of you confirm this?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D64569





More information about the llvm-commits mailing list