[PATCH] D156461: [clang][ASTImporter] Merge implicit ctors with definition

Ding Fei via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 16 23:04:19 PDT 2023


danix800 added a comment.

In D156461#4583806 <https://reviews.llvm.org/D156461#4583806>, @balazske wrote:

> It looks not good to remove an invalid node from the DeclContext that otherwise remains in the AST. I checked the problem and found that the existing move constructor (originally in the To AST which had no definition) gets a `getNumCtorInitializers` value of 1 but the `init_begin` returns 0. This causes crash even when dumping it. I did not find the cause of this situation (the first time at line 3822 it is already changed, and `ASTImporter` has this single position to change the value). Normally what should happen is that a new move constructor is imported (with a definition) and linked after the existing one (and the existing is not modified). We get an AST that does not occur after a normal compile, I do not know if this causes problems or if this is the real reason for this patch. What should be done is find the existing constructor and update it with the definition and return it from the import. This can be done with any type of constructor.

The root cause might be that `FunctionDeclBitfields.NumFunctionDeclBits` is not in syncing with updated `FunctionDeclBitfields.DeductionCandidateKind`. See D158145 <https://reviews.llvm.org/D158145>.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156461



More information about the cfe-commits mailing list