[PATCH] D156370: [clang-format] Fix bug with parsing of function/variable names.

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 27 13:25:06 PDT 2023


HazardyKnusperkeks added a comment.

In D156370#4537033 <https://reviews.llvm.org/D156370#4537033>, @gedare wrote:

> In D156370#4536793 <https://reviews.llvm.org/D156370#4536793>, @HazardyKnusperkeks wrote:
>
>> Does this result in a different annotation? Could you add a test for that?
>
> If I understand you correctly, it does, for example:
> `$ echo "void __attribute__((naked)) foo(int bar);" | clang-format -style=llvm -debug 2>&1 | grep \'foo\'`
>
> Without the change:
>  M=0 C=1 T=Unknown S=1 F=0 B=0 BK=0 P=23 Name=identifier L=31 PPK=2 FakeLParens= FakeRParens=0 II=0x555d17efdce0 Text='foo'
>
> With the change:
>  M=0 C=1 T=FunctionDeclarationName S=1 F=0 B=0 BK=0 P=80 Name=identifier L=31 PPK=2 FakeLParens= FakeRParens=0 II=0x559855502ce0 Text='foo'
>
> I don't how to test for that.

Yes that stuff. Tests are in: https://github.com/llvm/llvm-project/blob/main/clang/unittests/Format/TokenAnnotatorTest.cpp
If there is none that matches, just create a new one.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D156370



More information about the cfe-commits mailing list