================
@@ -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")
----------------
ziqingluo-90 wrote:

Is there a way to check that `Attr` has no arguments? I was thinking that if we 
add another category, this line of code will need to change again.

https://github.com/llvm/llvm-project/pull/227108
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to