[PATCH] D85750: [SyntaxTree] Unbox operators into tokens for nodes generated from `CXXOperatorCallExpr`

Eduardo Caldas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 00:17:56 PDT 2020


eduucaldas added inline comments.


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:1024
+      // representation of built-in and user-defined operators.
+      if (child->getBeginLoc() == S->getOperatorLoc())
+        continue;
----------------
gribozavr2 wrote:
> eduucaldas wrote:
> > Here we want to check if this child is just a DeclRefExpr to an operator - as opposed to an operand.
> > Is comparing SourceLocation generally safe?
> > Is there a better way of figuring out if the child DeclRefExpr refers to an operator?
> Comparing SourceLocations should work, but you're right that it is a questionable pattern.
> 
> Iterating only over `S->arguments()` instead of all children could work here.
Very good tip!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85750



More information about the cfe-commits mailing list