[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-12 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/17] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-12 Thread via cfe-commits
@@ -61,6 +61,7 @@ void testArraySubscripts(int *p, int **pp) { ); int a[10]; // expected-warning{{'a' is an unsafe buffer that does not perform bounds checks}} +// expected-note@-1{{change type of 'a' to 'std::array' to harden it}}

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-12 Thread via cfe-commits
https://github.com/jkorous-apple closed https://github.com/llvm/llvm-project/pull/80084 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-01-30 Thread via cfe-commits
https://github.com/jkorous-apple created https://github.com/llvm/llvm-project/pull/80084 None >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 1/9] [-Wunsafe-buffer-usage] Move Strategy class to the h

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-01-30 Thread via cfe-commits
llvmbot wrote: @llvm/pr-subscribers-clang-analysis Author: None (jkorous-apple) Changes --- Patch is 39.66 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/80084.diff 7 Files Affected: - (modified) clang/include/clang/Analysis/Analyses/Unsaf

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-01-30 Thread via cfe-commits
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff 86cd2fbdfe67d70a7fe061ed5d3a644f50f070f5 fd791ccdbf919c4810a92e700665a4766ef402a7 --

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-01-31 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/10] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-01-31 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/11] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-01-31 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/11] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread Artem Dergachev via cfe-commits
@@ -61,6 +61,7 @@ void testArraySubscripts(int *p, int **pp) { ); int a[10]; // expected-warning{{'a' is an unsafe buffer that does not perform bounds checks}} +// expected-note@-1{{change type of 'a' to 'std::array' to harden it}}

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread Artem Dergachev via cfe-commits
@@ -58,6 +95,8 @@ class UnsafeBufferUsageHandler { #endif public: + enum class TargetType { Span, Array }; haoNoQ wrote: Looks like a bit of dead code? https://github.com/llvm/llvm-project/pull/80084 ___ cfe-commi

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread Artem Dergachev via cfe-commits
@@ -2495,10 +2470,113 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread Artem Dergachev via cfe-commits
@@ -2495,10 +2470,113 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread via cfe-commits
@@ -2495,10 +2470,113 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread via cfe-commits
@@ -61,6 +61,7 @@ void testArraySubscripts(int *p, int **pp) { ); int a[10]; // expected-warning{{'a' is an unsafe buffer that does not perform bounds checks}} +// expected-note@-1{{change type of 'a' to 'std::array' to harden it}}

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/12] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/13] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread via cfe-commits
@@ -58,6 +95,8 @@ class UnsafeBufferUsageHandler { #endif public: + enum class TargetType { Span, Array }; jkorous-apple wrote: Totally. Removed. Thanks! https://github.com/llvm/llvm-project/pull/80084 ___ cfe-com

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread via cfe-commits
@@ -2495,10 +2470,113 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-01 Thread Artem Dergachev via cfe-commits
@@ -61,6 +61,7 @@ void testArraySubscripts(int *p, int **pp) { ); int a[10]; // expected-warning{{'a' is an unsafe buffer that does not perform bounds checks}} +// expected-note@-1{{change type of 'a' to 'std::array' to harden it}}

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-02 Thread Ziqing Luo via cfe-commits
@@ -0,0 +1,164 @@ +// RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage \ +// RUN:-fsafe-buffer-usage-suggestions \ +// RUN:-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s +typedef int * Int_ptr_t; +typedef int Int_t; + +void simple(unsigned idx) { +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-02 Thread Ziqing Luo via cfe-commits
@@ -2495,10 +2470,97 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-02 Thread via cfe-commits
@@ -61,6 +61,7 @@ void testArraySubscripts(int *p, int **pp) { ); int a[10]; // expected-warning{{'a' is an unsafe buffer that does not perform bounds checks}} +// expected-note@-1{{change type of 'a' to 'std::array' to harden it}}

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-02 Thread via cfe-commits
@@ -0,0 +1,164 @@ +// RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage \ +// RUN:-fsafe-buffer-usage-suggestions \ +// RUN:-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s +typedef int * Int_ptr_t; +typedef int Int_t; + +void simple(unsigned idx) { +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-05 Thread via cfe-commits
@@ -61,6 +61,7 @@ void testArraySubscripts(int *p, int **pp) { ); int a[10]; // expected-warning{{'a' is an unsafe buffer that does not perform bounds checks}} +// expected-note@-1{{change type of 'a' to 'std::array' to harden it}}

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-06 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/14] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-06 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/13] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-06 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/14] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-06 Thread via cfe-commits
@@ -0,0 +1,164 @@ +// RUN: %clang_cc1 -std=c++20 -Wunsafe-buffer-usage \ +// RUN:-fsafe-buffer-usage-suggestions \ +// RUN:-fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s +typedef int * Int_ptr_t; +typedef int Int_t; + +void simple(unsigned idx) { +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-06 Thread via cfe-commits
@@ -2495,10 +2470,97 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread Ziqing Luo via cfe-commits
@@ -2495,10 +2471,100 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread Ziqing Luo via cfe-commits
@@ -2495,10 +2471,100 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread Ziqing Luo via cfe-commits
@@ -2495,10 +2471,100 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread Ziqing Luo via cfe-commits
@@ -2495,10 +2471,100 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread Ziqing Luo via cfe-commits
@@ -2495,10 +2471,100 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread Ziqing Luo via cfe-commits
https://github.com/ziqingluo-90 approved this pull request. I left all my comments here. I didn't think quite through for some of them so feel free to ignore if they don't make sense to you. Other parts LGTM! https://github.com/llvm/llvm-project/pull/80084 __

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/15] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread via cfe-commits
@@ -2495,10 +2471,100 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread via cfe-commits
@@ -2495,10 +2471,100 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread via cfe-commits
@@ -2495,10 +2471,100 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread via cfe-commits
https://github.com/jkorous-apple updated https://github.com/llvm/llvm-project/pull/80084 >From 463a9904c1ae85fbdc0bd6029c6effea3fb16ea6 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 23 Jan 2024 16:16:10 -0800 Subject: [PATCH 01/16] [-Wunsafe-buffer-usage] Move Strategy class to the head

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread via cfe-commits
@@ -2495,10 +2471,100 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread via cfe-commits
https://github.com/jkorous-apple edited https://github.com/llvm/llvm-project/pull/80084 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-07 Thread via cfe-commits
@@ -2495,10 +2471,100 @@ static FixItList fixVariableWithSpan(const VarDecl *VD, return fixLocalVarDeclWithSpan(VD, Ctx, getUserFillPlaceHolder(), Handler); } +static FixItList fixVarDeclWithArray(const VarDecl *D, const ASTContext &Ctx, +

[clang] [-Wunsafe-buffer-usage] Introduce std::array fixits (PR #80084)

2024-02-08 Thread via cfe-commits
https://github.com/jkorous-apple edited https://github.com/llvm/llvm-project/pull/80084 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits