[clang][ASTImporter] Fix a bug when importing CXXDefaultInitExpr.
authorBalázs Kéri <1.int32@gmail.com>
Mon, 28 Mar 2022 06:57:11 +0000 (08:57 +0200)
committerBalázs Kéri <1.int32@gmail.com>
Mon, 28 Mar 2022 08:55:26 +0000 (10:55 +0200)
commitc5d83cdca457fd024a3f76c5e2ba649462ecde67
treee7f5441f732d9805f26cf4d6f692320b93a59bee
parentfcbf00f098b234c205b1ee22b982e7e575d75f14
[clang][ASTImporter] Fix a bug when importing CXXDefaultInitExpr.

The "in-class initializer" expression should be set in the field of a
default initialization expression before this expression node is created.
The `CXXDefaultInitExpr` objects are created after the AST is loaded and
at import not present in the "To" AST. And the in-class initializers of
the used fields can be missing too, these must be set at import.

This fixes a github issue #54061.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D120824
clang/lib/AST/ASTImporter.cpp
clang/test/Analysis/Inputs/ctu-cxxdefaultinitexpr-import.cpp [new file with mode: 0644]
clang/test/Analysis/Inputs/ctu-cxxdefaultinitexpr-import.cpp.externalDefMap.ast-dump.txt [new file with mode: 0644]
clang/test/Analysis/ctu-cxxdefaultinitexpr.cpp [new file with mode: 0644]
clang/unittests/AST/ASTImporterTest.cpp