[clang] [Clang] Optimize some `getBeginLoc` implementations (PR #141058)

via cfe-commits cfe-commits at lists.llvm.org
Thu May 22 07:11:04 PDT 2025


================
@@ -542,7 +542,8 @@ bool SemaOpenCL::checkBuiltinToAddr(unsigned BuiltinID, CallExpr *Call) {
   auto RT = Call->getArg(0)->getType();
   if (!RT->isPointerType() ||
       RT->getPointeeType().getAddressSpace() == LangAS::opencl_constant) {
-    Diag(Call->getBeginLoc(), diag::err_opencl_builtin_to_addr_invalid_arg)
+    Diag(Call->getArg(0)->getBeginLoc(),
----------------
cor3ntin wrote:

Because it's a builtin the function does not exist. This is why we had some of the recovery mechanism in getBeginLoc

https://github.com/llvm/llvm-project/pull/141058


More information about the cfe-commits mailing list