[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-20 Thread Owen Pan via cfe-commits
https://github.com/owenca closed https://github.com/llvm/llvm-project/pull/77013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-20 Thread via cfe-commits
https://github.com/XDeme updated https://github.com/llvm/llvm-project/pull/77013 >From 45d01cbc7ec958518b1739daa9e9b0dc35c2d194 Mon Sep 17 00:00:00 2001 From: XDeme Date: Thu, 4 Jan 2024 19:04:21 -0300 Subject: [PATCH 1/8] [clang-format] Handle templated elaborated type specifier in function

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-20 Thread Owen Pan via cfe-commits
@@ -3873,6 +3873,9 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) { const FormatToken = *FormatTok; nextToken(); + auto IsNonMacroIdentifier = [](FormatToken *Tok) { owenca wrote: Nit: ```suggestion auto IsNonMacroIdentifier = [](const

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-20 Thread via cfe-commits
https://github.com/XDeme updated https://github.com/llvm/llvm-project/pull/77013 >From 45d01cbc7ec958518b1739daa9e9b0dc35c2d194 Mon Sep 17 00:00:00 2001 From: XDeme Date: Thu, 4 Jan 2024 19:04:21 -0300 Subject: [PATCH 1/7] [clang-format] Handle templated elaborated type specifier in function

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-20 Thread Owen Pan via cfe-commits
@@ -14583,9 +14583,10 @@ TEST_F(FormatTest, UnderstandContextOfRecordTypeKeywords) { verifyFormat("template <> struct X < 15, i<3 && 42 < 50 && 33 < 28> {};"); verifyFormat("int i = SomeFunction(a b);"); - // FIXME: - // This now gets parsed incorrectly as class

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-12 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/77013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-11 Thread via cfe-commits
https://github.com/XDeme updated https://github.com/llvm/llvm-project/pull/77013 >From 45d01cbc7ec958518b1739daa9e9b0dc35c2d194 Mon Sep 17 00:00:00 2001 From: XDeme Date: Thu, 4 Jan 2024 19:04:21 -0300 Subject: [PATCH 1/6] [clang-format] Handle templated elaborated type specifier in function

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-10 Thread via cfe-commits
XDeme wrote: I have updated the comment a little, because there is some case we can't handle: ```cpp template struct Goo F() {} ``` we can't distinguish if this is a class or function. We could check if F() is macro by checking if it is all uppercase, to identify a macro, but I am not sure if

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-10 Thread via cfe-commits
https://github.com/XDeme updated https://github.com/llvm/llvm-project/pull/77013 >From 45d01cbc7ec958518b1739daa9e9b0dc35c2d194 Mon Sep 17 00:00:00 2001 From: XDeme Date: Thu, 4 Jan 2024 19:04:21 -0300 Subject: [PATCH 1/5] [clang-format] Handle templated elaborated type specifier in function

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-08 Thread via cfe-commits
@@ -3903,6 +3903,15 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) { parseParens(); } + auto IsTemplate = [&] { +FormatToken *Tok = InitialToken.Previous; +while (Tok) { + if (Tok->is(tok::kw_template)) +return true; + Tok =

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-08 Thread Emilia Kond via cfe-commits
https://github.com/rymiel approved this pull request. https://github.com/llvm/llvm-project/pull/77013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-08 Thread Emilia Kond via cfe-commits
https://github.com/rymiel edited https://github.com/llvm/llvm-project/pull/77013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-08 Thread Emilia Kond via cfe-commits
@@ -3903,6 +3903,15 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) { parseParens(); } + auto IsTemplate = [&] { +FormatToken *Tok = InitialToken.Previous; +while (Tok) { + if (Tok->is(tok::kw_template)) +return true; + Tok =

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-06 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks approved this pull request. https://github.com/llvm/llvm-project/pull/77013 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-06 Thread via cfe-commits
https://github.com/XDeme updated https://github.com/llvm/llvm-project/pull/77013 >From 45d01cbc7ec958518b1739daa9e9b0dc35c2d194 Mon Sep 17 00:00:00 2001 From: XDeme Date: Thu, 4 Jan 2024 19:04:21 -0300 Subject: [PATCH 1/4] [clang-format] Handle templated elaborated type specifier in function

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-06 Thread Björn Schäpers via cfe-commits
https://github.com/HazardyKnusperkeks commented: Ok, one last thing. From what I figured it was wrongly detected as class definition. So you could add a token annotator test, which verifies that the `{` is not an `ClassLBrace`? https://github.com/llvm/llvm-project/pull/77013

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-04 Thread via cfe-commits
@@ -3914,7 +3914,15 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) { // (this would still leave us with an ambiguity between template function // and class declarations). if (FormatTok->isOneOf(tok::colon, tok::less)) { XDeme wrote: I've

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-04 Thread via cfe-commits
https://github.com/XDeme updated https://github.com/llvm/llvm-project/pull/77013 >From 45d01cbc7ec958518b1739daa9e9b0dc35c2d194 Mon Sep 17 00:00:00 2001 From: XDeme Date: Thu, 4 Jan 2024 19:04:21 -0300 Subject: [PATCH 1/3] [clang-format] Handle templated elaborated type specifier in function

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-04 Thread via cfe-commits
https://github.com/XDeme updated https://github.com/llvm/llvm-project/pull/77013 >From 45d01cbc7ec958518b1739daa9e9b0dc35c2d194 Mon Sep 17 00:00:00 2001 From: XDeme Date: Thu, 4 Jan 2024 19:04:21 -0300 Subject: [PATCH 1/2] [clang-format] Handle templated elaborated type specifier in function

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-04 Thread via cfe-commits
@@ -3914,7 +3914,15 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) { // (this would still leave us with an ambiguity between template function // and class declarations). if (FormatTok->isOneOf(tok::colon, tok::less)) { XDeme wrote: Yes,

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-04 Thread Björn Schäpers via cfe-commits
@@ -3914,7 +3914,15 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) { // (this would still leave us with an ambiguity between template function // and class declarations). if (FormatTok->isOneOf(tok::colon, tok::less)) { HazardyKnusperkeks

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-04 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-format Author: None (XDeme) Changes … return type. The behavior now is consistent with the non template version. Enabled and updated old test. --- Full diff: https://github.com/llvm/llvm-project/pull/77013.diff 2 Files Affected: - (modified)

[clang] [clang-format] Handle templated elaborated type specifier in function… (PR #77013)

2024-01-04 Thread via cfe-commits
https://github.com/XDeme created https://github.com/llvm/llvm-project/pull/77013 … return type. The behavior now is consistent with the non template version. Enabled and updated old test. >From 45d01cbc7ec958518b1739daa9e9b0dc35c2d194 Mon Sep 17 00:00:00 2001 From: XDeme Date: Thu, 4 Jan 2024