@@ -1028,6 +1028,50 @@ class UPCPreIncrementGadget : public FixableGadget {
}
};
+// Representing a pointer type expression of the form `Ptr += n` in an
+// Unspecified Untyped Context (UUC):
+class UUCAddAssignGadget : public FixableGadget {
+private:
+ static constexpr co
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/74020
>From 00083bb1573561361ff0782f425ebec2a5218f34 Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Mon, 4 Dec 2023 14:37:10 -0800
Subject: [PATCH] Thread safety analysis: Fix a bug in handling temporary
const
ziqingluo-90 wrote:
@aaronpuchert Thanks for your comment! I have addressed them. Do you mind to
take an another look and approve it if it looks good to you?
https://github.com/llvm/llvm-project/pull/74020
___
cfe-commits mailing list
cfe-commits@l
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/74020
>From 81701bfc9052eed567abb76ac05d44cb99298303 Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Mon, 4 Dec 2023 14:37:10 -0800
Subject: [PATCH] Thread safety analysis: Fix a bug in handling temporary
const
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/74020
>From 9c2718abce31d61c079e0945313fe14ad0f334b3 Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Mon, 4 Dec 2023 14:37:10 -0800
Subject: [PATCH] Thread safety analysis: Fix a bug in handling temporary
const
@@ -2487,15 +2486,15 @@ void
ThreadSafetyAnalyzer::runAnalysis(AnalysisDeclContext &AC) {
// Clean up constructed object even if there are no attributes to
// keep the number of objects in limbo as small as possible.
- if (auto Object = LocksetBui
ziqingluo-90 wrote:
Plan to merge this PR tomorrow.
https://github.com/llvm/llvm-project/pull/74020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ziqingluo-90 closed
https://github.com/llvm/llvm-project/pull/74020
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ziqingluo-90 created
https://github.com/llvm/llvm-project/pull/75665
Add a sub diagnostic group under `-Wunsafe-buffer-usage` controlled by
`-Wunsafe-buffer-usage-in-container`. The subgroup will include warnings on
misuses of `std::span`, `std::vector`, and `std::array`.
@@ -721,6 +721,33 @@ class UnsafeBufferUsageAttrGadget : public WarningGadget {
DeclUseList getClaimedVarUseSites() const override { return {}; }
};
+// Warning gadget for unsafe invocation of span::data method.
+// Triggers when the pointer returned by the invocation is imm
@@ -2261,6 +2261,21 @@ class UnsafeBufferUsageReporter : public
UnsafeBufferUsageHandler {
// note_unsafe_buffer_operation doesn't have this mode yet.
assert(!IsRelatedToDecl && "Not implemented yet!");
MsgParam = 3;
+ } else if (const auto *ECE =
https://github.com/ziqingluo-90 closed
https://github.com/llvm/llvm-project/pull/75665
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ziqingluo-90 created
https://github.com/llvm/llvm-project/pull/74020
The commit 54bfd04846156dbd5e0a6b88f539c3d4569a455f introduces general handling
of constructor and destructor calls. Consider a pair of TEMPORARY constructor
and destructor calls of a "SCOPED_CAPABILITY" o
https://github.com/ziqingluo-90 approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/75650
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ziqingluo-90 created
https://github.com/llvm/llvm-project/pull/77148
The PR contains two commits:
1. adding a new waring under a sub-group of `-Wunsafe-buffer-usage`
2. teach the analyzer to be quiet on some benign cases
>From 475d918fb0b5991be7ce559ef6ef7f20c6b231e5 Mon Sep
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/77148
>From fb93d83d65ef1c52857b4471ccda2e82447d45dc Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Fri, 5 Jan 2024 13:39:39 -0800
Subject: [PATCH 1/2] [-Wunsafe-buffer-usage] Add a new warning for use of
two-
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/77148
>From 4714b0c03897ab61322e3a16288994ccb01dbfac Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Fri, 5 Jan 2024 13:39:39 -0800
Subject: [PATCH 1/2] [-Wunsafe-buffer-usage] Add a new warning for use of
two-
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/77148
>From 6ba957670ca593094b4545c35801585da2ee02a8 Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Fri, 5 Jan 2024 13:39:39 -0800
Subject: [PATCH 1/2] [-Wunsafe-buffer-usage] Add a new warning for use of
two-
Author: Ziqing Luo
Date: 2022-07-21T13:35:31-07:00
New Revision: b17baa1db613a2ce777aa122feb87488750a64d0
URL:
https://github.com/llvm/llvm-project/commit/b17baa1db613a2ce777aa122feb87488750a64d0
DIFF:
https://github.com/llvm/llvm-project/commit/b17baa1db613a2ce777aa122feb87488750a64d0.diff
LO
https://github.com/ziqingluo-90 approved this pull request.
LGTM!
I think I did something similar locally when I collected data of unclaimed DREs
on those big adopter projects. So I guess the data that we used to find major
missing patterns for fix-its is still valid.
https://github.com/ll
@@ -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,
+
@@ -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,
+
@@ -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,
+
@@ -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,
+
@@ -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,
+
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
__
https://github.com/ziqingluo-90 approved this pull request.
LGTM!
(We probably do not need to use `CHECK-DAG` at most places in our tests since
we have fixed the non-deterministic issue, but it's irrelevant to this PR.)
https://github.com/llvm/llvm-project/pull/80347
___
https://github.com/ziqingluo-90 approved this pull request.
LGTM! Thanks for re-formatting the code.
https://github.com/llvm/llvm-project/pull/82027
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinf
@@ -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) {
+
@@ -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,
+
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/77148
>From 1b169f49a129a5a69a82386b486c8a46ecfc815a Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Fri, 5 Jan 2024 13:39:39 -0800
Subject: [PATCH 1/3] [-Wunsafe-buffer-usage] Add a new warning for use of
two-
https://github.com/ziqingluo-90 approved this pull request.
LGTM, It's great to catch and fix this bug!
https://github.com/llvm/llvm-project/pull/79392
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/list
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/78380
>From e7c3a3fc2a4f5d5714044a1c407bfe56f328680d Mon Sep 17 00:00:00 2001
From: Ziqing Luo
Date: Tue, 16 Jan 2024 17:45:01 -0800
Subject: [PATCH 1/3] [-Wcompletion-handler] Fix a non-termination issue
The Cal
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/78380
>From e7c3a3fc2a4f5d5714044a1c407bfe56f328680d Mon Sep 17 00:00:00 2001
From: Ziqing Luo
Date: Tue, 16 Jan 2024 17:45:01 -0800
Subject: [PATCH 1/4] [-Wcompletion-handler] Fix a non-termination issue
The Cal
ziqingluo-90 wrote:
@SavchenkoValeriy, sorry for the late response.
Your suggested fix works for my minimal example as well as my local project
where this bug was originated.
And I failed to come up with a new counter-example for the fix so I believe it
will also prevent future non-terminatio
https://github.com/ziqingluo-90 closed
https://github.com/llvm/llvm-project/pull/78380
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ziqingluo-90 closed
https://github.com/llvm/llvm-project/pull/77148
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ziqingluo-90 edited
https://github.com/llvm/llvm-project/pull/78815
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ziqingluo-90 approved this pull request.
LGTM! Feel free to ignore my comment if it doesn't make sense to you.
https://github.com/llvm/llvm-project/pull/78815
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.ll
@@ -2263,15 +2263,27 @@ class UnsafeBufferUsageReporter : public
UnsafeBufferUsageHandler {
MsgParam = 3;
} else if (const auto *ECE = dyn_cast(Operation)) {
QualType destType = ECE->getType();
-const uint64_t dSize =
-Ctx.getTypeSize(
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/77148
>From 6ba957670ca593094b4545c35801585da2ee02a8 Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Fri, 5 Jan 2024 13:39:39 -0800
Subject: [PATCH 1/2] [-Wunsafe-buffer-usage] Add a new warning for use of
two-
Author: Ziqing Luo
Date: 2023-01-04T15:51:56-08:00
New Revision: b2ac5fd724c44cf662caed84bd8f84af574b981d
URL:
https://github.com/llvm/llvm-project/commit/b2ac5fd724c44cf662caed84bd8f84af574b981d
DIFF:
https://github.com/llvm/llvm-project/commit/b2ac5fd724c44cf662caed84bd8f84af574b981d.diff
LO
Author: Ziqing Luo
Date: 2023-01-04T16:50:21-08:00
New Revision: f84f17c489f7cb84d72e84a6b1b6c54bd8d52717
URL:
https://github.com/llvm/llvm-project/commit/f84f17c489f7cb84d72e84a6b1b6c54bd8d52717
DIFF:
https://github.com/llvm/llvm-project/commit/f84f17c489f7cb84d72e84a6b1b6c54bd8d52717.diff
LO
Author: Ziqing Luo
Date: 2023-01-04T17:16:21-08:00
New Revision: f58b025354ee2d3bcd7ab2399a11429ec940c1e0
URL:
https://github.com/llvm/llvm-project/commit/f58b025354ee2d3bcd7ab2399a11429ec940c1e0
DIFF:
https://github.com/llvm/llvm-project/commit/f58b025354ee2d3bcd7ab2399a11429ec940c1e0.diff
LO
Author: Ziqing Luo
Date: 2023-09-21T12:45:30-07:00
New Revision: 33f6161d9eaaa7c5a01ee8e50dec440d3052d34a
URL:
https://github.com/llvm/llvm-project/commit/33f6161d9eaaa7c5a01ee8e50dec440d3052d34a
DIFF:
https://github.com/llvm/llvm-project/commit/33f6161d9eaaa7c5a01ee8e50dec440d3052d34a.diff
LO
Author: Ziqing Luo
Date: 2023-09-21T15:06:22-07:00
New Revision: 700baeb765cfe8628eb68bc24319b3db0209dd84
URL:
https://github.com/llvm/llvm-project/commit/700baeb765cfe8628eb68bc24319b3db0209dd84
DIFF:
https://github.com/llvm/llvm-project/commit/700baeb765cfe8628eb68bc24319b3db0209dd84.diff
LO
Author: Ziqing Luo
Date: 2023-07-19T14:14:28-07:00
New Revision: 4b5f17e008c684998a5ee10454d34714736eb6c5
URL:
https://github.com/llvm/llvm-project/commit/4b5f17e008c684998a5ee10454d34714736eb6c5
DIFF:
https://github.com/llvm/llvm-project/commit/4b5f17e008c684998a5ee10454d34714736eb6c5.diff
LO
Author: Ziqing Luo
Date: 2023-07-25T16:58:27-07:00
New Revision: cfcf76c6ad72581917fc65b598e3b64ca28c5ce1
URL:
https://github.com/llvm/llvm-project/commit/cfcf76c6ad72581917fc65b598e3b64ca28c5ce1
DIFF:
https://github.com/llvm/llvm-project/commit/cfcf76c6ad72581917fc65b598e3b64ca28c5ce1.diff
LO
Author: Ziqing Luo
Date: 2023-08-17T15:27:38-07:00
New Revision: 41279e870fa577f8a7f7030b8e45da250d0def9e
URL:
https://github.com/llvm/llvm-project/commit/41279e870fa577f8a7f7030b8e45da250d0def9e
DIFF:
https://github.com/llvm/llvm-project/commit/41279e870fa577f8a7f7030b8e45da250d0def9e.diff
LO
Author: Ziqing Luo
Date: 2023-08-17T16:24:47-07:00
New Revision: 843784764ab58e35f8aa2da97f07dc5e810f4bcb
URL:
https://github.com/llvm/llvm-project/commit/843784764ab58e35f8aa2da97f07dc5e810f4bcb
DIFF:
https://github.com/llvm/llvm-project/commit/843784764ab58e35f8aa2da97f07dc5e810f4bcb.diff
LO
Author: Ziqing Luo
Date: 2023-08-17T16:42:30-07:00
New Revision: ac9a76d7487b9af1ace626eb90064194cb12c53d
URL:
https://github.com/llvm/llvm-project/commit/ac9a76d7487b9af1ace626eb90064194cb12c53d
DIFF:
https://github.com/llvm/llvm-project/commit/ac9a76d7487b9af1ace626eb90064194cb12c53d.diff
LO
Author: Ziqing Luo
Date: 2023-08-21T14:50:04-07:00
New Revision: 3a67b912386e70073efcb2225c6354b85048b1ae
URL:
https://github.com/llvm/llvm-project/commit/3a67b912386e70073efcb2225c6354b85048b1ae
DIFF:
https://github.com/llvm/llvm-project/commit/3a67b912386e70073efcb2225c6354b85048b1ae.diff
LO
Author: Ziqing Luo
Date: 2023-08-21T16:34:44-07:00
New Revision: b58e52889808e0e8da55ac77f651762f202aa4c5
URL:
https://github.com/llvm/llvm-project/commit/b58e52889808e0e8da55ac77f651762f202aa4c5
DIFF:
https://github.com/llvm/llvm-project/commit/b58e52889808e0e8da55ac77f651762f202aa4c5.diff
LO
Author: Ziqing Luo
Date: 2023-04-05T14:54:03-07:00
New Revision: ca6ceeb0d6cd5b8545410d878c8d7bcce9538a3a
URL:
https://github.com/llvm/llvm-project/commit/ca6ceeb0d6cd5b8545410d878c8d7bcce9538a3a
DIFF:
https://github.com/llvm/llvm-project/commit/ca6ceeb0d6cd5b8545410d878c8d7bcce9538a3a.diff
LO
Author: Ziqing Luo
Date: 2023-04-11T15:09:51-07:00
New Revision: 88f7f018e23b24d3c31dd2b4f3cd68481d1739c1
URL:
https://github.com/llvm/llvm-project/commit/88f7f018e23b24d3c31dd2b4f3cd68481d1739c1
DIFF:
https://github.com/llvm/llvm-project/commit/88f7f018e23b24d3c31dd2b4f3cd68481d1739c1.diff
LO
Author: Ziqing Luo
Date: 2023-04-12T14:51:46-07:00
New Revision: 762af11d4c5d0bd1e76f23a07087773db09ef17d
URL:
https://github.com/llvm/llvm-project/commit/762af11d4c5d0bd1e76f23a07087773db09ef17d
DIFF:
https://github.com/llvm/llvm-project/commit/762af11d4c5d0bd1e76f23a07087773db09ef17d.diff
LO
Author: Ziqing Luo
Date: 2023-04-13T11:24:46-07:00
New Revision: 6251b04fc76a45d5a9c00bfb5010b9bbbcefb9b0
URL:
https://github.com/llvm/llvm-project/commit/6251b04fc76a45d5a9c00bfb5010b9bbbcefb9b0
DIFF:
https://github.com/llvm/llvm-project/commit/6251b04fc76a45d5a9c00bfb5010b9bbbcefb9b0.diff
LO
Author: Ziqing Luo
Date: 2023-02-07T13:17:44-08:00
New Revision: a29e67614c3b7018287e5f68c57bba7618aa880e
URL:
https://github.com/llvm/llvm-project/commit/a29e67614c3b7018287e5f68c57bba7618aa880e
DIFF:
https://github.com/llvm/llvm-project/commit/a29e67614c3b7018287e5f68c57bba7618aa880e.diff
LO
Author: Ziqing Luo
Date: 2023-02-07T14:47:43-08:00
New Revision: 622be09c815266632e204eaf1c7a35f050220459
URL:
https://github.com/llvm/llvm-project/commit/622be09c815266632e204eaf1c7a35f050220459
DIFF:
https://github.com/llvm/llvm-project/commit/622be09c815266632e204eaf1c7a35f050220459.diff
LO
Author: Ziqing Luo
Date: 2023-02-07T15:40:19-08:00
New Revision: bdf4f2bea50e87f5b9273e3bbc9a7753bca3a6bb
URL:
https://github.com/llvm/llvm-project/commit/bdf4f2bea50e87f5b9273e3bbc9a7753bca3a6bb
DIFF:
https://github.com/llvm/llvm-project/commit/bdf4f2bea50e87f5b9273e3bbc9a7753bca3a6bb.diff
LO
Author: Ziqing Luo
Date: 2023-02-07T16:15:28-08:00
New Revision: 692da6245d719fcee9d55936a021d9f9e301c557
URL:
https://github.com/llvm/llvm-project/commit/692da6245d719fcee9d55936a021d9f9e301c557
DIFF:
https://github.com/llvm/llvm-project/commit/692da6245d719fcee9d55936a021d9f9e301c557.diff
LO
Author: Ziqing Luo
Date: 2023-02-07T16:54:39-08:00
New Revision: aef05b5dc5c566bcaa15b66c989ccb8d2841ac71
URL:
https://github.com/llvm/llvm-project/commit/aef05b5dc5c566bcaa15b66c989ccb8d2841ac71
DIFF:
https://github.com/llvm/llvm-project/commit/aef05b5dc5c566bcaa15b66c989ccb8d2841ac71.diff
LO
Author: Ziqing Luo
Date: 2023-02-07T17:06:20-08:00
New Revision: 9aa00c8a306561c4e3ddb09058e66bae322a0769
URL:
https://github.com/llvm/llvm-project/commit/9aa00c8a306561c4e3ddb09058e66bae322a0769
DIFF:
https://github.com/llvm/llvm-project/commit/9aa00c8a306561c4e3ddb09058e66bae322a0769.diff
LO
Author: Ziqing Luo
Date: 2023-02-08T14:12:03-08:00
New Revision: 829bcb06ec43ab4b56b95ff040ec9d36feeaf06a
URL:
https://github.com/llvm/llvm-project/commit/829bcb06ec43ab4b56b95ff040ec9d36feeaf06a
DIFF:
https://github.com/llvm/llvm-project/commit/829bcb06ec43ab4b56b95ff040ec9d36feeaf06a.diff
LO
Author: Ziqing Luo
Date: 2023-02-08T17:38:19-08:00
New Revision: 03cc52dfd1dbb4a59b479da55e87838fb93d2067
URL:
https://github.com/llvm/llvm-project/commit/03cc52dfd1dbb4a59b479da55e87838fb93d2067
DIFF:
https://github.com/llvm/llvm-project/commit/03cc52dfd1dbb4a59b479da55e87838fb93d2067.diff
LO
Author: Ziqing Luo
Date: 2023-02-23T14:47:43-08:00
New Revision: f78c34346635e25919e2777b1b1cbb9627d5ad43
URL:
https://github.com/llvm/llvm-project/commit/f78c34346635e25919e2777b1b1cbb9627d5ad43
DIFF:
https://github.com/llvm/llvm-project/commit/f78c34346635e25919e2777b1b1cbb9627d5ad43.diff
LO
Author: Ziqing Luo
Date: 2023-02-23T15:02:46-08:00
New Revision: cd2652963b6b97c01329419f15c336e5560afa98
URL:
https://github.com/llvm/llvm-project/commit/cd2652963b6b97c01329419f15c336e5560afa98
DIFF:
https://github.com/llvm/llvm-project/commit/cd2652963b6b97c01329419f15c336e5560afa98.diff
LO
https://github.com/ziqingluo-90 edited
https://github.com/llvm/llvm-project/pull/81935
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ziqingluo-90 approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/81935
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -2326,15 +2312,21 @@ static FixItList fixLocalVarDeclWithSpan(const VarDecl
*D, ASTContext &Ctx,
return {};
FixIts.insert(FixIts.end(), std::make_move_iterator(InitFixIts->begin()),
std::make_move_iterator(InitFixIts->end()));
-// If the decl
@@ -2326,15 +2312,21 @@ static FixItList fixLocalVarDeclWithSpan(const VarDecl
*D, ASTContext &Ctx,
return {};
FixIts.insert(FixIts.end(), std::make_move_iterator(InitFixIts->begin()),
std::make_move_iterator(InitFixIts->end()));
-// If the decl
https://github.com/ziqingluo-90 closed
https://github.com/llvm/llvm-project/pull/101583
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
ziqingluo-90 wrote:
> There needs to be a flag to opt out of this to not break everybody who is
> currently using unsafe-buffer-usage. #105383 seems to do that, but it really
> should be in this same PR. Can this be reverted and relanded with the flag?
ok, will do
https://github.com/llvm/llvm
ziqingluo-90 wrote:
> There needs to be a flag to opt out of this to not break everybody who is
> currently using unsafe-buffer-usage. #105383 seems to do that, but it really
> should be in this same PR. Can this be reverted and relanded with the flag?
@aeubanks you should be able to suppress
ziqingluo-90 wrote:
> > We're seeing a crash with this patch when compiling with -Weverything.
> > ```
> > clang: ../../clang/include/clang/AST/Expr.h:3026: const clang::Expr
> > *clang::CallExpr::getArg(unsigned int) const: Assertion `Arg < getNumArgs()
> > && "Arg access out of range!"' faile
ziqingluo-90 wrote:
> Btw a question about the new warning: So with
> -Wunsafe-buffer-usage-in-libc-call clang now warns on the following?
>
> ```
> #include
>
> void foo(void) {
> char q[10];
> snprintf(q, 10, "%s", "hello");
> }
> ```
>
> It says
>
> ```
> foo.c:5:3: warning: function
https://github.com/ziqingluo-90 created
https://github.com/llvm/llvm-project/pull/102953
`QualType::isConstantArrayType()` checks canonical type. So a following cast
should be applied to canonical type as well:
```
if (Ty->isConstantArrayType())
cast(Ty.getCanonicalType()); //
cast(Ty) is
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/101583
>From cce5781733a7c294f10dc75f48372ff6ee331239 Mon Sep 17 00:00:00 2001
From: Ziqing Luo
Date: Thu, 1 Aug 2024 16:36:27 -0700
Subject: [PATCH 1/2] [-Wunsafe-buffer-usage] Add warn on unsafe calls to libc
f
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/101583
>From cce5781733a7c294f10dc75f48372ff6ee331239 Mon Sep 17 00:00:00 2001
From: Ziqing Luo
Date: Thu, 1 Aug 2024 16:36:27 -0700
Subject: [PATCH 1/2] [-Wunsafe-buffer-usage] Add warn on unsafe calls to libc
f
@@ -443,6 +447,314 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
return false;
}
+AST_MATCHER(CallExpr, isUnsafeLibcFunctionCall) {
+ static const std::set PredefinedNames{
+ // numeric conversion:
+ "atof",
+ "atoi",
+ "atol",
+ "atoll
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/102953
>From d6c860de3facc37f27b17a26a01e48bc02b4659b Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Mon, 12 Aug 2024 11:57:17 -0700
Subject: [PATCH] [-Wunsafe-buffer-usage] Fix a bug in the ASTMatcher for span
@@ -404,7 +404,7 @@ AST_MATCHER(CXXConstructExpr, isSafeSpanTwoParamConstruct) {
if (Arg0Ty->isConstantArrayType()) {
const APSInt ConstArrSize =
-APSInt(cast(Arg0Ty)->getSize());
+APSInt(cast(Arg0Ty.getCanonicalType())->getSize());
ziqin
https://github.com/ziqingluo-90 closed
https://github.com/llvm/llvm-project/pull/102953
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
return false;
}
+namespace libc_fun_disjoint_inner_matchers {
+// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match
+// disjoint node sets. They all take a `CoreName`, which
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
return false;
}
+namespace libc_fun_disjoint_inner_matchers {
+// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match
+// disjoint node sets. They all take a `CoreName`, which
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/101583
>From cce5781733a7c294f10dc75f48372ff6ee331239 Mon Sep 17 00:00:00 2001
From: Ziqing Luo
Date: Thu, 1 Aug 2024 16:36:27 -0700
Subject: [PATCH 1/3] [-Wunsafe-buffer-usage] Add warn on unsafe calls to libc
f
@@ -2292,6 +2292,18 @@ class UnsafeBufferUsageReporter : public
UnsafeBufferUsageHandler {
}
}
+ void handleUnsafeLibcCall(const CallExpr *Call, unsigned PrintfInfo,
+ASTContext &Ctx) override {
+// We have checked that there is a direct
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
return false;
}
+namespace libc_fun_disjoint_inner_matchers {
+// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match
+// disjoint node sets. They all take a `CoreName`, which
@@ -783,6 +783,18 @@ bool ParsePrintfString(FormatStringHandler &H,
bool ParseFormatStringHasSArg(const char *beg, const char *end,
const LangOptions &LO, const TargetInfo &Target);
+/// Parse C format string and return index (relative to `ArgInde
@@ -483,6 +483,34 @@ bool
clang::analyze_format_string::ParseFormatStringHasSArg(const char *I,
return false;
}
+unsigned clang::analyze_format_string::ParseFormatStringFirstSArgIndex(
+const char *&I, const char *E, unsigned ArgIndex, const LangOptions &LO,
+const
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
return false;
}
+namespace libc_fun_disjoint_inner_matchers {
+// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match
+// disjoint node sets. They all take a `CoreName`, which
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
return false;
}
+namespace libc_fun_disjoint_inner_matchers {
+// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match
+// disjoint node sets. They all take a `CoreName`, which
@@ -443,6 +448,368 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
return false;
}
+namespace libc_fun_disjoint_inner_matchers {
+// `libc_fun_disjoint_inner_matchers` covers a set of matchers that match
+// disjoint node sets. They all take a `CoreName`, which
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/101583
>From cce5781733a7c294f10dc75f48372ff6ee331239 Mon Sep 17 00:00:00 2001
From: Ziqing Luo
Date: Thu, 1 Aug 2024 16:36:27 -0700
Subject: [PATCH 1/3] [-Wunsafe-buffer-usage] Add warn on unsafe calls to libc
f
https://github.com/ziqingluo-90 created
https://github.com/llvm/llvm-project/pull/88017
Compiler options recognizable to ccc-analyzer are stored in maps. An option
missing in the map will be dropped by ccc-analyzer. This causes a build error
in one of our projects that only happens in scan-b
https://github.com/ziqingluo-90 closed
https://github.com/llvm/llvm-project/pull/88017
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/92031
>From ac5aeb5c3a134d085320fc7fc5cf3f2c8c41a1f1 Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Mon, 13 May 2024 13:31:21 -0700
Subject: [PATCH 1/5] fix safe buffer opt-out region serialization
---
clang/
@@ -0,0 +1,41 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -emit-module
-fmodule-name=safe_buffers_test_base -x c++
%S/Inputs/SafeBuffers/safe_buffers_test.modulemap -std=c++20\
+// RUN: -o %t/safe_buffers_test_base.pcm -Wunsafe-buffer-usage
+//
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/92031
>From ac5aeb5c3a134d085320fc7fc5cf3f2c8c41a1f1 Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Mon, 13 May 2024 13:31:21 -0700
Subject: [PATCH 1/6] fix safe buffer opt-out region serialization
---
clang/
https://github.com/ziqingluo-90 updated
https://github.com/llvm/llvm-project/pull/92031
>From ac5aeb5c3a134d085320fc7fc5cf3f2c8c41a1f1 Mon Sep 17 00:00:00 2001
From: ziqingluo-90
Date: Mon, 13 May 2024 13:31:21 -0700
Subject: [PATCH 1/7] fix safe buffer opt-out region serialization
---
clang/
1 - 100 of 236 matches
Mail list logo