[clang] [Format] Configure ASSIGN_OR_RETURN macros for Google style (PR #200210)
Jesse Rosenstock via cfe-commits
cfe-commits at lists.llvm.org
Sat Jun 6 13:14:27 PDT 2026
================
@@ -1099,14 +1099,27 @@ TEST(ConfigParseTest, ParsesConfiguration) {
StatementAttributeLikeMacros,
std::vector<std::string>({"emit", "Q_EMIT"}));
+ Style.Macros.clear();
+ CHECK_PARSE("{Macros: [foo]}", Macros, std::vector<std::string>({"foo"}));
+ std::vector<std::string> GoogleMacros;
+ GoogleMacros.push_back("ASSIGN_OR_RETURN(a, b)=a = (b)");
+ GoogleMacros.push_back("ASSIGN_OR_RETURN(a, b, c)=a = (b); if (x) return c");
+ GoogleMacros.push_back("RETURN_IF_ERROR(expr)=if (x) return expr");
+ GoogleMacros.push_back("ASSERT_OK_AND_ASSIGN(lhs, rexpr)=lhs = (rexpr)");
+ GoogleMacros.push_back("ABSL_ASSIGN_OR_RETURN(a, b)=a = (b)");
+ GoogleMacros.push_back(
+ "ABSL_ASSIGN_OR_RETURN(a, b, c)=a = (b); if (x) return c");
+ GoogleMacros.push_back("ABSL_RETURN_IF_ERROR(expr)=if (x) return expr");
+ GoogleMacros.push_back("ABSL_ASSERT_OK_AND_ASSIGN(lhs, rexpr)=lhs = (rexpr)");
+ CHECK_PARSE("BasedOnStyle: Google", Macros, GoogleMacros);
----------------
jmr wrote:
Again, modeled directly after https://github.com/llvm/llvm-project/pull/169037/changes
https://github.com/llvm/llvm-project/pull/200210
More information about the cfe-commits
mailing list