https://github.com/danakj closed https://github.com/llvm/llvm-project/pull/91777
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
@@ -1315,9 +1374,9 @@ class DerefSimplePtrArithFixableGadget : public
FixableGadget {
virtual std::optional
getFixits(const FixitStrategy ) const final;
-
- // TODO remove this method from FixableGadget interface
haoNoQ wrote:
Right!
@@ -1315,9 +1374,9 @@ class DerefSimplePtrArithFixableGadget : public
FixableGadget {
virtual std::optional
getFixits(const FixitStrategy ) const final;
-
- // TODO remove this method from FixableGadget interface
danakj wrote:
Also it's slightly
https://github.com/danakj updated
https://github.com/llvm/llvm-project/pull/91777
>From 8b318dadac6d0ec53b5d26461edfe19a391845ec Mon Sep 17 00:00:00 2001
From: danakj
Date: Fri, 10 May 2024 13:31:17 -0400
Subject: [PATCH 1/4] Respect the [[clang::unsafe_buffer_usage]] attribute for
https://github.com/danakj updated
https://github.com/llvm/llvm-project/pull/91777
>From 8b318dadac6d0ec53b5d26461edfe19a391845ec Mon Sep 17 00:00:00 2001
From: danakj
Date: Fri, 10 May 2024 13:31:17 -0400
Subject: [PATCH 1/4] Respect the [[clang::unsafe_buffer_usage]] attribute for
@@ -2856,7 +2916,7 @@ getFixIts(FixableGadgetSets , const
FixitStrategy ,
}
#ifndef NDEBUG
Handler.addDebugNoteForVar(
- VD, F->getBaseStmt()->getBeginLoc(),
+ VD, F->getSourceLoc(),
danakj wrote:
I will leave this for a
@@ -1315,9 +1374,9 @@ class DerefSimplePtrArithFixableGadget : public
FixableGadget {
virtual std::optional
getFixits(const FixitStrategy ) const final;
-
- // TODO remove this method from FixableGadget interface
danakj wrote:
This one used to return
@@ -2856,7 +2916,7 @@ getFixIts(FixableGadgetSets , const
FixitStrategy ,
}
#ifndef NDEBUG
Handler.addDebugNoteForVar(
- VD, F->getBaseStmt()->getBeginLoc(),
+ VD, F->getSourceLoc(),
haoNoQ wrote:
Hmm right, this is literally
@@ -1315,9 +1374,9 @@ class DerefSimplePtrArithFixableGadget : public
FixableGadget {
virtual std::optional
getFixits(const FixitStrategy ) const final;
-
- // TODO remove this method from FixableGadget interface
haoNoQ wrote:
Still relevant tbh.
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/91777
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ approved this pull request.
Aha ok everything makes sense now! I think this is good to go so LGTM! Let me
see the other PR too.
https://github.com/llvm/llvm-project/pull/91777
___
cfe-commits mailing list
@@ -921,10 +937,55 @@ class UnsafeBufferUsageAttrGadget : public WarningGadget {
}
static Matcher matcher() {
-return
stmt(callExpr(callee(functionDecl(hasAttr(attr::UnsafeBufferUsage
-.bind(OpTag));
+auto HasUnsafeFnDecl =
+
@@ -2856,7 +2916,7 @@ getFixIts(FixableGadgetSets , const
FixitStrategy ,
}
#ifndef NDEBUG
Handler.addDebugNoteForVar(
- VD, F->getBaseStmt()->getBeginLoc(),
+ VD, F->getSourceLoc(),
danakj wrote:
Yeah, this is the only callsite
@@ -2295,6 +2292,23 @@ class UnsafeBufferUsageReporter : public
UnsafeBufferUsageHandler {
}
}
+ void handleUnsafeOperationInContainer(const Stmt *Operation,
+bool IsRelatedToDecl,
+
danakj wrote:
> > https://github.com/llvm/llvm-project/blob/2ff43ce87e66d9324370e35ea6743ef57400c76e/clang/lib/Analysis/UnsafeBufferUsage.cpp#L1373-L1374
> >
> > These assert that exactly one gadget matched. I think it's kinda worthwhile
> > keeping the warnings independent too, so I don't see
https://github.com/danakj updated
https://github.com/llvm/llvm-project/pull/91777
>From 8b318dadac6d0ec53b5d26461edfe19a391845ec Mon Sep 17 00:00:00 2001
From: danakj
Date: Fri, 10 May 2024 13:31:17 -0400
Subject: [PATCH 1/3] Respect the [[clang::unsafe_buffer_usage]] attribute for
@@ -2295,6 +2292,23 @@ class UnsafeBufferUsageReporter : public
UnsafeBufferUsageHandler {
}
}
+ void handleUnsafeOperationInContainer(const Stmt *Operation,
+bool IsRelatedToDecl,
+
@@ -921,10 +937,55 @@ class UnsafeBufferUsageAttrGadget : public WarningGadget {
}
static Matcher matcher() {
-return
stmt(callExpr(callee(functionDecl(hasAttr(attr::UnsafeBufferUsage
-.bind(OpTag));
+auto HasUnsafeFnDecl =
+
@@ -2856,7 +2916,7 @@ getFixIts(FixableGadgetSets , const
FixitStrategy ,
}
#ifndef NDEBUG
Handler.addDebugNoteForVar(
- VD, F->getBaseStmt()->getBeginLoc(),
+ VD, F->getSourceLoc(),
haoNoQ wrote:
This is the only place where we
https://github.com/haoNoQ edited https://github.com/llvm/llvm-project/pull/91777
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/haoNoQ commented:
> https://github.com/llvm/llvm-project/blob/2ff43ce87e66d9324370e35ea6743ef57400c76e/clang/lib/Analysis/UnsafeBufferUsage.cpp#L1373-L1374
>
> These assert that exactly one gadget matched. I think it's kinda worthwhile
> keeping the warnings independent too,
danakj wrote:
> Hi! Thank you for digging into this! Sorry for the delay.
>
> > The new UnsafeBufferUsageCtorAttrGadget gadget explicitly avoids matching
> > against the std::span(ptr, size) constructor because that is handled by
> > SpanTwoParamConstructorGadget and we never want two gadgets
haoNoQ wrote:
Hi! Thank you for digging into this! Sorry for the delay.
> The new UnsafeBufferUsageCtorAttrGadget gadget explicitly avoids matching
> against the std::span(ptr, size) constructor because that is handled by
> SpanTwoParamConstructorGadget and we never want two gadgets to match
https://github.com/danakj edited https://github.com/llvm/llvm-project/pull/91777
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/danakj updated
https://github.com/llvm/llvm-project/pull/91777
>From 8b318dadac6d0ec53b5d26461edfe19a391845ec Mon Sep 17 00:00:00 2001
From: danakj
Date: Fri, 10 May 2024 13:31:17 -0400
Subject: [PATCH 1/2] Respect the [[clang::unsafe_buffer_usage]] attribute for
https://github.com/danakj updated
https://github.com/llvm/llvm-project/pull/91777
>From 8b318dadac6d0ec53b5d26461edfe19a391845ec Mon Sep 17 00:00:00 2001
From: danakj
Date: Fri, 10 May 2024 13:31:17 -0400
Subject: [PATCH] Respect the [[clang::unsafe_buffer_usage]] attribute for
constructors
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 317e6ff6290c4c3065cb79c3eaf52f171e40cdfd
d7694d70393fd49792470147c7ca136fd33f194e --
https://github.com/danakj updated
https://github.com/llvm/llvm-project/pull/91777
>From 1c835f4cc77823360762b8e53e2bbfe027c977cf Mon Sep 17 00:00:00 2001
From: danakj
Date: Fri, 10 May 2024 13:31:17 -0400
Subject: [PATCH] Respect the [[clang::unsafe_buffer_usage]] attribute for
constructors
llvmbot wrote:
@llvm/pr-subscribers-clang-analysis
Author: Dana Jansens (danakj)
Changes
The -Wunsafe-buffer-usage warning should fire on any call to a function
annotated with [[clang::unsafe_buffer_usage]], however it omitted calls to
constructors, since the expression is a
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Dana Jansens (danakj)
Changes
The -Wunsafe-buffer-usage warning should fire on any call to a function
annotated with [[clang::unsafe_buffer_usage]], however it omitted calls to
constructors, since the expression is a CXXConstructExpr
danakj wrote:
cc: @haoNoQ
https://github.com/llvm/llvm-project/pull/91777
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/danakj created
https://github.com/llvm/llvm-project/pull/91777
The -Wunsafe-buffer-usage warning should fire on any call to a function
annotated with [[clang::unsafe_buffer_usage]], however it omitted calls to
constructors, since the expression is a CXXConstructExpr which
32 matches
Mail list logo