[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 03:35:08 PDT 2023


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

QualType error 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.518156.patch
Type: text/x-patch
Size: 723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230429/bf2f5446/attachment.bin>


More information about the cfe-commits mailing list