]> granicus.if.org Git - clang/commitdiff
Eliminate an unnecessary dance where we tried to cope with the lack of
authorDouglas Gregor <dgregor@apple.com>
Wed, 5 Jan 2011 23:16:57 +0000 (23:16 +0000)
committerDouglas Gregor <dgregor@apple.com>
Wed, 5 Jan 2011 23:16:57 +0000 (23:16 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122927 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/TreeTransform.h

index 3bd81561e0d70ff3f4695c1e641696be9d86de76..dc87c5bbd2aab24ead5adff2f212f62240f5700b 100644 (file)
@@ -3402,26 +3402,16 @@ bool TreeTransform<Derived>::
         llvm::SmallVector<UnexpandedParameterPack, 2> Unexpanded;
 
         // Find the parameter packs that could be expanded.
-        SourceLocation EllipsisLoc;
-        SourceRange PatternRange;
-        if (OldParm->getTypeSourceInfo()) {
-          TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
-          PackExpansionTypeLoc ExpansionTL = cast<PackExpansionTypeLoc>(TL);
-          TypeLoc Pattern = ExpansionTL.getPatternLoc();
-          EllipsisLoc = ExpansionTL.getEllipsisLoc();
-          PatternRange = Pattern.getSourceRange();
-          SemaRef.collectUnexpandedParameterPacks(Pattern, Unexpanded);
-        } else {
-          SemaRef.collectUnexpandedParameterPacks(
-                    cast<PackExpansionType>(OldParm->getType())->getPattern(), 
-                                                  Unexpanded);
-          EllipsisLoc = OldParm->getLocation();
-        }
+        TypeLoc TL = OldParm->getTypeSourceInfo()->getTypeLoc();
+        PackExpansionTypeLoc ExpansionTL = cast<PackExpansionTypeLoc>(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)) {