[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-04-15 Thread Tamas Petz via Phabricator via cfe-commits
tamas.petz abandoned this revision. tamas.petz added a comment. In D75364#1966818 , @MyDeveloperDay wrote: > In D75364#1966743 , @tamas.petz > wrote: > > > Wow, I have missed that configuration option. > > I will

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-04-07 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment. In D75364#1966743 , @tamas.petz wrote: > Wow, I have missed that configuration option. > I will try it, I assume it should work. > > Looks like this change should be abandoned. To be honest, I forget what we've got too! ;

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-04-07 Thread Tamas Petz via Phabricator via cfe-commits
tamas.petz added a comment. Wow, I have missed that configuration option. I will try it, I assume it should work. Looks like this change should be abandoned. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75364/new/ https://reviews.llvm.org/D75364

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-04-07 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added a comment. Did you try putting 'ElfW and 'M' in the list of TypenameMacros? --- Language: Cpp BasedOnStyle: LLVM TypenameMacros: ['ElfW'] PointerAlignment: Left const ElfW(Addr)* foo(ElfW(Addr)* addr); const M(Addr) * foo(M(Addr) * addr); $ clang-format

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-04-07 Thread Tamas Petz via Phabricator via cfe-commits
tamas.petz marked 2 inline comments as done. tamas.petz added a comment. @all, thank you for the review so far. The case I am trying to handle is way too ambiguous. IMHO looking at tokens only is not going to lead to a "perfect" formatter. The case I am trying to handle is quite common but it can

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-04-06 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added a comment. A sample of snippets that this misformats: - inside other macro: EXPECT_EQ(Calc()* bar, baz); - in member function call: BENCHMARK(BM_Foo)->ThreadRange(1, NumCPUs()* 2); - this causes javascript diffs: - const foo = (bar == 'rtl' ? -1 : 1) * (blah || blah || 0

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-04-06 Thread Krasimir Georgiev via Phabricator via cfe-commits
krasimir added a comment. I think situations where we infer M(x) to expand to a "type" without const/volatile close-by are too ambiguous an we will have the opposite problem: formatting certain binary expressions as type pointer/references. Some sort of a list of macros that clang-format assume

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-04-04 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:313 +// for example: +// void f(volatile ElfW(Addr)* addr = nullptr); +if (HasStarToken) { I assume it could be almost anything? void f(volatile ElfW(

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-04-03 Thread Mitchell via Phabricator via cfe-commits
mitchell-stellar added inline comments. Comment at: clang/unittests/Format/FormatTest.cpp:7359 verifyIndependentOfContext("bool a = f() && final.f();"); + verifyFormat("int f(M(x) *p1 = nullptr, M(x) *p2, volatile M(x) *p3);"); + verifyFormat("M(x) *foo();"); ---

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-04-03 Thread MyDeveloperDay via Phabricator via cfe-commits
MyDeveloperDay added inline comments. Comment at: clang/lib/Format/TokenAnnotator.cpp:164 + /// Parses CPP qualified function names. + bool parse_function_qname(FormatToken *Tok) const { +while (Tok && Tok->isOneOf(tok::coloncolon, tok::identifier)) { your

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-03-30 Thread Tamas Petz via Phabricator via cfe-commits
tamas.petz added a comment. Friendly ping. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75364/new/ https://reviews.llvm.org/D75364 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-03-02 Thread Tamas Petz via Phabricator via cfe-commits
tamas.petz updated this revision to Diff 247561. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D75364/new/ https://reviews.llvm.org/D75364 Files: clang/lib/Format/TokenAnnotator.cpp clang/unittests/Format/FormatTest.cpp Index: clang/unittests/Format/FormatTest.cpp ===

[PATCH] D75364: [clang-format] Handle macros in function params and return value

2020-02-28 Thread Tamas Petz via Phabricator via cfe-commits
tamas.petz created this revision. tamas.petz added reviewers: chandlerc, djasper. tamas.petz added a project: clang-format. Herald added a project: clang. Herald added a subscriber: cfe-commits. This patch adds support to handle macros in function parameter list and function return type. Consider