[PATCH] D82954: Fix crash on overloaded postfix unary operators due to invalid sloc

Eduardo Caldas via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 3 02:07:44 PDT 2020


eduucaldas added inline comments.


================
Comment at: clang/lib/Tooling/Syntax/BuildTree.cpp:118
 
+syntax::NodeKind getOperatorNodeKind(const CXXOperatorCallExpr &E) {
+  switch (E.getOperator()) {
----------------
# Where to put this logic? 
The pro of having this function inside `BuildTree.cpp` is that it is closer to it's *only* usage. And also for now `BuildTree.cpp` agglomerates everything that takes a semantic AST as an input, so it would be coherent.

Another option is to put it in `Nodes`, as it might serve as documentation for `*OperatorExpression`s. 
For example, it would document that the semantic node `CXXOperatorCallExpr` can also generate the syntax node `BinaryOperatorExpression`, which was previously only generated by a semantic `BinaryOperator`

Another option is to add put this function as a lambda inside `WalkUpFromCXXOperatorCallExpr` as probably it will only be used there. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82954





More information about the cfe-commits mailing list