owenpan created this revision.
owenpan added reviewers: curdeius, MyDeveloperDay, HazardyKnusperkeks.
owenpan added a project: clang-format.
owenpan requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
The `l_brace` token in a macro definition should not be set to
`TT_FunctionLBrace`.
This patch could have fixed https://github.com/llvm/llvm-project/issues/42087.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118969
Files:
clang/lib/Format/UnwrappedLineParser.cpp
Index: clang/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1571,7 +1571,8 @@
} else if (Style.BraceWrapping.AfterFunction) {
addUnwrappedLine();
}
- FormatTok->setType(TT_FunctionLBrace);
+ if (!Line->InPPDirective)
+ FormatTok->setType(TT_FunctionLBrace);
parseBlock();
addUnwrappedLine();
return;
Index: clang/lib/Format/UnwrappedLineParser.cpp
===================================================================
--- clang/lib/Format/UnwrappedLineParser.cpp
+++ clang/lib/Format/UnwrappedLineParser.cpp
@@ -1571,7 +1571,8 @@
} else if (Style.BraceWrapping.AfterFunction) {
addUnwrappedLine();
}
- FormatTok->setType(TT_FunctionLBrace);
+ if (!Line->InPPDirective)
+ FormatTok->setType(TT_FunctionLBrace);
parseBlock();
addUnwrappedLine();
return;
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits