[PATCH] D156201: [ASTImporter] Fix two cases on fields circular refs

Ding Fei via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 24 21:04:34 PDT 2023


danix800 created this revision.
danix800 added a project: clang.
Herald added a subscriber: martong.
Herald added a reviewer: a.sidorin.
Herald added a reviewer: shafik.
Herald added a project: All.
danix800 requested review of this revision.
Herald added a subscriber: cfe-commits.

Fixes two cases on fields circular refs:

1. Field in-class initializer is deferred until all fields are imported. No reordering for fields is needed. For final lexical order, see https://reviews.llvm.org/D156093
2. UnaryOperator(&)'s creation might need layout of some records whose fields importation are still on fly, the layout is incorrectly computed and cached. Clients relying on this will not work properly or crash direclty (e.g StaticAnalyzer's MemRegion.cpp (calculateOffset)). Use UnaryOperator::CreateEmpty() instead of UnaryOperator::Create() to avoid this computation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156201

Files:
  clang/lib/AST/ASTImporter.cpp
  clang/unittests/AST/ASTImporterTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156201.543805.patch
Type: text/x-patch
Size: 9337 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230725/ee9c0a93/attachment-0001.bin>


More information about the cfe-commits mailing list