From: Aaron Ballman Date: Mon, 28 Apr 2014 14:56:59 +0000 (+0000) Subject: Renaming range-based for loop variables so they don't appear iterator-like. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=986027020e308ad14caf6e591f38a19f73db2f60;p=clang Renaming range-based for loop variables so they don't appear iterator-like. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207422 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/Consumed.cpp b/lib/Analysis/Consumed.cpp index 31823f33f0..aac5658d56 100644 --- a/lib/Analysis/Consumed.cpp +++ b/lib/Analysis/Consumed.cpp @@ -57,8 +57,8 @@ ConsumedWarningsHandlerBase::~ConsumedWarningsHandlerBase() {} static SourceLocation getFirstStmtLoc(const CFGBlock *Block) { // Find the source location of the first statement in the block, if the block // is not empty. - for (const auto &BI : *Block) - if (Optional CS = BI.getAs()) + for (const auto &B : *Block) + if (Optional CS = B.getAs()) return CS->getStmt()->getLocStart(); // Block is empty. @@ -1142,19 +1142,19 @@ bool ConsumedBlockInfo::isBackEdgeTarget(const CFGBlock *Block) { void ConsumedStateMap::checkParamsForReturnTypestate(SourceLocation BlameLoc, ConsumedWarningsHandlerBase &WarningsHandler) const { - for (const auto &DMI : VarMap) { - if (isa(DMI.first)) { - const ParmVarDecl *Param = cast(DMI.first); + for (const auto &DM : VarMap) { + if (isa(DM.first)) { + const ParmVarDecl *Param = cast(DM.first); const ReturnTypestateAttr *RTA = Param->getAttr(); if (!RTA) continue; ConsumedState ExpectedState = mapReturnTypestateAttrState(RTA); - if (DMI.second != ExpectedState) + if (DM.second != ExpectedState) WarningsHandler.warnParamReturnTypestateMismatch(BlameLoc, Param->getNameAsString(), stateToString(ExpectedState), - stateToString(DMI.second)); + stateToString(DM.second)); } } } @@ -1190,14 +1190,14 @@ void ConsumedStateMap::intersect(const ConsumedStateMap *Other) { return; } - for (const auto &DMI : Other->VarMap) { - LocalState = this->getState(DMI.first); + for (const auto &DM : Other->VarMap) { + LocalState = this->getState(DM.first); if (LocalState == CS_None) continue; - if (LocalState != DMI.second) - VarMap[DMI.first] = CS_Unknown; + if (LocalState != DM.second) + VarMap[DM.first] = CS_Unknown; } } @@ -1208,16 +1208,16 @@ void ConsumedStateMap::intersectAtLoopHead(const CFGBlock *LoopHead, ConsumedState LocalState; SourceLocation BlameLoc = getLastStmtLoc(LoopBack); - for (const auto &DMI : LoopBackStates->VarMap) { - LocalState = this->getState(DMI.first); + for (const auto &DM : LoopBackStates->VarMap) { + LocalState = this->getState(DM.first); if (LocalState == CS_None) continue; - if (LocalState != DMI.second) { - VarMap[DMI.first] = CS_Unknown; + if (LocalState != DM.second) { + VarMap[DM.first] = CS_Unknown; WarningsHandler.warnLoopStateMismatch(BlameLoc, - DMI.first->getNameAsString()); + DM.first->getNameAsString()); } } } @@ -1242,8 +1242,8 @@ void ConsumedStateMap::remove(const VarDecl *Var) { } bool ConsumedStateMap::operator!=(const ConsumedStateMap *Other) const { - for (const auto &DMI : Other->VarMap) - if (this->getState(DMI.first) != DMI.second) + for (const auto &DM : Other->VarMap) + if (this->getState(DM.first) != DM.second) return true; return false; } @@ -1404,14 +1404,14 @@ void ConsumedAnalyzer::run(AnalysisDeclContext &AC) { Visitor.reset(CurrStates); // Visit all of the basic block's statements. - for (const auto &BI : *CurrBlock) { - switch (BI.getKind()) { + for (const auto &B : *CurrBlock) { + switch (B.getKind()) { case CFGElement::Statement: - Visitor.Visit(BI.castAs().getStmt()); + Visitor.Visit(B.castAs().getStmt()); break; case CFGElement::TemporaryDtor: { - const CFGTemporaryDtor &DTor = BI.castAs(); + const CFGTemporaryDtor &DTor = B.castAs(); const CXXBindTemporaryExpr *BTE = DTor.getBindTemporaryExpr(); Visitor.checkCallability(PropagationInfo(BTE), @@ -1421,7 +1421,7 @@ void ConsumedAnalyzer::run(AnalysisDeclContext &AC) { } case CFGElement::AutomaticObjectDtor: { - const CFGAutomaticObjDtor &DTor = BI.castAs(); + const CFGAutomaticObjDtor &DTor = B.castAs(); SourceLocation Loc = DTor.getTriggerStmt()->getLocEnd(); const VarDecl *Var = DTor.getVarDecl();