Skip to content

Commit

Permalink
[clang] Use getDefaultArgRange instead of getDefaultArg to retrieve t…
Browse files Browse the repository at this point in the history
…he (llvm#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.
  • Loading branch information
hokein authored Mar 6, 2024
1 parent 4490003 commit fec4716
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaTemplate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fec4716

Please sign in to comment.