[clang] [clang] fix lack comparison of declRefExpr in ASTStructuralEquivalence (PR #66041)

via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 13 19:56:46 PDT 2023


================
@@ -214,6 +214,16 @@ class StmtComparer {
     return E1->size() == E2->size();
   }
 
+  bool IsStmtEquivalent(const DeclRefExpr *DRE1, const DeclRefExpr *DRE2) {
+    auto *Decl1 = DRE1->getDecl();
+    auto *Decl2 = DRE2->getDecl();
----------------
mzyKi wrote:

```cpp
/// Determine structural equivalence of two declarations.
static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
                                     Decl *D1, Decl *D2) {
  // FIXME: Check for known structural equivalences via a callback of some sort.

  D1 = D1->getCanonicalDecl();
  D2 = D2->getCanonicalDecl();
  std::pair<Decl *, Decl *> P{D1, D2};
```
```IsStructurallyEquivalent``` only accept pointer without const qualifier.

https://github.com/llvm/llvm-project/pull/66041


More information about the cfe-commits mailing list