[clang] Clean up array allocation logic in Sema::BuildCXXNew (PR #186617)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 15 00:52:14 PDT 2026
================
@@ -2199,12 +2200,12 @@ ExprResult Sema::BuildCXXNew(SourceRange Range, bool UseGlobal,
auto *Deduced = AllocType->getContainedDeducedType();
if (Deduced && !Deduced->isDeduced() &&
isa<DeducedTemplateSpecializationType>(Deduced)) {
- if (ArraySize)
- return ExprError(
- Diag(*ArraySize ? (*ArraySize)->getExprLoc() : TypeRange.getBegin(),
- diag::err_deduced_class_template_compound_type)
- << /*array*/ 2
- << (*ArraySize ? (*ArraySize)->getSourceRange() : TypeRange));
+ if (ArraySize) {
+ return ExprError(Diag(ArraySize.getExprLocOr(TypeRange.getBegin()),
+ diag::err_deduced_class_template_compound_type)
+ << /*array*/ 2
+ << ArraySize.getExprSourceRangeOr(TypeRange));
+ }
----------------
ojhunt wrote:
e.g this change is only needed for the API change
https://github.com/llvm/llvm-project/pull/186617
More information about the cfe-commits
mailing list