[PATCH] D81787: [clang] Fix the serialization of LambdaExpr and the bogus mutation in LambdaExpr::getBody

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 15 05:24:30 PDT 2020


aaron.ballman accepted this revision.
aaron.ballman added a comment.
This revision is now accepted and ready to land.

LGTM with some nits.



================
Comment at: clang/include/clang/AST/ExprCXX.h:2012-2017
+  Stmt *getBody() const { return getStoredStmts()[capture_size()]; }
+
+  /// Retrieve the \p CompoundStmt representing the body of the lambda.
+  /// This is a convenience function for callers who do not need
+  /// to handle node(s) which may wrap a \p CompoundStmt.
+  CompoundStmt *getCompoundStmtBody() const {
----------------
I wish we'd get the const correctness right when doing this (`const` methods returning pointers to `const` objects, not mixing constness like this). I don't insist, but if you put in overloads, I wouldn't be sad either.


================
Comment at: clang/test/AST/ast-dump-lambda.cpp:11
 
-// XFAIL: *
+
 
----------------
Can remove some newlines here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81787





More information about the cfe-commits mailing list