From f6272cd7e9e066b92cd3486bff1f86f855182100 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 5 Jan 2011 23:16:57 +0000 Subject: [PATCH] Eliminate an unnecessary dance where we tried to cope with the lack of TypeSourceInfo when transforming a function parameter. The callees of this routine already assume that TypeSourceInfo will be present, and we want to always be sure that it exists. llvm-svn: 122927 --- clang/lib/Sema/TreeTransform.h | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/clang/lib/Sema/TreeTransform.h b/clang/lib/Sema/TreeTransform.h index 3bd81561e0d7..dc87c5bbd2aa 100644 --- a/clang/lib/Sema/TreeTransform.h +++ b/clang/lib/Sema/TreeTransform.h @@ -3402,26 +3402,16 @@ bool TreeTransform:: llvm::SmallVector Unexpanded; // Find the parameter packs that could be expanded. - SourceLocation EllipsisLoc; - SourceRange PatternRange; - if (OldParm->getTypeSourceInfo()) { - TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc(); - PackExpansionTypeLoc ExpansionTL = cast(TL); - TypeLoc Pattern = ExpansionTL.getPatternLoc(); - EllipsisLoc = ExpansionTL.getEllipsisLoc(); - PatternRange = Pattern.getSourceRange(); - SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded); - } else { - SemaRef.collectUnexpandedParameterPacks( - cast(OldParm->getType())->getPattern(), - Unexpanded); - EllipsisLoc = OldParm->getLocation(); - } + TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc(); + PackExpansionTypeLoc ExpansionTL = cast(TL); + TypeLoc Pattern = ExpansionTL.getPatternLoc(); + SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded); // Determine whether we should expand the parameter packs. bool ShouldExpand = false; unsigned NumExpansions = 0; - if (getDerived().TryExpandParameterPacks(EllipsisLoc, PatternRange, + if (getDerived().TryExpandParameterPacks(ExpansionTL.getEllipsisLoc(), + Pattern.getSourceRange(), Unexpanded.data(), Unexpanded.size(), ShouldExpand, NumExpansions)) {