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

Bruno Ricci via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 17 02:40:11 PDT 2020


riccibruno marked 4 inline comments as done.
riccibruno added inline comments.


================
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 {
----------------
aaron.ballman wrote:
> 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.
I agree, these const-incorrect methods are a bad habit. The overloads even were in a previous version of this patch so I am not sure why I did not include them here. I will definitely include them in the commit.


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