================
@@ -2190,16 +2271,25 @@ class UnsafeBufferUsageAttrGadget : public
WarningGadget {
static bool matches(const Stmt *S, const ASTContext &Ctx,
MatchResult &Result) {
if (auto *CE = dyn_cast<CallExpr>(S)) {
- if (CE->getDirectCallee() &&
- CE->getDirectCallee()->hasAttr<UnsafeBufferUsageAttr>()) {
- Result.addNode(OpTag, DynTypedNode::create(*CE));
- return true;
+ if (const auto *Callee = CE->getDirectCallee()) {
+ if (const auto *Attr = Callee->getAttr<UnsafeBufferUsageAttr>()) {
+ // Skip if this is annotated with
+ // `[[clang::unsafe_buffer_usage("container")]]` as that case is
+ // handled by UnsafeBufferUsageContainerAttrGadget.
+ if (Attr->getCategory() == "container")
----------------
pl98 wrote:
Good point, updated the code.
https://github.com/llvm/llvm-project/pull/227108
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits