From 467ad6a03583ba0566ec4f7c8ca4e2dabc60c8f6 Mon Sep 17 00:00:00 2001 From: Jan Voung Date: Fri, 14 Mar 2025 03:01:35 -0400 Subject: [clang-format] Add support for absl nullability macros (#130346) 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/PYv19M1Gj input: ``` std::vector x; std::vector y; ``` orig output: ``` std::vector x; std::vector y; ``` new output: ``` std::vector x; std::vector y; ``` credit to @ymand for the original patch --- clang/unittests/Format/ConfigParseTest.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/unittests/Format/ConfigParseTest.cpp') diff --git a/clang/unittests/Format/ConfigParseTest.cpp b/clang/unittests/Format/ConfigParseTest.cpp index 273bab8..cc42642 100644 --- a/clang/unittests/Format/ConfigParseTest.cpp +++ b/clang/unittests/Format/ConfigParseTest.cpp @@ -909,6 +909,11 @@ TEST(ConfigParseTest, ParsesConfiguration) { Style.AttributeMacros.clear(); CHECK_PARSE("BasedOnStyle: LLVM", AttributeMacros, std::vector{"__capability"}); + CHECK_PARSE( + "BasedOnStyle: Google", AttributeMacros, + std::vector({"__capability", "absl_nonnull", "absl_nullable", + "absl_nullability_unknown"})); + Style.AttributeMacros.clear(); CHECK_PARSE("AttributeMacros: [attr1, attr2]", AttributeMacros, std::vector({"attr1", "attr2"})); -- cgit v1.1