This is an archive of the discontinued LLVM Phabricator instance.

[clang] Add support for consteval constructors
ClosedPublic

Authored by Tyker on Feb 4 2020, 4:08 PM.

Details

Summary

Changes:

  • handle immediate invocations for constructors.
  • add tests

after this patch i believe the implementation of consteval is standard compliant, but IR-gen still needs to be taught not to emit consteval declarations.

Diff Detail

Event Timeline

Tyker created this revision.Feb 4 2020, 4:08 PM
rsmith added inline comments.Feb 4 2020, 6:36 PM
clang/lib/Sema/SemaExpr.cpp
15406

* on the right, please.

15500–15527

It's unfortunate that TreeTransform has this quirk. :( I think we can maybe deal with this without duplicating the rebuilding code from TreeTransform, though: perhaps you could add a flag to TreeTransform::TransformCXXConstructExpr to enable / disable skipping implicit conversions (with a default argument), and call Transformer.TransformCXXConstructExpr(..., false) instead of Transformer.TransformExpr(...) when the expression is a CXXConstructExpr?

15501

situtation -> situation
Remove final "is"

15503

rebuild -> rebuilt

Tyker updated this revision to Diff 242881.Feb 6 2020, 5:51 AM
Tyker marked 5 inline comments as done.

fixed comments.

clang/lib/Sema/SemaExpr.cpp
15500–15527

I didn't change the prototype of TreeTransform::TransformCXXConstructExpr because i rather keep the prototypes of all TreeTransform::Transform* the same. but i added a option to TreeTransform to remove the code duplication.

rsmith accepted this revision.Mar 19 2020, 10:25 AM
rsmith added inline comments.
clang/lib/Sema/TreeTransform.h
160

Typo "Wether" -> "Whether"

162

"usefull" -> "useful", "cause" -> "causes"

This revision is now accepted and ready to land.Mar 19 2020, 10:25 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 20 2020, 3:46 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript