[PATCH] D45680: [C++2a] Add operator<=> Rewriting - Early Attempt

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 6 04:32:44 PDT 2018


EricWF updated this revision to Diff 145398.
EricWF added a comment.

Generalize `CXXRewrittenExpr` to contain only a "representation" of the original expression, and the fully checked rewritten expression. By "representation" i mean to imply that we can't actually build and check a full representation for the expression as written, because it need not be valid. For example:

  struct T { auto operator<=>(T const&) const = default; };
  T{} < T{};

Currently this patch builds a `BinaryOperator` node to represent the expression as written, regardless of whether the original expression would actually select a builtin comparison operator. A consequence of this pseudo-representation is that we can't effectively transform it in `TreeTransform.h` (currently we only transform the rewritten expression and not the representation of the original; there are some kinks I need to work out there).


https://reviews.llvm.org/D45680

Files:
  include/clang/AST/ExprCXX.h
  include/clang/AST/RecursiveASTVisitor.h
  include/clang/Basic/StmtNodes.td
  include/clang/Sema/Overload.h
  include/clang/Sema/Sema.h
  include/clang/Serialization/ASTBitCodes.h
  lib/AST/Expr.cpp
  lib/AST/ExprClassification.cpp
  lib/AST/ExprConstant.cpp
  lib/AST/ItaniumMangle.cpp
  lib/AST/StmtPrinter.cpp
  lib/AST/StmtProfile.cpp
  lib/CodeGen/CGExprScalar.cpp
  lib/Sema/SemaExceptionSpec.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaOverload.cpp
  lib/Sema/TreeTransform.h
  lib/Serialization/ASTReaderStmt.cpp
  lib/Serialization/ASTWriterStmt.cpp
  lib/StaticAnalyzer/Core/ExprEngine.cpp
  test/CodeGenCXX/cxx2a-compare.cpp
  test/SemaCXX/compare-cxx2a.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45680.145398.patch
Type: text/x-patch
Size: 66890 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180506/40653286/attachment-0001.bin>


More information about the cfe-commits mailing list