This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Disallow overloading destructors.
ClosedPublic

Authored by jlebar on Sep 14 2016, 10:08 AM.

Details

Summary

We'd attempted to allow this, but turns out we were doing a very bad
job. :)

Making this work properly would be a giant change in clang. For
example, we'd need to make CXXRecordDecl::getDestructor()
context-sensitive, because the destructor you end up with depends on
where you're calling it from.

For now (and hopefully for ever), just disallow overloading of
destructors in CUDA.

Diff Detail

Repository
rL LLVM

Event Timeline

jlebar updated this revision to Diff 71379.Sep 14 2016, 10:08 AM
jlebar retitled this revision from to [CUDA] Disallow overloading destructors..
jlebar updated this object.
jlebar added a reviewer: rsmith.
jlebar added subscribers: tra, cfe-commits.
rnk accepted this revision.Oct 3 2016, 9:29 AM
rnk added a reviewer: rnk.
rnk added a subscriber: rnk.

lgtm

clang/lib/Sema/SemaOverload.cpp
1131 ↗(On Diff #71379)

I feel like we should exit early on destructors here, before we do any target checks. The assert also feels kind of trivial because we only come into this overload machinery if looking up New's DeclarationName found Old.

This revision is now accepted and ready to land.Oct 3 2016, 9:29 AM
jlebar added inline comments.Oct 3 2016, 9:56 AM
clang/lib/Sema/SemaOverload.cpp
1131 ↗(On Diff #71379)

Will do when I check this in. Thank you for the review!

This revision was automatically updated to reflect the committed changes.
cfe/trunk/test/CodeGenCUDA/function-overload.cu