[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
Wed Jul 28 13:19:49 PDT 2021


vsapsai added inline comments.


================
Comment at: clang/lib/Serialization/ASTReaderDecl.cpp:832
+      RD->setCompleteDefinition(false);
+      Reader.mergeDefinitionVisibility(OldDef, RD);
+    } else {
----------------
Here is the perfect place to compare if `RD` and `OldDef` are equivalent and emit diagnostic if they are not. I've tried `StructuralEquivalenceContext` for this purpose but it compares canonical decls which doesn't work in this case. I think the best approach for this task would be ODR hash comparison proposed in https://reviews.llvm.org/D71734 It will need some tweaks to work with the current patch but overall the plan is to use ODR hash instead of any other decl comparison.


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