[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2025-01-10 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: #122473 is the promised follow-up for the diag. https://github.com/llvm/llvm-project/pull/118567 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] (reland) [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118501)

2025-01-10 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: #122473 is the promised follow-up for the diag. https://github.com/llvm/llvm-project/pull/118501 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Refactor attr diagnostics to use %select (PR #122473)

2025-01-10 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/122473 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Refactor attr diagnostics to use %select (PR #122473)

2025-01-10 Thread Maksim Ivanov via cfe-commits
@@ -3708,9 +3709,9 @@ void Parser::ParseDeclarationSpecifiers( continue; if (PA.getKind() == ParsedAttr::AT_LifetimeBound) -Diag(PA.getLoc(), diag::err_attribute_wrong_decl_type_str) emaxx-google wrote: There are callsites le

[clang] [clang] Refactor attr diagnostics to use %select (PR #122473)

2025-01-10 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google created https://github.com/llvm/llvm-project/pull/122473 None >From 67c2e435e7030ca417e685cfa98e39b79248687e Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Fri, 10 Jan 2025 15:10:52 + Subject: [PATCH] [clang] Refactor attr diagnostics to use %select ---

[clang] [clang] Refactor attr diagnostics to use %select (PR #122473)

2025-01-10 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: @ilya-biryukov You suggested previously (https://github.com/llvm/llvm-project/pull/118567/files#r1868729303) to introduce a separate enum, but I didn't manage to do it so far. Instead, I added new strings to `AttributeDeclKind`. My thinking has been: 1. If we create a enum

[clang] [clang] Refactor attr diagnostics to use %select (PR #122473)

2025-01-10 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google ready_for_review https://github.com/llvm/llvm-project/pull/122473 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Refactor attr diagnostics to use %select (PR #122473)

2025-01-10 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/122473 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2025-01-10 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google updated https://github.com/llvm/llvm-project/pull/118567 >From 85d3f923e6ae8aa707020dce67892cf4fae73415 Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Tue, 3 Dec 2024 22:49:09 + Subject: [PATCH 1/2] [clang] Informative error for lifetimebound in decl-spec

[clang] (reland) [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118501)

2025-01-09 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: Also: I didn't proceed with this PR because internal cleanup in Google's internal code base took time, but as this is finished now the PR could be merged. https://github.com/llvm/llvm-project/pull/118501 ___ cfe-commits mailing li

[clang] (reland) [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118501)

2025-01-09 Thread Maksim Ivanov via cfe-commits
@@ -8612,7 +8612,11 @@ static void HandleLifetimeBoundAttr(TypeProcessingState &State, CurType = State.getAttributedType( createSimpleAttr(State.getSema().Context, Attr), CurType, CurType); +return; } + State.getSema().Diag(Attr.getLoc(), diag::err_

[clang-tools-extra] [clang-tidy] Fix misc-unused-parameters on params with attrs (PR #122286)

2025-01-09 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/122286 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Fix misc-unused-parameters on params with attrs (PR #122286)

2025-01-09 Thread Maksim Ivanov via cfe-commits
@@ -26,6 +29,17 @@ bool isOverrideMethod(const FunctionDecl *Function) { return MD->size_overridden_methods() > 0 || MD->hasAttr(); return false; } + +bool hasAttrAfterParam(const SourceManager *SourceManager, + const ParmVarDecl *Param) { + for (co

[clang-tools-extra] [clang-tidy] Fix misc-unused-parameters on params with attrs (PR #122286)

2025-01-09 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: @usx95 https://github.com/llvm/llvm-project/pull/122286 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang-tools-extra] [clang-tidy] Fix misc-unused-parameters on params with attrs (PR #122286)

2025-01-09 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google updated https://github.com/llvm/llvm-project/pull/122286 >From 3faba8c3df1901d9fb58bf0d087a2a832ac9f04a Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Thu, 9 Jan 2025 14:59:35 + Subject: [PATCH 1/2] [clang-tidy] Fix misc-unused-parameters on params with

[clang-tools-extra] [clang-tidy] Fix misc-unused-parameters on params with attrs (PR #122286)

2025-01-09 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google updated https://github.com/llvm/llvm-project/pull/122286 >From 3faba8c3df1901d9fb58bf0d087a2a832ac9f04a Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Thu, 9 Jan 2025 14:59:35 + Subject: [PATCH] [clang-tidy] Fix misc-unused-parameters on params with attrs

[clang-tools-extra] [clang-tidy] Fix misc-unused-parameters on params with attrs (PR #122286)

2025-01-09 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google created https://github.com/llvm/llvm-project/pull/122286 Don't suggest to comment-out the parameter name if the parameter has an attribute that's spelled after the parameter name. This prevents the parameter's attributes from being wrongly applied to the parame

[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2024-12-05 Thread Maksim Ivanov via cfe-commits
@@ -3703,8 +3703,14 @@ void Parser::ParseDeclarationSpecifiers( // We reject AT_LifetimeBound and AT_AnyX86NoCfCheck, even though they // are type attributes, because we historically haven't allowed these // to be used as type attributes in C++11

[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2024-12-05 Thread Maksim Ivanov via cfe-commits
@@ -3703,8 +3703,14 @@ void Parser::ParseDeclarationSpecifiers( // We reject AT_LifetimeBound and AT_AnyX86NoCfCheck, even though they // are type attributes, because we historically haven't allowed these // to be used as type attributes in C++11

[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2024-12-05 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google updated https://github.com/llvm/llvm-project/pull/118567 >From 204069c8e11db15f0b716d09cab58398b9399598 Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Tue, 3 Dec 2024 22:49:09 + Subject: [PATCH 1/2] [clang] Informative error for lifetimebound in decl-spec

[clang] [clang][www] Remove ClangDataFormat.py from docs (PR #117943)

2024-12-04 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: Thanks for the review and for the merge! > Not sure how well maintained these are either, but since they still exist, > LGTM If you mean the `lldbDataFormatters.py` script, then I don't know either, but at least when I tried it it turned out to be useful. https://github.c

[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2024-12-03 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/118567 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang][www] Remove ClangDataFormat.py from docs (PR #117943)

2024-12-03 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: @Michael137 https://github.com/llvm/llvm-project/pull/117943 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2024-12-03 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: @hokein @ilya-biryukov https://github.com/llvm/llvm-project/pull/118567 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Informative error for lifetimebound in decl-spec (PR #118567)

2024-12-03 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google created https://github.com/llvm/llvm-project/pull/118567 Emit a bit more informative error when the `[[clang::lifetimebound]]` attribute is wrongly appearing on a decl-spec: "'lifetimebound' attribute only applies to parameters and implicit object parameters",

[clang] (reland) [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118501)

2024-12-03 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/118501 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] (reland) [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118501)

2024-12-03 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/118501 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] (reland) [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118501)

2024-12-03 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: @hokein @ilya-biryukov https://github.com/llvm/llvm-project/pull/118501 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] (reland) [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118501)

2024-12-03 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/118501 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] (reland) [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118501)

2024-12-03 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/118501 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] (reland) [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118501)

2024-12-03 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google created https://github.com/llvm/llvm-project/pull/118501 The reland can go in after we fixed downstream codebases that had incorrectly placed attributes. Original commit description: Emit the "cannot be applied to types" warning instead of silently ignoring the

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-03 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: Thanks for the reviews! Please merge the PR (I don't have write access). https://github.com/llvm/llvm-project/pull/118281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-co

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
emaxx-google wrote: > Can you add a note in llvm-project/clang/docs/ReleaseNotes.rst? done - thanks for pointing this out. https://github.com/llvm/llvm-project/pull/118281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google updated https://github.com/llvm/llvm-project/pull/118281 >From ffba96ae0b32a25b810c46c46e9c360c3eef400d Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Mon, 2 Dec 2024 10:03:25 + Subject: [PATCH 1/4] [clang] Warn [[clang::lifetimebound]] misusages on types

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
@@ -8612,7 +8612,11 @@ static void HandleLifetimeBoundAttr(TypeProcessingState &State, CurType = State.getAttributedType( createSimpleAttr(State.getSema().Context, Attr), CurType, CurType); +return; } + State.getSema().Diag(Attr.getLoc(), diag::err_

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
@@ -9,11 +9,20 @@ namespace usage_invalid { ~A() [[clang::lifetimebound]]; // expected-error {{cannot be applied to a destructor}} static int *static_class_member() [[clang::lifetimebound]]; // expected-error {{static member function has no implicit object parameter}}

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
@@ -9,11 +9,20 @@ namespace usage_invalid { ~A() [[clang::lifetimebound]]; // expected-error {{cannot be applied to a destructor}} static int *static_class_member() [[clang::lifetimebound]]; // expected-error {{static member function has no implicit object parameter}}

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/118281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/118281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
@@ -8612,7 +8612,10 @@ static void HandleLifetimeBoundAttr(TypeProcessingState &State, CurType = State.getAttributedType( createSimpleAttr(State.getSema().Context, Attr), CurType, CurType); +return; } + State.getSema().Diag(Attr.getLoc(), diag::err_

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google updated https://github.com/llvm/llvm-project/pull/118281 >From ffba96ae0b32a25b810c46c46e9c360c3eef400d Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Mon, 2 Dec 2024 10:03:25 + Subject: [PATCH 1/3] [clang] Warn [[clang::lifetimebound]] misusages on types

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google updated https://github.com/llvm/llvm-project/pull/118281 >From ffba96ae0b32a25b810c46c46e9c360c3eef400d Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Mon, 2 Dec 2024 10:03:25 + Subject: [PATCH] [clang] Warn [[clang::lifetimebound]] misusages on types Em

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/118281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google ready_for_review https://github.com/llvm/llvm-project/pull/118281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/118281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google edited https://github.com/llvm/llvm-project/pull/118281 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [clang] Warn [[clang::lifetimebound]] misusages on types (PR #118281)

2024-12-02 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google created https://github.com/llvm/llvm-project/pull/118281 Emit the "cannot be applied to types" warning instead of silently ignoring the attribute when it's attempted to be used on a type (instead of a function argument or the function definition). Before this c

[clang] [clang][www] Remove ClangDataFormat.py from docs (PR #117943)

2024-11-27 Thread Maksim Ivanov via cfe-commits
https://github.com/emaxx-google created https://github.com/llvm/llvm-project/pull/117943 The script was removed in https://github.com/llvm/llvm-project/pull/96385. Instead, mention the LLVM formatter as it's still very useful for Clang's code. >From 438047cf5d8eb582a9a2e989aa6137d8dbe57d9d Mon