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

Dmitri Gribenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 11 10:18:46 PDT 2020


gribozavr2 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;
----------------
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.


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