[PATCH] D153798: [clang-format] Correctly annotate operator free function call

Owen Pan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 28 00:48:43 PDT 2023


owenpan added inline comments.


================
Comment at: clang/lib/Format/TokenAnnotator.cpp:319
+           Prev->Previous->isOneOf(tok::period, tok::arrow)) ||
+          (!Line.MustBeDeclaration && !Line.InMacroBody);
       Contexts.back().IsExpression = OperatorCalledAsMemberFunction;
----------------
Why not `Line.InMacroBody`? Wouldn't it misformat the following snippet?
```
#define FOO           \
  void foo() {        \
    operator+(a * b); \
  }
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153798



More information about the cfe-commits mailing list