[PATCH] D114688: [Clang] Add __builtin_elementwise_ceil

Florian Hahn via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 1 08:19:08 PST 2021


fhahn added inline comments.


================
Comment at: clang/lib/Sema/SemaChecking.cpp:16727-16728
   QualType TyA = A.get()->getType();
-  if (checkMathBuiltinElementType(*this, ArgLoc, TyA))
+  if (checkMathBuiltinElementType(*this, ArgLoc, TyA) ||
+      ExtraCheck(TyA, ArgLoc))
     return true;
----------------
aaron.ballman wrote:
> In some ways, it's a not really ideal that we split the type checking like this. `SemaBuiltinElementwiseMathOneArg()` checks some type validity and the caller checks some more type validity, so there's no one location to know what types are actually expected for any given builtin calling this.
> 
> Would it be reasonable to instead hoist all the type checking code out of `SemaBuiltinElementwiseMathOneArg()` and not pass in a functor to it, but instead check the `CallExpr` type after the call returns? We could also fix up the function name to be a bit less nonsensical at the same time, like renaming it to `PrepareBuiltinElementwiseMathOneArgCall()` or something along those lines?
> Would it be reasonable to instead hoist all the type checking code out of SemaBuiltinElementwiseMathOneArg() and not pass in a functor to it, but instead check the CallExpr type after the call returns?

Yeah that sounds better!


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

https://reviews.llvm.org/D114688



More information about the cfe-commits mailing list