[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-24 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D67509#1679524 , @tra wrote: > In D67509#1678394 , @yaxunl wrote: > > > A reduced test case is > > > > struct A { > > A(); > > }; > > > > template > > struct B > > { > >

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-23 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. In D67509#1678394 , @yaxunl wrote: > A reduced test case is > > struct A { > A(); > }; > > template > struct B > { > T a; > constexpr B() = default; > }; > > B x; > > > > `B::B()` got implicit `__host__

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-22 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D67509#1677722 , @yaxunl wrote: > In D67509#1677586 , @yaxunl wrote: > > > In D67509#1677528 , @tra wrote: > > > > > Looks like CUDA test-suite is

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-20 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D67509#1677586 , @yaxunl wrote: > In D67509#1677528 , @tra wrote: > > > Looks like CUDA test-suite is triggering the assertion added by this patch: > > > > http://lab.llvm.org:8011/builder

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-20 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl added a comment. In D67509#1677528 , @tra wrote: > Looks like CUDA test-suite is triggering the assertion added by this patch: > > http://lab.llvm.org:8011/builders/clang-cuda-build/builds/37301/steps/ninja%20build%20simple%20CUDA%20tests/logs/stdio

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-20 Thread Artem Belevich via Phabricator via cfe-commits
tra added a comment. Looks like CUDA test-suite is triggering the assertion added by this patch: http://lab.llvm.org:8011/builders/clang-cuda-build/builds/37301/steps/ninja%20build%20simple%20CUDA%20tests/logs/stdio Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-20 Thread Yaxun Liu via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL372394: [CUDA][HIP] Fix hostness of defaulted constructor (authored by yaxunl, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits. Changed prior to commit: https://rev

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-19 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision. tra added a comment. LGTM. Thank you! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67509/new/ https://reviews.llvm.org/D67509 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bi

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 220912. yaxunl added a comment. revise by Artem's comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67509/new/ https://reviews.llvm.org/D67509 Files: lib/Sema/SemaCUDA.cpp test/SemaCUDA/default-ctor.cu Index: test/SemaCUDA/default-ctor.cu

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-19 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments. Comment at: lib/Sema/SemaCUDA.cpp:386-387 + bool NeedsH = true, NeedsD = true; + bool HasH = MemberDecl->hasAttr(); + bool HasD = MemberDecl->hasAttr(); + Nice. Now these can be moved above `HasExpAttr` and then used in its initializ

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 220907. yaxunl added a comment. simplify logic by Artem's comments. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67509/new/ https://reviews.llvm.org/D67509 Files: lib/Sema/SemaCUDA.cpp test/SemaCUDA/default-ctor.cu Index: test/SemaCUDA/default

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-19 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments. Comment at: lib/Sema/SemaCUDA.cpp:387 + // each inference gets same result and not to add duplicate attributes. + auto addBothAttr = [=]() { +assert(MemberDecl->hasAttr() == `addHDAttrIfNeeded` ? We may not even need it. See below

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 220892. yaxunl edited the summary of this revision. yaxunl added a comment. Skip inferring for explicit host/device attrs only. Adds checks for implicit device and host attrs and avoid duplicates. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D67509/n

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-19 Thread Artem Belevich via Phabricator via cfe-commits
tra accepted this revision. tra added inline comments. This revision is now accepted and ready to land. Comment at: lib/Sema/SemaCUDA.cpp:273-274 + MemberDecl->hasAttr(); + if (!InClass || hasAttr) +return false; + yaxunl wrote: > tra wrote:

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl marked an inline comment as done. yaxunl added inline comments. Comment at: lib/Sema/SemaCUDA.cpp:273-274 + MemberDecl->hasAttr(); + if (!InClass || hasAttr) +return false; + tra wrote: > A comment here would be helpful. > > I think t

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-19 Thread Artem Belevich via Phabricator via cfe-commits
tra added inline comments. Comment at: lib/Sema/SemaCUDA.cpp:273-274 + MemberDecl->hasAttr(); + if (!InClass || hasAttr) +return false; + A comment here would be helpful. I think the intent here is to look for implicit special members with

[PATCH] D67509: [CUDA][HIP] Fix hostness of defaulted constructor

2019-09-19 Thread Yaxun Liu via Phabricator via cfe-commits
yaxunl updated this revision to Diff 220838. yaxunl retitled this revision from "[CUDA][HIP] Diagnose defaulted constructor only if it is used" to "[CUDA][HIP] Fix hostness of defaulted constructor". yaxunl edited the summary of this revision. yaxunl added a comment. Posts a new fix for this issu