balazske added a comment.

Example about how to get wrong things into `NonEquivalentDecls`:
We want to compare `class C` for structural equivalence in the following codes:

  class A {}; class B {int i;}; void x(A *); void y(A *); class C { friend void 
x(A *); friend void y(A *); };

and

  class A {}; class B {int i;}; void x(A *); void y(B *); class C { friend void 
x(A *); friend void y(B *); };

The result is false for `C` but the `NonEquivalentDecls` will contain after the 
compare a `void x(A*)`<->`void x(A*)` pair.

The reason is that during the check we encounter first a `A`<->`B` pair 
(iterating over the friends and friend functions, first `y` is encountered and 
a check for `A` and `B` follows). The `B` is recorded as "tentative 
equivalence" to `A`. Then we try to check `A` to `A` (during check of `x`) but 
because there is a "tentative equivalence" with `B` from `A` the check returns 
false (not equivalent). This false result is recorded as a (incorrect) 
non-equivalence of the two `x` functions.
I want to replace the `DeclsToCheck` and `TentativeEquivalences` with a set of 
`Decl` pairs (like the NonEquivalentDecls) so it will be possible to record the 
same **from** Decl with multiple **to** values. (Is there a reason for why 
there is a `NonEquivalentDecls` cache but not a `EquivalentDecls` or simply a 
cache for result values?)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D62131



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to