[PATCH] D66538: [AST] AST structural equivalence to work internally with pairs.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 23 03:29:00 PDT 2019


balazske added a comment.

The structural equivalency check works (with this patch) the following way: To check a `(A1,A2)` pair we collect further `(X1,X2)` pairs that should be checked and put these in `DeclsToCheck` (if not already there). The check succeeds if every pair is equivalent. The pairs `(A1,X2)` and `(A1,Y2)` are checked independently. A `true` return value from any of the `IsStructurallyEquivalent` functions means that we did not found non-equivalence in the internal node data but the pairs in `DeclsToCheck` should be checked too. Return value of `false` means a non-equivalence in the internal data only is found with the `(X1,X2)` pair that is currently checked, therefore we found non-equivalence for the original pair and for `(X1,X2)` too. Again, with the new code the test `CheckCommonEquivalence(D1, D2) && CheckKindSpecificEquivalence(D1, D2)` fails only if we found difference in the internal node data and we can be sure that `D1` and `D2` are non-equivalent. The old code does not have this property.

With the old code (that uses `TentativeEquivalences`) return value `false` for `IsStructurallyEquivalent` for `(X1,X2)` pair to check can mean that we found a `(X1,Y2)` to check and `X2!=Y2` (decl chain different). But we can not say that `(X1,X2)` are non-equivalent because it may be that `(X1,Y2)` are non-equivalent and `(X1,X2)` are equivalent. (But it is sure that the original pair `(A1,A2)` is non-equivalent.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66538





More information about the cfe-commits mailing list