[PATCH] D34329: [GSoC] Clang AST diffing

Johannes Altmanninger via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 21 09:35:51 PDT 2017


johannes added inline comments.


================
Comment at: lib/Tooling/ASTDiff/ASTDiff.cpp:157
+  int Leaves = 0;
+  std::function<void(NodeId)> Traverse = [&](NodeId Id) {
+    const Node &N = getNode(Id);
----------------
arphaman wrote:
> you should be able to use `auto` instead of `std::function` here I think.
It does not work because the function is recursive. I'm not sure whether it is good practise to do it like this.


================
Comment at: lib/Tooling/ASTDiff/ASTDiff.cpp:209
+    if (X->hasQualifier() && X->getQualifier()->getAsIdentifier())
+      Value += std::string(X->getQualifier()->getAsIdentifier()->getName());
+    Value += X->getDecl()->getNameAsString();
----------------
arphaman wrote:
> Qualifiers (i.e. `NestedNameSpecifier`s) can contain multiple identifiers (e.g. `foo::bar::`). You should use the `print` method from `NestedNameSpecifier` instead.
Ok nice, this works properly!
This function needs a lot of work. I try to extract relevant information from base classes first.


https://reviews.llvm.org/D34329





More information about the cfe-commits mailing list