[all-commits] [llvm/llvm-project] 05843d: [clang] Fix the serialization of LambdaExpr and th...

Bruno Ricci via All-commits all-commits at lists.llvm.org
Thu Jun 18 05:37:57 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 05843dc6ab97a00cbde7aa4f08bf3692eb83109d
      https://github.com/llvm/llvm-project/commit/05843dc6ab97a00cbde7aa4f08bf3692eb83109d
  Author: Bruno Ricci <riccibrun at gmail.com>
  Date:   2020-06-18 (Thu, 18 Jun 2020)

  Changed paths:
    M clang/include/clang/AST/ExprCXX.h
    M clang/lib/AST/ExprCXX.cpp
    M clang/lib/AST/StmtPrinter.cpp
    M clang/lib/Serialization/ASTReaderStmt.cpp
    M clang/lib/Serialization/ASTWriterStmt.cpp
    M clang/test/AST/ast-dump-lambda.cpp

  Log Message:
  -----------
  [clang] Fix the serialization of LambdaExpr and the bogus mutation in LambdaExpr::getBody

The body of LambdaExpr is currently not properly serialized. Instead
LambdaExpr::getBody checks if the body has been already deserialized and if
not mutates LambdaExpr. This can be observed with an AST dump test, where
the body of the LambdaExpr will be null.

The mutation in LambdaExpr::getBody was left because of another bug: it is not
true that the body of a LambdaExpr is always a CompoundStmt; it can also be
a CoroutineBodyStmt wrapping a CompoundStmt. This is fixed by returning a
Stmt * from getBody and introducing a convenience function getCompoundStmtBody
which always returns a CompoundStmt *. This function can be used by callers who
do not care about the coroutine node.

Happily all but one user of getBody treat it as a Stmt * and so this change
is non-intrusive.

Differential Revision: https://reviews.llvm.org/D81787

Reviewed By: aaron.ballman


  Commit: c7350a3bab14eb633f39a949f85ac0e690cd9b4d
      https://github.com/llvm/llvm-project/commit/c7350a3bab14eb633f39a949f85ac0e690cd9b4d
  Author: Bruno Ricci <riccibrun at gmail.com>
  Date:   2020-06-18 (Thu, 18 Jun 2020)

  Changed paths:
    M clang/utils/make-ast-dump-check.sh

  Log Message:
  -----------
  [clang][utils] Modify make-ast-dump-check.sh to generate AST serialization dump tests

An AST serialization dump test is a test which compares the output of -ast-dump
on the source and of -ast-dump-all on a PCH generated from the source. Modulo
a few differences the outputs should match.

This patch to make-ast-dump-check.sh enables automatically generating
these tests.

Differential Revision: https://reviews.llvm.org/D81786

Reviewed By: aaron.ballman, lebedev.ri


Compare: https://github.com/llvm/llvm-project/compare/eb4c758fe4b6...c7350a3bab14


More information about the All-commits mailing list