================
@@ -439,6 +439,119 @@ TEST_F(FormatTestMacroExpansion,
TokensAfterMacroCallAreNotPartOfCall) {
Style);
}
+TEST_F(FormatTestMacroExpansion,
+ SeparateDefinitionBlocksWithMacroExpandedStruct) {
+ // Reproduces https://github.com/llvm/llvm-project/issues/78263
+ FormatStyle Style = getLLVMStyle();
+ Style.BreakBeforeBraces = FormatStyle::BS_Custom;
+ Style.BraceWrapping.AfterStruct = true;
+ Style.SeparateDefinitionBlocks = FormatStyle::SDS_Always;
+ Style.Macros.push_back("PACK(x)=x");
+
+ verifyFormat("static bool foo;\n"
+ "\n"
+ "//! \\brief Blah\n"
+ "PACK(\n"
+ " struct Foo\n"
+ " {\n"
+ " uint16_t a;\n"
+ " });\n"
+ "\n"
+ "PACK(\n"
+ " struct Bar\n"
+ " {\n"
+ " uint32_t a;\n"
+ " });\n"
+ "\n"
+ "PACK(\n"
+ " struct Baz\n"
+ " {\n"
+ " uint16_t a;\n"
+ " });",
+ "static bool foo;\n"
+ "\n"
+ "//! \\brief Blah\n"
+ "PACK(struct Foo\n"
+ "{\n"
+ " uint16_t a;\n"
+ "});\n"
+ "\n"
+ "PACK(struct Bar\n"
+ "{\n"
+ " uint32_t a;\n"
+ "});\n"
+ "\n"
+ "PACK(struct Baz\n"
+ "{\n"
+ " uint16_t a;\n"
+ "});",
+ Style);
+}
+
+TEST_F(FormatTestMacroExpansion, MacroExpansionWithIfElseBranches) {
+ // Reproduces https://github.com/llvm/llvm-project/issues/233300
----------------
r4nt wrote:
Done.
https://github.com/llvm/llvm-project/pull/233758
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits