Instead of emitting a redefinition error, check that definitions are
equivalent and allow such scenario.
A few non-obvious implementation details:
- to avoid multiple definitions in the redeclaration chain we just drop the new definition after checking for equivalence;
- for checking definition equivalence use ODR hash instead of ASTStructuralEquivalence because it avoids excessive recursive deserialization. Though after detecting a mismatch we do deserialize multiple entities to provide a better error message.
rdar://82908223
I'd like to get feedback on Parser/Sema layering. I'll check myself what can be done but at the first glance accessing pieces of Sema from Parser looks questionable.