haoNoQ wrote:
> The current patch actually WILL work with it ONLY enabled on the line inside
> of the function, which I think is much more intuitive.
Ooo whoa this is awesome!!
https://github.com/llvm/llvm-project/pull/136323
___
cfe-commits mailing
@@ -202,6 +202,43 @@ class SemaPPCallbacks : public PPCallbacks {
break;
}
}
+ void PragmaDiagnostic(SourceLocation Loc, StringRef Namespace,
+diag::Severity Mapping, StringRef Str) override {
+// If one of the analysis-based diagnostics
https://github.com/haoNoQ commented:
So from the user's perspective we're checking the flag twice: once at the `}`
to see if we need to ramp up the analysis, then again at the diagnostic
location to see if the diagnostic should be discarded. The warning will only be
emitted if it's enabled at
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/136323
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Carlos =?utf-8?q?Gálvez?= ,
Carlos =?utf-8?q?Gálvez?=
Message-ID:
In-Reply-To:
haoNoQ wrote:
The static analyzer handles this pretty well already. I haven't heard of any
problems in this area. I think it makes sense to use the same logic by default
in other tools unless you do have specific
haoNoQ wrote:
Should we try to avoid calling the *value* uninitialized? Technically you
initialize variables (or memory), not values. In the static analyzer
terminology in particular, it's somewhat important that values are seen as
immutable data that's temporarily associated with mutable memo
haoNoQ wrote:
We could also go with something like "uninitialized or inaccessible memory" so
that to technically cover the OOB case without triggering an immediate visceral
reaction to buffer overruns. But it'll probably still be net-negative in
confusion compared to a simple "uninitialized".
haoNoQ wrote:
So when it comes to the ArrayBoundChecker, the checker that checks that every
access is within bounds, I think that its underlying "model" should be enabled
by default, so that to proactively terminate execution paths on which
uninitialized accesses happen. It should probably eve
haoNoQ wrote:
Yes, right, this is more of a side effect of how we do things, not quite the
intended behavior. In particular, if you write something out of bounds first,
we will no longer report it as an uninitialized read, even though it's still an
out-of-bounds read: https://godbolt.org/z/PYa
haoNoQ wrote:
Welcome!!
I completely agree that the message sounds a bit too much like "your code is
garbage" and that's not very nice.
Here's a tangent suggestion to get a better wording out of this. You can
exploit the fact that the static analyzer usually catches undefined values
_very ea
https://github.com/haoNoQ approved this pull request.
I wholeheartedly support this. I agree with everything you said here. Right now
you're much more of a maintainer than me.
https://github.com/llvm/llvm-project/pull/114991
___
cfe-commits mailing li
@@ -45,32 +52,119 @@ class UncountedLambdaCapturesChecker
bool shouldVisitTemplateInstantiations() const { return true; }
bool shouldVisitImplicitCode() const { return false; }
- bool VisitLambdaExpr(LambdaExpr *L) {
-Checker->visitLambdaExpr(L);
+
https://github.com/haoNoQ commented:
The attribute gets some action! Nice!!
I noticed that currently the attribute's documentation doesn't say it can be
placed on lambdas. But it doesn't look like it's actively rejected either. So
it might be a good idea to update the documentation as part of
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/114897
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -45,32 +52,119 @@ class UncountedLambdaCapturesChecker
bool shouldVisitTemplateInstantiations() const { return true; }
bool shouldVisitImplicitCode() const { return false; }
- bool VisitLambdaExpr(LambdaExpr *L) {
-Checker->visitLambdaExpr(L);
+
https://github.com/haoNoQ commented:
Nice nice nice!!
https://github.com/llvm/llvm-project/pull/114606
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/114606
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -0,0 +1,86 @@
+//===- MemoryUnsafeCastChecker.cpp -*- C++ -*-==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache
haoNoQ wrote:
> a function that returns a pointer and takes a reference (or a pointer) to a
> length variable
Yes, this one should be easy to catch. Both values will be `SymbolConjured`
pointing to the same function call expression / program point. (The
out-parameter value may also be `Symbol
@@ -0,0 +1,199 @@
+//== BoundsInformationChecker.cpp - bounds information checker --*- C++
-*--==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,199 @@
+//== BoundsInformationChecker.cpp - bounds information checker --*- C++
-*--==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
haoNoQ wrote:
No worries! I've just seen folks independently rediscover some of your work so
I wanted them to see if they want to deduplicate the efforts.
https://github.com/llvm/llvm-project/pull/91991
___
cfe-commits mailing list
[email protected]
haoNoQ wrote:
Please look at the dates.
https://github.com/llvm/llvm-project/pull/91991
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
haoNoQ wrote:
I did. The latest comment is
https://github.com/llvm/llvm-project/pull/91991#discussion_r1643433741
https://github.com/llvm/llvm-project/pull/91991
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/ma
haoNoQ wrote:
This overlaps with #91991 which should probably be landed in its entirety. (It
looks like it's about attributes but in fact it isn't. It's about finding *all*
gadgets in all those new places.) I think that patch was almost ready and it
was a matter of considering my fix in
https
@@ -0,0 +1,199 @@
+//== BoundsInformationChecker.cpp - bounds information checker --*- C++
-*--==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,199 @@
+//== BoundsInformationChecker.cpp - bounds information checker --*- C++
-*--==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -0,0 +1,76 @@
+// RUN: %clang %s -std=c++20 -Xclang -verify --analyze \
+// RUN: -Xclang -analyzer-checker=core,alpha.cplusplus.BoundsInformation \
+// RUN: -Xclang -analyzer-checker=debug.ExprInspection
haoNoQ wrote:
`ExprInspection` is probably unnecessa
@@ -0,0 +1,199 @@
+//== BoundsInformationChecker.cpp - bounds information checker --*- C++
-*--==//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Ap
@@ -69,48 +69,7 @@
Clang Static Analyzer
-The Clang Static Analyzer is a source code analysis tool that finds bugs in
-C, C++, and Objective-C programs.
-
-Currently it can be run either from the command
- line or if you use macOS then within Xcode. When
-invoked from the co
haoNoQ wrote:
> but not to replace it
And it doesn't necessarily need it in the first place! I think it's most likely
going to be useful as a standalone checker even when you never needed
`-Wunsafe-buffer-usage`.
It's a bit coding-convention-y: roughly on the same level of "speculative" as
t
@@ -427,6 +427,48 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
//- e. g. "Try harder to find a NamedDecl to point at in the note."
//already duplicated
// - call both from Sema and from here
+ std::function
+ SafeMaskedAccess;
+ unsigned int
https://github.com/haoNoQ closed
https://github.com/llvm/llvm-project/pull/111624
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/111910
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ updated
https://github.com/llvm/llvm-project/pull/111624
>From b5c9082e36efcc7be2cabc73c985749f2fd41725 Mon Sep 17 00:00:00 2001
From: Artem Dergachev
Date: Tue, 8 Oct 2024 20:24:00 -0700
Subject: [PATCH 1/3] [-Wunsafe-buffer-usage] Add user documentation.
---
clang/
@@ -190,11 +190,7 @@ class UncountedLocalVarsChecker
if (shouldSkipVarDecl(V))
return;
-const auto *ArgType = V->getType().getTypePtr();
-if (!ArgType)
haoNoQ wrote:
Fair enough!
https://github.com/llvm/llvm-project/pull/110213
https://github.com/haoNoQ approved this pull request.
https://github.com/llvm/llvm-project/pull/110213
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ approved this pull request.
Yes makes sense! I've no idea why this is a special case anyway.
https://github.com/llvm/llvm-project/pull/98
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-b
https://github.com/haoNoQ approved this pull request.
Aha LGTM!
https://github.com/llvm/llvm-project/pull/111222
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ updated
https://github.com/llvm/llvm-project/pull/111624
>From b5c9082e36efcc7be2cabc73c985749f2fd41725 Mon Sep 17 00:00:00 2001
From: Artem Dergachev
Date: Tue, 8 Oct 2024 20:24:00 -0700
Subject: [PATCH 1/2] [-Wunsafe-buffer-usage] Add user documentation.
---
clang/
https://github.com/haoNoQ created
https://github.com/llvm/llvm-project/pull/111624
This is an attempt to finally land the documentation that I initially wrote in
https://reviews.llvm.org/D136811 - which doubled as RFC - and I sincerely
apologize for not doing this sooner.
I've rewritten most
@@ -190,11 +190,7 @@ class UncountedLocalVarsChecker
if (shouldSkipVarDecl(V))
return;
-const auto *ArgType = V->getType().getTypePtr();
-if (!ArgType)
haoNoQ wrote:
Some of these null checks may still be necessary (with `QualType.isNull()`)
@@ -1771,6 +1771,10 @@ def UncountedLambdaCapturesChecker :
Checker<"UncountedLambdaCapturesChecker">,
let ParentPackage = WebKitAlpha in {
+def NoUncheckedPtrMemberChecker : Checker<"NoUncheckedPtrMemberChecker">,
+ HelpText<"Check for no unchecked member variables.">,
+
@@ -0,0 +1,53 @@
+// RUN: %clang_analyze_cc1
-analyzer-checker=alpha.webkit.NoUncheckedPtrMemberChecker -verify %s
+
+#include "mock-types.h"
+#include "mock-system-header.h"
haoNoQ wrote:
Do you need to include this one everywhere? Isn't it just a tiny test to
@@ -134,10 +137,10 @@ class NoUncountedMemberChecker
Os << " in ";
printQuotedQualifiedName(Os, ClassCXXRD);
Os << " is a "
- << (isa(MemberType) ? "raw pointer" : "reference")
- << " to ref-countable type ";
+ << (isa(MemberType) ? "raw pointer" :
@@ -146,13 +149,67 @@ class NoUncountedMemberChecker
BR->emitReport(std::move(Report));
haoNoQ wrote:
`setDeclWithIssue()` goes into a different PR right?
https://github.com/llvm/llvm-project/pull/108352
___
cfe-
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/108352
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -146,13 +149,67 @@ class NoUncountedMemberChecker
BR->emitReport(std::move(Report));
}
};
+
+class NoUncountedMemberChecker final : public RawPtrRefMemberChecker {
haoNoQ wrote:
Yes this is a perfectly valid way to reuse code here!
https://github.com
https://github.com/haoNoQ approved this pull request.
LGTM!! I've got nitpicks but none of them are substantial enough to block.
We've figured out the ObjC thing offline right?
https://github.com/llvm/llvm-project/pull/108352
___
cfe-commits mailing l
@@ -53,48 +53,49 @@ hasPublicMethodInBase(const CXXBaseSpecifier *Base, const
char *NameToMatch) {
return hasPublicMethodInBaseClass(R, NameToMatch) ? R : nullptr;
}
-std::optional isRefCountable(const CXXRecordDecl* R)
-{
+std::optional isSmartPtrCompatible(const CXXRecord
@@ -102,12 +102,13 @@ class UncountedCallArgsChecker
// if ((*P)->hasAttr())
// continue;
-const auto *ArgType = (*P)->getType().getTypePtrOrNull();
-if (!ArgType)
+QualType ArgType = (*P)->getType().getCanonicalType();
+const a
https://github.com/haoNoQ approved this pull request.
Ah classic! LGTM!
https://github.com/llvm/llvm-project/pull/109393
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/109393
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ approved this pull request.
LGTM thank you so much!
https://github.com/llvm/llvm-project/pull/109389
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -134,18 +135,25 @@ class UncountedLocalVarsChecker
bool shouldVisitTemplateInstantiations() const { return true; }
bool shouldVisitImplicitCode() const { return false; }
+ bool TraverseDecl(Decl *D) {
+llvm::SaveAndRestore SavedDecl(DeclWithIssue);
@@ -56,12 +62,16 @@ class UncountedCallArgsChecker
bool TraverseClassTemplateDecl(ClassTemplateDecl *Decl) {
if (isRefType(safeGetName(Decl)))
return true;
-return RecursiveASTVisitor::TraverseClassTemplateDecl(
-Decl);
+retur
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/109389
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -784,12 +786,12 @@ AST_MATCHER_P(CallExpr, hasUnsafePrintfStringArg,
return false; // possibly some user-defined printf function
ASTContext &Ctx = Finder->getASTContext();
- QualType FristParmTy = FD->getParamDecl(0)->getType();
+ QualType FirstParmTy = FD->getParam
https://github.com/haoNoQ approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/109496
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/109496
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -119,6 +119,11 @@ template
ensureOnMainThread([this] {
delete static_cast(this);
});
+} else if constexpr (destructionThread ==
DestructionThread::MainRunLoop) {
+auto deleteThis = [this] {
haoNoQ
@@ -84,13 +84,22 @@ class DerefFuncDeleteExprVisitor
E = E->IgnoreParenCasts();
if (auto *TempE = dyn_cast(E))
E = TempE->getSubExpr();
+E = E->IgnoreParenCasts();
+if (auto *Ref = dyn_cast(E)) {
+ if (auto *Decl = Ref->getDecl()) {
+if (auto
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/108656
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -119,6 +119,11 @@ template
ensureOnMainThread([this] {
delete static_cast(this);
});
+} else if constexpr (destructionThread ==
DestructionThread::MainRunLoop) {
+auto deleteThis = [this] {
haoNoQ
@@ -84,13 +84,22 @@ class DerefFuncDeleteExprVisitor
E = E->IgnoreParenCasts();
if (auto *TempE = dyn_cast(E))
E = TempE->getSubExpr();
+E = E->IgnoreParenCasts();
+if (auto *Ref = dyn_cast(E)) {
+ if (auto *Decl = Ref->getDecl()) {
+if (auto
https://github.com/haoNoQ approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/108656
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
haoNoQ wrote:
I'm also somewhat terrified of returning C++ objects from ObjC methods by
value, ever since I learned that when you call an ObjC method on a nil it
returns a _zero-initialized_ object without calling a constructor on it.
https://github.com/llvm/llvm-project/pull/108669
__
https://github.com/haoNoQ approved this pull request.
Yeah sounds about right!
The property syntax is confusing, I don't have enough expertise to confirm that
`getResultExpr()` is the right solution so I think we should keep trying and
incrementally figuring out what's going on.
Setters proba
https://github.com/haoNoQ approved this pull request.
LGTM!
https://github.com/llvm/llvm-project/pull/108257
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -143,6 +143,16 @@ bool isReturnValueRefCounted(const clang::FunctionDecl *F)
{
return false;
}
+std::optional isUncounted(const QualType T) {
+ if (auto *Subst = dyn_cast(T)) {
+if (auto *Decl = Subst->getAssociatedDecl()) {
+ if (isRefType(safeGetName(Decl)))
https://github.com/haoNoQ approved this pull request.
Aha ok LGTM!
https://github.com/llvm/llvm-project/pull/108184
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/108184
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/108184
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/108184
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -143,6 +143,16 @@ bool isReturnValueRefCounted(const clang::FunctionDecl *F)
{
return false;
}
+std::optional isUncounted(const clang::QualType T) {
haoNoQ wrote:
`clang::` is redundant because you're in `using namespace clang`.
https://github.com/llvm
https://github.com/haoNoQ approved this pull request.
https://github.com/llvm/llvm-project/pull/108167
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ approved this pull request.
Aha great LGTM!
https://github.com/llvm/llvm-project/pull/107676
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -67,6 +68,48 @@ class DerefFuncDeleteExprVisitor
const Decl *D = CE->getCalleeDecl();
if (D && D->hasBody())
return VisitBody(D->getBody());
+else {
+ auto name = safeGetName(D);
+ if (name == "ensureOnMainThread" || name == "ensureOnMainRunLoop")
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/107676
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -67,6 +68,15 @@ class DerefFuncDeleteExprVisitor
const Decl *D = CE->getCalleeDecl();
if (D && D->hasBody())
return VisitBody(D->getBody());
+else if (!VisitLambdaBody) {
+ for (unsigned i = 0; i < CE->getNumArgs(); ++i) {
+auto *Arg = CE->getA
https://github.com/haoNoQ commented:
Aha makes sense!
Looks like you're putting no restrictions on what the opaque function is. This
may cause some false negatives but it's probably ultimately ok, but it might be
a good idea to confirm.
https://github.com/llvm/llvm-project/pull/107676
___
haoNoQ wrote:
`-Wunsafe-buffer-usage` is theoretically possible to use in C but it involves a
lot of `#pragma clang unsafe_buffer_usage` to annotate and encapsulate every
unsafe buffer operation. So it's impractical but we aren't disabling it because
that'd be an unnecessary restriction and it
@@ -443,6 +443,426 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
return false;
}
+AST_MATCHER_P(CallExpr, hasNumArgs, unsigned, Num) {
+ return Node.getNumArgs() == Num;
+}
+
+namespace libc_func_matchers {
+// Under `libc_func_matchers`, define a set of matche
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/101583
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ approved this pull request.
I think this is good to go, LGTM!!
https://github.com/llvm/llvm-project/pull/101583
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commit
haoNoQ wrote:
#106439
https://github.com/llvm/llvm-project/pull/102226
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
haoNoQ wrote:
Oh that's just a whitespace change. Would you like me to make a manual PR or
were you looking into it anyway?
https://github.com/llvm/llvm-project/pull/102226
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org
haoNoQ wrote:
/cherry-pick 030ee841a9c9fbbd6e7c001e751737381da01f7b
https://github.com/llvm/llvm-project/pull/102226
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
haoNoQ wrote:
/cherry-pick 3ddd7a6df3ef85cbfe3f5fc0294817638275d4df
https://github.com/llvm/llvm-project/pull/102226
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ milestoned
https://github.com/llvm/llvm-project/pull/102226
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
haoNoQ wrote:
Yeah I think we really gotta cherry-pick this revert, because failing tests on
release branches are somewhat scary (cf.
https://green.lab.llvm.org/job/llvm.org/job/clang-stage1-RA-release-branch/69/console).
I don't know how it's usually done but let me try to push some buttons,
@@ -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
@@ -0,0 +1,101 @@
+// RUN: %clang_cc1 -std=c++20 -Wno-all -Wunsafe-buffer-usage \
+// RUN:-verify %s
+
+typedef struct {} FILE;
+void memcpy();
+void __asan_memcpy();
+void strcpy();
+void strcpy_s();
+void wcscpy_s();
+unsigned strlen( const char* str );
+int fprintf(
@@ -443,6 +449,396 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
return false;
}
+AST_MATCHER_P(CallExpr, hasNumArgs, unsigned, Num) {
+ return Node.getNumArgs() == Num;
+}
+
+namespace libc_func_matchers {
+// Under `libc_func_matchers`, define a set of matche
https://github.com/haoNoQ commented:
Mostly LGTM! I don't have major concerns.
https://github.com/llvm/llvm-project/pull/101583
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -12383,6 +12383,13 @@ def warn_unsafe_buffer_operation : Warning<
"%select{unsafe pointer operation|unsafe pointer arithmetic|"
"unsafe buffer access|function introduces unsafe buffer manipulation|unsafe
invocation of span::data}0">,
InGroup, DefaultIgnore;
+def warn_
@@ -12383,6 +12383,13 @@ def warn_unsafe_buffer_operation : Warning<
"%select{unsafe pointer operation|unsafe pointer arithmetic|"
"unsafe buffer access|function introduces unsafe buffer manipulation|unsafe
invocation of span::data}0">,
InGroup, DefaultIgnore;
+def warn_
@@ -1025,6 +1421,92 @@ class DataInvocationGadget : public WarningGadget {
DeclUseList getClaimedVarUseSites() const override { return {}; }
};
+class UnsafeLibcFunctionCallGadget : public WarningGadget {
+ const CallExpr *const Call;
+ constexpr static const char *const T
@@ -443,6 +449,396 @@ AST_MATCHER(ArraySubscriptExpr, isSafeArraySubscript) {
return false;
}
+AST_MATCHER_P(CallExpr, hasNumArgs, unsigned, Num) {
+ return Node.getNumArgs() == Num;
+}
+
+namespace libc_func_matchers {
+// Under `libc_func_matchers`, define a set of matche
https://github.com/haoNoQ edited
https://github.com/llvm/llvm-project/pull/101583
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
1 - 100 of 1239 matches
Mail list logo