[PATCH] D149514: Check if First argument in _builtin_assume_aligned_ is of pointer type

Rishabh Bali via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 29 02:58:49 PDT 2023


Ris-Bali updated this revision to Diff 518153.
Ris-Bali added a comment.

Clang-format fix


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149514/new/

https://reviews.llvm.org/D149514

Files:
  clang/lib/Sema/SemaChecking.cpp


Index: clang/lib/Sema/SemaChecking.cpp
===================================================================
--- clang/lib/Sema/SemaChecking.cpp
+++ clang/lib/Sema/SemaChecking.cpp
@@ -7981,6 +7981,14 @@
         DefaultFunctionArrayLvalueConversion(FirstArg);
     if (FirstArgResult.isInvalid())
       return true;
+    Qualtype firstArgType = FirstArgResult.get()->getType();
+
+    if (!firstArgType->isAnyPointerType()) {
+      Qualtype expectedType = Context.getPointerType(firstArgType);
+      return Diag(FirstArg->getBeginLoc(),
+                  diag::err_typecheck_convert_incompatible)
+             << firstArgType << expectedType << 1 << 0 << 0;
+    }
     TheCall->setArg(0, FirstArgResult.get());
   }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149514.518153.patch
Type: text/x-patch
Size: 723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230429/1cd94f81/attachment.bin>


More information about the cfe-commits mailing list