Issue 208172
Summary [clang-format] Issue with multiline macros and SkipMacroDefinitionBody
Labels
Assignees
Reporter tobias-johansson81
    We are trying to update our clang-format version on a rather large code base, we noticed an issue with the SkipMacroDefinitionBody and multiline macros with starting comments. It's seems to have started with version 19.1.0 (our currently used version is 17.6.0). 

Example (pre-formatting):
```cpp
#define CLANGFORMAT_MULTILINE_MACR_WITH_LEADING_CSTYLE_COMMENT(Func)    \
/* cstyle comment to trigger the issue */ \   
	\   
	void Func(int interval)\ 
	{\
		return Func(interval);\
	}\
```

It removes the continuation backslash `\` from the first line, resulting in:
```cpp
#define CLANGFORMAT_MULTILINE_MACR_WITH_LEADING_CSTYLE_COMMENT(Func)
/* cstyle comment to trigger the issue */ \   
	\   
	void
Func(int interval)\ 
	{
  return Func(interval);
}
\ 
```

Issue can be reproduced on: https://clang-format-configurator.site/ using 19.10 or newer, and default settings except setting SkipMacroDefinitionBody to `true`. 

Found this related issue: https://github.com/llvm/llvm-project/issues/94326 . Perhaps the fix for that might have had this impact (I don't have the knowledge of the clang-format code to be able to judge the likelyhood of that).

Thanks, 
Tobias
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to