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
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
@@ -3873,6 +3873,9 @@ void UnwrappedLineParser::parseRecord(bool ParseAsExpr) {
const FormatToken = *FormatTok;
nextToken();
+ auto IsNonMacroIdentifier = [](FormatToken *Tok) {
owenca wrote:
Nit:
```suggestion
auto IsNonMacroIdentifier = [](const
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
@@ -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
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
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
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
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
@@ -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 =
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
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
@@ -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 =
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
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
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
@@ -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
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
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
@@ -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,
@@ -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
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)
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
23 matches
Mail list logo