Nuullll marked an inline comment as done.
Nuullll added inline comments.
================
Comment at: clang/lib/Format/TokenAnnotator.cpp:243
+ bool OperatorCalledAsMemberFunction =
+ Prev->Previous && Prev->Previous->isOneOf(tok::period, tok::arrow);
+ Contexts.back().IsExpression = OperatorCalledAsMemberFunction;
----------------
MyDeveloperDay wrote:
> feels like we are not testing this situation, please add those tests
I added some in `FormatTest.UnderstandsOverloadedOperators`
================
Comment at: clang/unittests/Format/FormatTest.cpp:8283-8286
+ // TODO:
+ // Calling an operator as a non-member function is hard to distinguish
+ // verifyFormat("void f() { operator*(a & a); }");
+ // verifyFormat("void f() { operator&(a, b * b); }");
----------------
This patch doesn't fix these, i.e. when operators are called as non-member
functions.
The call sites seem to be marked as function declarations.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103678/new/
https://reviews.llvm.org/D103678
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits