[clang] Respect the [[clang::unsafe_buffer_usage]] attribute for constructors (PR #91777)
via cfe-commits
cfe-commits at lists.llvm.org
Fri May 10 10:47:07 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 317e6ff6290c4c3065cb79c3eaf52f171e40cdfd d7694d70393fd49792470147c7ca136fd33f194e -- clang/include/clang/Analysis/Analyses/UnsafeBufferUsage.h clang/lib/Analysis/UnsafeBufferUsage.cpp clang/lib/Sema/AnalysisBasedWarnings.cpp clang/test/SemaCXX/warn-unsafe-buffer-usage-function-attr.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Analysis/UnsafeBufferUsage.cpp b/clang/lib/Analysis/UnsafeBufferUsage.cpp
index 21dea24389..4f8b3fdd42 100644
--- a/clang/lib/Analysis/UnsafeBufferUsage.cpp
+++ b/clang/lib/Analysis/UnsafeBufferUsage.cpp
@@ -716,8 +716,8 @@ public:
}
void handleUnsafeOperation(UnsafeBufferUsageHandler &Handler,
- bool IsRelatedToDecl,
- ASTContext &Ctx) const override {
+ bool IsRelatedToDecl,
+ ASTContext &Ctx) const override {
Handler.handleUnsafeOperation(PA, IsRelatedToDecl, Ctx);
}
SourceLocation getSourceLoc() const override { return PA->getBeginLoc(); }
@@ -939,8 +939,8 @@ public:
static Matcher matcher() {
auto HasUnsafeFnDecl =
callee(functionDecl(hasAttr(attr::UnsafeBufferUsage)));
- //return stmt(anyOf(callExpr(HasUnsafeFnDecl).bind(OpTag),
- // cxxOperatorCallExpr(HasUnsafeFnDecl).bind(OpTag)));
+ // return stmt(anyOf(callExpr(HasUnsafeFnDecl).bind(OpTag),
+ // cxxOperatorCallExpr(HasUnsafeFnDecl).bind(OpTag)));
return stmt(callExpr(HasUnsafeFnDecl).bind(OpTag));
}
@@ -3311,8 +3311,8 @@ void clang::checkUnsafeBufferUsage(const Decl *D,
Tracker, Handler, VarGrpMgr);
for (const auto &G : UnsafeOps.noVar) {
- G->handleUnsafeOperation(Handler, /*IsRelatedToDecl=*/false,
- D->getASTContext());
+ G->handleUnsafeOperation(Handler, /*IsRelatedToDecl=*/false,
+ D->getASTContext());
}
for (const auto &[VD, WarningGadgets] : UnsafeOps.byVar) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/91777
More information about the cfe-commits
mailing list