================
@@ -1500,6 +1500,36 @@ void 
Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
     break;
   }
 
+  case Builtin::BIsend:
+  case Builtin::BIsendto: {
+    unsigned ExpectedArgs = BuiltinID == Builtin::BIsend ? 4 : 6;
+    if (TheCall->getNumArgs() != ExpectedArgs ||
+        !TheCall->getArg(0)->getType()->isIntegerType() ||
+        !TheCall->getArg(1)->getType()->isPointerType() ||
+        !TheCall->getArg(2)->getType()->isIntegerType() ||
+        !TheCall->getArg(3)->getType()->isIntegerType())
+      return;
+    if (BuiltinID == Builtin::BIsendto) {
+      QualType AddrTy = TheCall->getArg(4)->getType();
+      const RecordDecl *UnionRD = AddrTy->getAsRecordDecl();
+      if (!UnionRD || !UnionRD->isUnion() ||
+          !UnionRD->hasAttr<TransparentUnionAttr>()) {
+        QualType AddrPointeeTy = AddrTy->getPointeeType();
+        if (AddrPointeeTy.isNull())
+          return;
----------------
venk-ks wrote:

Done in f8fb369b8146: unwrapped  to  first so the  pointee check handles both 
cases uniformly.

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

Reply via email to