[PATCH] D36184: [clang-diff] Filter AST nodes

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 9 04:43:54 PDT 2017


arphaman added inline comments.


================
Comment at: lib/Tooling/ASTDiff/ASTDiff.cpp:177
+static bool isDeclExcluded(const Decl *D) { return D->isImplicit(); }
+static bool isStmtExcluded(const Stmt *S) { return false; }
+
----------------
You should just use one call  `isNodeExcluded` that will redirect to node-specific overload, and avoid the multiple clauses in conditions, i.e..:

```
static bool isSpecializedNodeExcluded(const Decl *D) { }
static bool isSpecializedNodeExcluded(const Stmt *S) {}

template <class T>
static bool isNodeExcluded(const SourceManager &SrcMgr, T *N) {
   .... current code ...
   return isSpecializedNodeExcluded(N);
}
```

Then you can use `if (isNodeExcluded(Tree.AST.getSourceManager(), D))` everywhere.


https://reviews.llvm.org/D36184





More information about the cfe-commits mailing list