aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/Format/ConfigParseTest.cpp
diff options
context:
space:
mode:
authorJan Voung <jvoung@google.com>2025-03-14 03:01:35 -0400
committerGitHub <noreply@github.com>2025-03-14 00:01:35 -0700
commit467ad6a03583ba0566ec4f7c8ca4e2dabc60c8f6 (patch)
treeab4abadbedfb0c4b25c87866c4da471853e94c86 /clang/unittests/Format/ConfigParseTest.cpp
parent6b7daf224933d60a7ef8acc399da8388b90bf318 (diff)
downloadllvm-467ad6a03583ba0566ec4f7c8ca4e2dabc60c8f6.zip
llvm-467ad6a03583ba0566ec4f7c8ca4e2dabc60c8f6.tar.gz
llvm-467ad6a03583ba0566ec4f7c8ca4e2dabc60c8f6.tar.bz2
[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<int* _Nonnull> x; std::vector<int* absl_nonnull> y; ``` orig output: ``` std::vector<int* _Nonnull> x; std::vector<int * absl_nonnull> y; ``` new output: ``` std::vector<int* _Nonnull> x; std::vector<int* absl_nonnull> y; ``` credit to @ymand for the original patch
Diffstat (limited to 'clang/unittests/Format/ConfigParseTest.cpp')
-rw-r--r--clang/unittests/Format/ConfigParseTest.cpp5
1 files changed, 5 insertions, 0 deletions
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<std::string>{"__capability"});
+ CHECK_PARSE(
+ "BasedOnStyle: Google", AttributeMacros,
+ std::vector<std::string>({"__capability", "absl_nonnull", "absl_nullable",
+ "absl_nullability_unknown"}));
+ Style.AttributeMacros.clear();
CHECK_PARSE("AttributeMacros: [attr1, attr2]", AttributeMacros,
std::vector<std::string>({"attr1", "attr2"}));