Sema: Simplify away one-iteration loops.

No functionality change.

llvm-svn: 201981
This commit is contained in:
Benjamin Kramer 2014-02-23 14:34:50 +00:00
parent 3ebfe11532
commit ae852a68fe
1 changed files with 5 additions and 14 deletions

View File

@ -4400,16 +4400,10 @@ Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
CheckReturnStackAddr(*this, RetValExp, lhsType, ReturnLoc);
// Check if the return value is null but should not be.
if (Attrs)
for (specific_attr_iterator<ReturnsNonNullAttr>
I = specific_attr_iterator<ReturnsNonNullAttr>(Attrs->begin()),
E = specific_attr_iterator<ReturnsNonNullAttr>(Attrs->end());
I != E; ++I) {
if (CheckNonNullExpr(*this, RetValExp))
Diag(ReturnLoc, diag::warn_null_ret)
<< (isObjCMethod ? 1 : 0) << RetValExp->getSourceRange();
break;
}
if (Attrs && hasSpecificAttr<ReturnsNonNullAttr>(*Attrs) &&
CheckNonNullExpr(*this, RetValExp))
Diag(ReturnLoc, diag::warn_null_ret)
<< (isObjCMethod ? 1 : 0) << RetValExp->getSourceRange();
// C++11 [basic.stc.dynamic.allocation]p4:
// If an allocation function declared with a non-throwing
@ -7381,10 +7375,7 @@ bool GetMatchingCType(
return false;
if (VD) {
for (specific_attr_iterator<TypeTagForDatatypeAttr>
I = VD->specific_attr_begin<TypeTagForDatatypeAttr>(),
E = VD->specific_attr_end<TypeTagForDatatypeAttr>();
I != E; ++I) {
if (TypeTagForDatatypeAttr *I = VD->getAttr<TypeTagForDatatypeAttr>()) {
if (I->getArgumentKind() != ArgumentKind) {
FoundWrongKind = true;
return false;