[llvm] r185507 - Return SmallVectorImpl& instead of SmallVector& in a couple places to avoid having to specify the vector size in multiple places.

Craig Topper craig.topper at gmail.com
Tue Jul 2 21:30:58 PDT 2013


Author: ctopper
Date: Tue Jul  2 23:30:58 2013
New Revision: 185507

URL: http://llvm.org/viewvc/llvm-project?rev=185507&view=rev
Log:
Return SmallVectorImpl& instead of SmallVector& in a couple places to avoid having to specify the vector size in multiple places.

Modified:
    llvm/trunk/include/llvm/CodeGen/LexicalScopes.h
    llvm/trunk/lib/CodeGen/LexicalScopes.cpp

Modified: llvm/trunk/include/llvm/CodeGen/LexicalScopes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/LexicalScopes.h?rev=185507&r1=185506&r2=185507&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/LexicalScopes.h (original)
+++ llvm/trunk/include/llvm/CodeGen/LexicalScopes.h Tue Jul  2 23:30:58 2013
@@ -166,13 +166,13 @@ public:
   virtual ~LexicalScope() {}
 
   // Accessors.
-  LexicalScope *getParent() const               { return Parent; }
-  const MDNode *getDesc() const                 { return Desc; }
-  const MDNode *getInlinedAt() const            { return InlinedAtLocation; }
-  const MDNode *getScopeNode() const            { return Desc; }
-  bool isAbstractScope() const                  { return AbstractScope; }
-  SmallVector<LexicalScope *, 4> &getChildren() { return Children; }
-  SmallVector<InsnRange, 4> &getRanges()        { return Ranges; }
+  LexicalScope *getParent() const                { return Parent; }
+  const MDNode *getDesc() const                  { return Desc; }
+  const MDNode *getInlinedAt() const             { return InlinedAtLocation; }
+  const MDNode *getScopeNode() const             { return Desc; }
+  bool isAbstractScope() const                   { return AbstractScope; }
+  SmallVectorImpl<LexicalScope *> &getChildren() { return Children; }
+  SmallVectorImpl<InsnRange> &getRanges()        { return Ranges; }
 
   /// addChild - Add a child scope.
   void addChild(LexicalScope *S) { Children.push_back(S); }

Modified: llvm/trunk/lib/CodeGen/LexicalScopes.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LexicalScopes.cpp?rev=185507&r1=185506&r2=185507&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LexicalScopes.cpp (original)
+++ llvm/trunk/lib/CodeGen/LexicalScopes.cpp Tue Jul  2 23:30:58 2013
@@ -218,7 +218,7 @@ void LexicalScopes::constructScopeNest(L
   unsigned Counter = 0;
   while (!WorkStack.empty()) {
     LexicalScope *WS = WorkStack.back();
-    const SmallVector<LexicalScope *, 4> &Children = WS->getChildren();
+    const SmallVectorImpl<LexicalScope *> &Children = WS->getChildren();
     bool visitedChildren = false;
     for (SmallVector<LexicalScope *, 4>::const_iterator SI = Children.begin(),
            SE = Children.end(); SI != SE; ++SI) {
@@ -279,7 +279,7 @@ getMachineBasicBlocks(DebugLoc DL,
     return;
   }
 
-  SmallVector<InsnRange, 4> &InsnRanges = Scope->getRanges();
+  SmallVectorImpl<InsnRange> &InsnRanges = Scope->getRanges();
   for (SmallVector<InsnRange, 4>::iterator I = InsnRanges.begin(),
          E = InsnRanges.end(); I != E; ++I) {
     InsnRange &R = *I;





More information about the llvm-commits mailing list