[PATCH] D37004: [clang-diff] Fix the html output for CXXOperatorCallExpr

Alex Lorenz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 25 08:41:26 PDT 2017


arphaman added inline comments.


================
Comment at: tools/clang-diff/ClangDiff.cpp:319
+           "A Binary operator is supposed to have two arguments.");
+    for (int I : {1, 0, 2})
+      Offset = printHtmlForNode(OS, Diff, Tree, IsLeft, Children[I], Offset);
----------------
johannes wrote:
> arphaman wrote:
> > Please add a short comment that describes why this out-of-order traversal is required
> Should we do this in LexicallyOrderedRecursiveASTVisitor?
> 
> There are some other cases with CXXOperatorCallExpr where the order needs to be changed, e.g. postfix operators, operator->, operator() and operator[].
> It can be done by sorting by SourceLocation of the first two elements, as the operator is always the first one.
Sure, that would make sense. You probably don't need to sort, just figure out the right order from the specific combination of operator and infix/postfix.


https://reviews.llvm.org/D37004





More information about the cfe-commits mailing list