Renaming range-based for loop variables so they don't appear iterator-like.

llvm-svn: 207422
This commit is contained in:
Aaron Ballman
2014-04-28 14:56:59 +00:00
parent 39f50421e3
commit 35897d97a3

View File

@@ -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<CFGStmt> CS = BI.getAs<CFGStmt>())
for (const auto &B : *Block)
if (Optional<CFGStmt> CS = B.getAs<CFGStmt>())
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<ParmVarDecl>(DMI.first)) {
const ParmVarDecl *Param = cast<ParmVarDecl>(DMI.first);
for (const auto &DM : VarMap) {
if (isa<ParmVarDecl>(DM.first)) {
const ParmVarDecl *Param = cast<ParmVarDecl>(DM.first);
const ReturnTypestateAttr *RTA = Param->getAttr<ReturnTypestateAttr>();
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<CFGStmt>().getStmt());
Visitor.Visit(B.castAs<CFGStmt>().getStmt());
break;
case CFGElement::TemporaryDtor: {
const CFGTemporaryDtor &DTor = BI.castAs<CFGTemporaryDtor>();
const CFGTemporaryDtor &DTor = B.castAs<CFGTemporaryDtor>();
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<CFGAutomaticObjDtor>();
const CFGAutomaticObjDtor &DTor = B.castAs<CFGAutomaticObjDtor>();
SourceLocation Loc = DTor.getTriggerStmt()->getLocEnd();
const VarDecl *Var = DTor.getVarDecl();