https://github.com/r4nt closed https://github.com/llvm/llvm-project/pull/76245
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/owenca approved this pull request.
https://github.com/llvm/llvm-project/pull/76245
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/r4nt updated https://github.com/llvm/llvm-project/pull/76245
>From 52cb11f0279dbd9f65f15e81f44869cfac00d544 Mon Sep 17 00:00:00 2001
From: Manuel Klimek
Date: Thu, 2 Mar 2023 14:00:35 +
Subject: [PATCH 1/3] [ClangFormat] Fix formatting bugs.
1. There are multiple calls to
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.ColumnLimit = 42;
+ Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c");
+ veri
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.ColumnLimit = 42;
+ Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c");
+ veri
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.ColumnLimit = 42;
+ Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c");
+ veri
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.ColumnLimit = 42;
+ Style.Macros.push_back("MACRO(a, b, c)=a=(b); if(x) c");
+ veri
@@ -255,6 +255,41 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.ColumnLimit = 42;
owenca wrote:
```suggestion
FormatStyle Style =
https://github.com/r4nt commented:
Addressed review comments.
https://github.com/llvm/llvm-project/pull/76245
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/r4nt updated https://github.com/llvm/llvm-project/pull/76245
>From 52cb11f0279dbd9f65f15e81f44869cfac00d544 Mon Sep 17 00:00:00 2001
From: Manuel Klimek
Date: Thu, 2 Mar 2023 14:00:35 +
Subject: [PATCH 1/2] [ClangFormat] Fix formatting bugs.
1. There are multiple calls to
@@ -2919,6 +2912,12 @@ class ExpressionParser {
void addFakeParenthesis(FormatToken *Start, prec::Level Precedence,
FormatToken *End = nullptr) {
+// Do not assign fake parenthesis to tokens that are part of an
+// unexpanded macro call. The
@@ -255,6 +255,44 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.Macros.push_back("ASSIGN_OR_RETURN(a, b, c)=a=(b); if(x) c");
+ verifyFormat(R"(ASSI
@@ -255,6 +255,44 @@ TEST_F(FormatTestMacroExpansion,
Style);
}
+TEST_F(FormatTestMacroExpansion, CommaAsOperator) {
+ FormatStyle Style = getGoogleStyle();
+ Style.Macros.push_back("ASSIGN_OR_RETURN(a, b, c)=a=(b); if(x) c");
+ verifyFormat(R"(ASSI
@@ -416,10 +421,15 @@ struct FormatToken {
/// to another one please use overwriteFixedType, or even better remove the
/// need to reassign the type.
void setFinalizedType(TokenType T) {
+if (MacroCtx && MacroCtx->Role == MR_UnexpandedArg)
+ return;
+
---
llvmbot wrote:
@llvm/pr-subscribers-clang-format
Author: None (r4nt)
Changes
1. There are multiple calls to addFakeParenthesis; move the guard to not
assign fake parenthesis into the function to make sure we cover all
calls.
2. MustBreakBefore can be set on a token in two cases: eith
https://github.com/r4nt created https://github.com/llvm/llvm-project/pull/76245
1. There are multiple calls to addFakeParenthesis; move the guard to not
assign fake parenthesis into the function to make sure we cover all
calls.
2. MustBreakBefore can be set on a token in two cases: either d
16 matches
Mail list logo