[lld] Correct end for the CastOperation.OpRange (PR #69480)

Botond István Horváth via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 03:27:54 PDT 2023


https://github.com/HoBoIs updated https://github.com/llvm/llvm-project/pull/69480

>From f75c2e75042d6d8f5a093967a56f3f59d7e541f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Botond=20Istv=C3=A1n=20Horv=C3=A1th?=
 <56926027+HoBoIs at users.noreply.github.com>
Date: Wed, 18 Oct 2023 18:05:01 +0200
Subject: [PATCH] Correct end for the CastOperation.OpRange

Set the correct end for the CastOperation.OpRange in CXXFunctionalCastExpr. Now it is the closing bracket's location instead of the parameter's location.
---
 clang/lib/Sema/SemaCast.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Sema/SemaCast.cpp b/clang/lib/Sema/SemaCast.cpp
index 98b5879456e2175..87e6d1a2198fcea 100644
--- a/clang/lib/Sema/SemaCast.cpp
+++ b/clang/lib/Sema/SemaCast.cpp
@@ -3362,7 +3362,7 @@ ExprResult Sema::BuildCXXFunctionalCastExpr(TypeSourceInfo *CastTypeInfo,
   assert(LPLoc.isValid() && "List-initialization shouldn't get here.");
   CastOperation Op(*this, Type, CastExpr);
   Op.DestRange = CastTypeInfo->getTypeLoc().getSourceRange();
-  Op.OpRange = SourceRange(Op.DestRange.getBegin(), CastExpr->getEndLoc());
+  Op.OpRange = SourceRange(Op.DestRange.getBegin(), RPLoc);
 
   Op.CheckCXXCStyleCast(/*FunctionalCast=*/true, /*ListInit=*/false);
   if (Op.SrcExpr.isInvalid())



More information about the llvm-commits mailing list