[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-15 Thread Björn Schäpers via cfe-commits
HazardyKnusperkeks wrote: I still think Google should have to say what their style in clang-format is, extending to the default values of `AttributeMacros`. I also wouldn't have such a big issue with adding it to the base style, because of the prefix and I think it's nice that Boost or Qt most

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-14 Thread Jan Voung via cfe-commits
jvoung wrote: Thank you Owen for the review and helping merge, and thank you all for helping arrive at a solution! https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-14 Thread LLVM Continuous Integration via cfe-commits
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `arc-builder` running on `arc-worker` while building `clang` at step 6 "test-build-unified-tree-check-all". Full details are available at: https://lab.llvm.org/buildbot/#/builders/3/builds/13089 Here is the relevant piece of

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-14 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-13 Thread Owen Pan via cfe-commits
https://github.com/owenca updated https://github.com/llvm/llvm-project/pull/130346 >From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001 From: Jan Voung Date: Fri, 7 Mar 2025 21:02:16 + Subject: [PATCH 1/9] [clang-format] Add support for absl nullability macros --- clang

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-13 Thread Owen Pan via cfe-commits
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) { EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen); } +TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) { + auto Tokens = annotate("x = (foo *_Nullable)*v;"); + ASSERT_EQ(Tokens.s

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-13 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-13 Thread Jan Voung via cfe-commits
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) { EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen); } +TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) { + auto Tokens = annotate("x = (foo *_Nullable)*v;"); + ASSERT_EQ(Tokens.s

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-13 Thread Jan Voung via cfe-commits
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) { EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen); } +TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) { + auto Tokens = annotate("x = (foo *_Nullable)*v;"); + ASSERT_EQ(Tokens.s

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-13 Thread Jan Voung via cfe-commits
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) { EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen); } +TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) { + auto Tokens = annotate("x = (foo *_Nullable)*v;"); + ASSERT_EQ(Tokens.s

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-13 Thread Jan Voung via cfe-commits
https://github.com/jvoung updated https://github.com/llvm/llvm-project/pull/130346 >From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001 From: Jan Voung Date: Fri, 7 Mar 2025 21:02:16 + Subject: [PATCH 1/7] [clang-format] Add support for absl nullability macros --- clang

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-13 Thread Jan Voung via cfe-commits
https://github.com/jvoung updated https://github.com/llvm/llvm-project/pull/130346 >From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001 From: Jan Voung Date: Fri, 7 Mar 2025 21:02:16 + Subject: [PATCH 1/8] [clang-format] Add support for absl nullability macros --- clang

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-13 Thread Jan Voung via cfe-commits
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) { EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen); } +TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) { + auto Tokens = annotate("x = (foo *_Nullable)*v;"); + ASSERT_EQ(Tokens.s

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-13 Thread Jan Voung via cfe-commits
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) { EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen); } +TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) { + auto Tokens = annotate("x = (foo *_Nullable)*v;"); + ASSERT_EQ(Tokens.s

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Owen Pan via cfe-commits
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) { EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen); } +TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) { + auto Tokens = annotate("x = (foo *_Nullable)*v;"); + ASSERT_EQ(Tokens.s

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Owen Pan via cfe-commits
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) { EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen); } +TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) { + auto Tokens = annotate("x = (foo *_Nullable)*v;"); + ASSERT_EQ(Tokens.s

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Owen Pan via cfe-commits
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) { EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen); } +TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) { + auto Tokens = annotate("x = (foo *_Nullable)*v;"); + ASSERT_EQ(Tokens.s

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Owen Pan via cfe-commits
@@ -3185,6 +3185,53 @@ TEST_F(TokenAnnotatorTest, UnderstandsAttributes) { EXPECT_TOKEN(Tokens[5], tok::r_paren, TT_AttributeRParen); } +TEST_F(TokenAnnotatorTest, UnderstandsNullabilityAttributes) { + auto Tokens = annotate("x = (foo *_Nullable)*v;"); + ASSERT_EQ(Tokens.s

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Owen Pan via cfe-commits
https://github.com/owenca edited https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Owen Pan via cfe-commits
https://github.com/owenca approved this pull request. Loods good otherwise. https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Jan Voung via cfe-commits
@@ -12720,6 +12735,21 @@ TEST_F(FormatTest, UnderstandsPointerQualifiersInCast) { verifyFormat(("x = (foo *" + AllQualifiers + " __my_qualifier)&v;").str(), CustomQualifier); + // Check additional attribute macros in Google style: + FormatStyle LongPointerR

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Jan Voung via cfe-commits
@@ -12518,6 +12521,10 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) { verifyIndependentOfContext("MACRO(A *_Nonnull a);"); verifyIndependentOfContext("MACRO(A *_Nullable a);"); verifyIndependentOfContext("MACRO(A *_Null_unspecified a);"); + verifyIndependentOfContex

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Jan Voung via cfe-commits
@@ -909,6 +909,12 @@ TEST(ConfigParseTest, ParsesConfiguration) { Style.AttributeMacros.clear(); CHECK_PARSE("BasedOnStyle: LLVM", AttributeMacros, std::vector{"__capability"}); + Style.AttributeMacros.clear(); jvoung wrote: Ok, done! https

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Jan Voung via cfe-commits
https://github.com/jvoung edited https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Jan Voung via cfe-commits
https://github.com/jvoung commented: Thanks for the review! https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-12 Thread Jan Voung via cfe-commits
https://github.com/jvoung updated https://github.com/llvm/llvm-project/pull/130346 >From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001 From: Jan Voung Date: Fri, 7 Mar 2025 21:02:16 + Subject: [PATCH 1/6] [clang-format] Add support for absl nullability macros --- clang

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-11 Thread Owen Pan via cfe-commits
owenca wrote: I wish they had not been added to the default but can't take them off the lists for backward compatibility. I don't think we should add more. The reason is that people wouldn't be able to turn off the special meaning if they wanted to use e.g. `absl_nonnull` as a regular identifi

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-11 Thread Jan Voung via cfe-commits
https://github.com/jvoung updated https://github.com/llvm/llvm-project/pull/130346 >From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001 From: Jan Voung Date: Fri, 7 Mar 2025 21:02:16 + Subject: [PATCH 1/4] [clang-format] Add support for absl nullability macros --- clang

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-11 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: Google C++ Style Guide and Abseil go hand-in-hand from Google's perspective. We are the stewards of both and we would prefer to keep the two in sync. We have opted to have the Google Style available as builtin in `clang-format` and have been sticking to that decision until

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-11 Thread via cfe-commits
mydeveloperday wrote: > The only problem I see is how clang-format parses those lists from yaml. I > think there is no possibility to choose between adding or overwriting, if you > put `AttributeMacros` in your `.clang-format`, but it just overwrites the > values. if they can be overridden!,

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-11 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: >From the Google's perspective, we are happy with any change that makes those >macros available in `-style=google`. It seems that either of the options gives us that, so up to the rest of the folks in the thread. https://github.com/llvm/llvm-project/pull/130346 __

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-11 Thread Owen Pan via cfe-commits
owenca wrote: > > I wish they had not been added to the default but can't take them off the > > lists for backward compatibility. I don't think we should add more. The > > reason is that people wouldn't be able to turn off the special meaning if > > they wanted to use e.g. `absl_nonnull` as a

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-10 Thread Jan Voung via cfe-commits
jvoung wrote: > I wish they had not been added to the default but can't take them off the > lists for backward compatibility. I don't think we should add more. The > reason is that people wouldn't be able to turn off the special meaning if > they wanted to use e.g. `absl_nonnull` as a regular

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-10 Thread Ilya Biryukov via cfe-commits
ilya-biryukov wrote: (please note the update comment above, I did not read the change history and didn't realize the original patch was touching the common default style, not Google's style) https://github.com/llvm/llvm-project/pull/130346 ___ cfe-co

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-10 Thread via cfe-commits
mydeveloperday wrote: Imagine if we did this for every "toolkit"... we'd be inundated with add this/that etc... why can't people who use Abseil not add them to their .clang-format? Outside of google are that many people even using Abseil? Abseil itself doesn't even define them in their .clang

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-09 Thread Jan Voung via cfe-commits
jvoung wrote: It would be nice to to avoid having each project configure via `AttributeMacros`. The Abseil macro is meant to be a portable way to use the Clang-specific nullability attributes like `_Nonnull` (portable in that it will be empty for non-Clang compilers). So one would expect it t

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-07 Thread Owen Pan via cfe-commits
https://github.com/owenca requested changes to this pull request. Why should we add those macros to the default list? Can't you use the [`AttributeMacros`](https://clang.llvm.org/docs/ClangFormatStyleOptions.html#attributemacros) option instead? https://github.com/llvm/llvm-project/pull/13034

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-07 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: Jan Voung (jvoung) Changes Add support for formatting w/ absl nullability macros (https://github.com/abseil/abseil-cpp/blob/c52afac4f87ef76e6293b84874e5126a62be1f15/absl/base/nullability.h#L237). Example at https://godbolt.org/z/PYv

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-07 Thread Jan Voung via cfe-commits
https://github.com/jvoung ready_for_review https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-07 Thread Jan Voung via cfe-commits
https://github.com/jvoung edited https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-07 Thread Jan Voung via cfe-commits
https://github.com/jvoung edited https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-07 Thread Jan Voung via cfe-commits
https://github.com/jvoung edited https://github.com/llvm/llvm-project/pull/130346 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-07 Thread Jan Voung via cfe-commits
https://github.com/jvoung created https://github.com/llvm/llvm-project/pull/130346 None >From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001 From: Jan Voung Date: Fri, 7 Mar 2025 21:02:16 + Subject: [PATCH] [clang-format] Add support for absl nullability macros --- cla

[clang] [clang-format] Add support for absl nullability macros (PR #130346)

2025-03-07 Thread Jan Voung via cfe-commits
https://github.com/jvoung updated https://github.com/llvm/llvm-project/pull/130346 >From 10df1857532a6a27b0e5286e10c9f0724d6d7e1d Mon Sep 17 00:00:00 2001 From: Jan Voung Date: Fri, 7 Mar 2025 21:02:16 + Subject: [PATCH 1/2] [clang-format] Add support for absl nullability macros --- clang