[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-12 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/76804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-12 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/76804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-12 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: @owenca, @HazardyKnusperkeks could you please take another look and approve if this looks good to you? I believe all comments should be addressed at this point. https://github.com/llvm/llvm-project/pull/76804 ___ cfe-commits

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-12 Thread Ilya Biryukov via cfe-commits
@@ -1698,8 +1698,6 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { /*BasedOnStyle=*/"google", }, }; - GoogleStyle.AttributeMacros.push_back("GUARDED_BY"); ilya-biryukov wrote: I think we should postpone the inclusion of

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-12 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov updated https://github.com/llvm/llvm-project/pull/76804 >From d8598a382fb1496a96d6ff8317c06cf73606ad84 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Wed, 3 Jan 2024 11:07:17 +0100 Subject: [PATCH 1/4] [Format] Fix isStartOfName to recognize attributes

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-12 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov updated https://github.com/llvm/llvm-project/pull/76804 >From d8598a382fb1496a96d6ff8317c06cf73606ad84 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Wed, 3 Jan 2024 11:07:17 +0100 Subject: [PATCH 1/3] [Format] Fix isStartOfName to recognize attributes

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-09 Thread Björn Schäpers via cfe-commits
@@ -1698,8 +1698,6 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { /*BasedOnStyle=*/"google", }, }; - GoogleStyle.AttributeMacros.push_back("GUARDED_BY"); HazardyKnusperkeks wrote: I'm open in all directions. When

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-08 Thread Owen Pan via cfe-commits
@@ -8498,9 +8498,6 @@ TEST_F(FormatTest, BreaksFunctionDeclarationsWithTrailingTokens) { "__attribute__((unused));"); Style = getGoogleStyle(); - ASSERT_THAT(Style.AttributeMacros, owenca wrote: Please also delete line 10: ``` #include

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-08 Thread Owen Pan via cfe-commits
@@ -2209,7 +2209,8 @@ class AnnotatingParser { (!NextNonComment && !Line.InMacroBody) || (NextNonComment && (NextNonComment->isPointerOrReference() || - NextNonComment->isOneOf(tok::identifier, tok::string_literal { +

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-08 Thread Owen Pan via cfe-commits
owenca wrote: > > can you also add a test to clang/unittests/Format/TokenAnnotatorTest.cpp > > that ensures trailing attribute-like macros receive `StartOfName` > > annotation to make sure we don't regress the signal in the future? > > ok, that opened a whole can of worms. > > ``` > Tokens

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-08 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/76804 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-08 Thread kadir çetinkaya via cfe-commits
@@ -1698,8 +1698,6 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { /*BasedOnStyle=*/"google", }, }; - GoogleStyle.AttributeMacros.push_back("GUARDED_BY"); kadircet wrote: FWIW, not recognizing `foo` in `int foo BAR` as

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-08 Thread Ilya Biryukov via cfe-commits
@@ -1698,8 +1698,6 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { /*BasedOnStyle=*/"google", }, }; - GoogleStyle.AttributeMacros.push_back("GUARDED_BY"); ilya-biryukov wrote: @HazardyKnusperkeks friendly ping. Any

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-04 Thread Ilya Biryukov via cfe-commits
@@ -1698,8 +1698,6 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { /*BasedOnStyle=*/"google", }, }; - GoogleStyle.AttributeMacros.push_back("GUARDED_BY"); ilya-biryukov wrote: They are attribute macros indeed, the

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-04 Thread Ilya Biryukov via cfe-commits
@@ -10093,11 +10090,11 @@ TEST_F(FormatTest, ReturnTypeBreakingStyle) { getGoogleStyleWithColumns(40)); verifyFormat("Tttt ppp\n" "ABSL_GUARDED_BY(mutex1)\n" - "ABSL_GUARDED_BY(mutex2);", +

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-03 Thread Björn Schäpers via cfe-commits
@@ -10093,11 +10090,11 @@ TEST_F(FormatTest, ReturnTypeBreakingStyle) { getGoogleStyleWithColumns(40)); verifyFormat("Tttt ppp\n" "ABSL_GUARDED_BY(mutex1)\n" - "ABSL_GUARDED_BY(mutex2);", +

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-03 Thread Björn Schäpers via cfe-commits
@@ -1698,8 +1698,6 @@ FormatStyle getGoogleStyle(FormatStyle::LanguageKind Language) { /*BasedOnStyle=*/"google", }, }; - GoogleStyle.AttributeMacros.push_back("GUARDED_BY"); HazardyKnusperkeks wrote: Even if that would not be needed

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-03 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: > can you also add a test to clang/unittests/Format/TokenAnnotatorTest.cpp that > ensures trailing attribute-like macros receive `StartOfName` annotation to > make sure we don't regress the signal in the future? ok, that opened a whole can of worms. ``` Tokens =

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-03 Thread kadir çetinkaya via cfe-commits
https://github.com/kadircet approved this pull request. can you also add a test to clang/unittests/Format/TokenAnnotatorTest.cpp that ensures trailing attribute-like macros receive `StartOfName` annotation to make sure we don't regress the signal in the future?

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-03 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov updated https://github.com/llvm/llvm-project/pull/76804 >From d8598a382fb1496a96d6ff8317c06cf73606ad84 Mon Sep 17 00:00:00 2001 From: Ilya Biryukov Date: Wed, 3 Jan 2024 11:07:17 +0100 Subject: [PATCH 1/2] [Format] Fix isStartOfName to recognize attributes

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-03 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: Ilya Biryukov (ilya-biryukov) Changes This addresses a problem with formatting attributes. Some context: - 199fc973ced20016b04ba540cf63a1d4914fa513 changed `isStartOfName` to fix problems inside macro directives (judging by the

[clang] [Format] Fix isStartOfName to recognize attributes (PR #76804)

2024-01-03 Thread Ilya Biryukov via cfe-commits
https://github.com/ilya-biryukov created https://github.com/llvm/llvm-project/pull/76804 This addresses a problem with formatting attributes. Some context: - 199fc973ced20016b04ba540cf63a1d4914fa513 changed `isStartOfName` to fix problems inside macro directives (judging by the added tests),