Author: Haojian Wu
Date: 2024-03-06T15:55:41+01:00
New Revision: fec471649fffaa3ec44e17801e5c9605825e58bb

URL: 
https://github.com/llvm/llvm-project/commit/fec471649fffaa3ec44e17801e5c9605825e58bb
DIFF: 
https://github.com/llvm/llvm-project/commit/fec471649fffaa3ec44e17801e5c9605825e58bb.diff

LOG: [clang] Use getDefaultArgRange instead of getDefaultArg to retrieve the 
(#79296)

source location in` AliasTemplateDeductionGuideTransform`.

I don't have a reproducible testcase, but this should be a safe and
non-functional change. We have checked the `hasDefaultArg` before
calling `getDefaultArg()`, but `hasDefaultArg` allows
unparsed/uninstantiated default arg which is prohibited in
`getDefaultArg()`.

Since we're only interested in the source location, we switch to use
`getDefaultArgRange()` API.

Added: 
    

Modified: 
    clang/lib/Sema/SemaTemplate.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index df20f83ac8afe6..7e91815c2d52a8 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -2598,7 +2598,7 @@ struct ConvertConstructorToDeductionGuideTransform {
       // placeholder to indicate there is a default argument.
       QualType ParamTy = NewDI->getType();
       NewDefArg = new (SemaRef.Context)
-          OpaqueValueExpr(OldParam->getDefaultArg()->getBeginLoc(),
+          OpaqueValueExpr(OldParam->getDefaultArgRange().getBegin(),
                           ParamTy.getNonLValueExprType(SemaRef.Context),
                           ParamTy->isLValueReferenceType()   ? VK_LValue
                           : ParamTy->isRValueReferenceType() ? VK_XValue


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to