[PATCH] D106994: [modules] Fix miscompilation when using two RecordDecl definitions with the same name.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 29 15:37:48 PDT 2021


vsapsai added a comment.

>> Are there any known signs for mixing lexical and semantic `DeclContext`? I plan to test the change on our internal codebase, hopefully it'll help to catch any remaining issues.
>
> The kinds of things I saw go wrong when we were bringing this up on the C++ side were generally in code that would walk the list of (say) fields of a record building up some information, and then attempt to look up a given `FieldDecl*` in that data structure. That can fail if fields get merged, because the lookup key may be a different redeclaration of the same field than the one found by walking the class's members.  The fix is usually to add `getCanonicalDecl` calls in the right places. The sign of this kind of bug happening was usually a crash or assert, usually pretty close to where the problem was.

Thanks, that's helpful.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106994



More information about the cfe-commits mailing list