Return SmallVectorImpl& instead of SmallVector& in a couple places to avoid having to specify the vector size in multiple places.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185507 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2013-07-03 04:30:58 +00:00
parent 1c3751c21f
commit 9f4c37915f
2 changed files with 9 additions and 9 deletions

View File

@ -166,13 +166,13 @@ public:
virtual ~LexicalScope() {} virtual ~LexicalScope() {}
// Accessors. // Accessors.
LexicalScope *getParent() const { return Parent; } LexicalScope *getParent() const { return Parent; }
const MDNode *getDesc() const { return Desc; } const MDNode *getDesc() const { return Desc; }
const MDNode *getInlinedAt() const { return InlinedAtLocation; } const MDNode *getInlinedAt() const { return InlinedAtLocation; }
const MDNode *getScopeNode() const { return Desc; } const MDNode *getScopeNode() const { return Desc; }
bool isAbstractScope() const { return AbstractScope; } bool isAbstractScope() const { return AbstractScope; }
SmallVector<LexicalScope *, 4> &getChildren() { return Children; } SmallVectorImpl<LexicalScope *> &getChildren() { return Children; }
SmallVector<InsnRange, 4> &getRanges() { return Ranges; } SmallVectorImpl<InsnRange> &getRanges() { return Ranges; }
/// addChild - Add a child scope. /// addChild - Add a child scope.
void addChild(LexicalScope *S) { Children.push_back(S); } void addChild(LexicalScope *S) { Children.push_back(S); }

View File

@ -218,7 +218,7 @@ void LexicalScopes::constructScopeNest(LexicalScope *Scope) {
unsigned Counter = 0; unsigned Counter = 0;
while (!WorkStack.empty()) { while (!WorkStack.empty()) {
LexicalScope *WS = WorkStack.back(); LexicalScope *WS = WorkStack.back();
const SmallVector<LexicalScope *, 4> &Children = WS->getChildren(); const SmallVectorImpl<LexicalScope *> &Children = WS->getChildren();
bool visitedChildren = false; bool visitedChildren = false;
for (SmallVector<LexicalScope *, 4>::const_iterator SI = Children.begin(), for (SmallVector<LexicalScope *, 4>::const_iterator SI = Children.begin(),
SE = Children.end(); SI != SE; ++SI) { SE = Children.end(); SI != SE; ++SI) {
@ -279,7 +279,7 @@ getMachineBasicBlocks(DebugLoc DL,
return; return;
} }
SmallVector<InsnRange, 4> &InsnRanges = Scope->getRanges(); SmallVectorImpl<InsnRange> &InsnRanges = Scope->getRanges();
for (SmallVector<InsnRange, 4>::iterator I = InsnRanges.begin(), for (SmallVector<InsnRange, 4>::iterator I = InsnRanges.begin(),
E = InsnRanges.end(); I != E; ++I) { E = InsnRanges.end(); I != E; ++I) {
InsnRange &R = *I; InsnRange &R = *I;