[cfe-commits] r122927 - /cfe/trunk/lib/Sema/TreeTransform.h

Douglas Gregor dgregor at apple.com
Wed Jan 5 15:16:57 PST 2011


Author: dgregor
Date: Wed Jan  5 17:16:57 2011
New Revision: 122927

URL: http://llvm.org/viewvc/llvm-project?rev=122927&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/Sema/TreeTransform.h

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=122927&r1=122926&r2=122927&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Wed Jan  5 17:16:57 2011
@@ -3402,26 +3402,16 @@
         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)) {





More information about the cfe-commits mailing list