forked from OSchip/llvm-project
Fix some coding standard issues and delete a dead conditional.
llvm-svn: 244959
This commit is contained in:
parent
e438127b91
commit
b64963ecbc
|
@ -2491,17 +2491,17 @@ static void handleFormatArgAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||||
if (!checkFunctionOrMethodParameterIndex(S, D, Attr, 1, IdxExpr, Idx))
|
if (!checkFunctionOrMethodParameterIndex(S, D, Attr, 1, IdxExpr, Idx))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// make sure the format string is really a string
|
// Make sure the format string is really a string.
|
||||||
QualType Ty = getFunctionOrMethodParamType(D, Idx);
|
QualType Ty = getFunctionOrMethodParamType(D, Idx);
|
||||||
|
|
||||||
bool not_nsstring_type = !isNSStringType(Ty, S.Context);
|
bool NotNSStringTy = !isNSStringType(Ty, S.Context);
|
||||||
if (not_nsstring_type &&
|
if (NotNSStringTy &&
|
||||||
!isCFStringType(Ty, S.Context) &&
|
!isCFStringType(Ty, S.Context) &&
|
||||||
(!Ty->isPointerType() ||
|
(!Ty->isPointerType() ||
|
||||||
!Ty->getAs<PointerType>()->getPointeeType()->isCharType())) {
|
!Ty->getAs<PointerType>()->getPointeeType()->isCharType())) {
|
||||||
S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
|
S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
|
||||||
<< (not_nsstring_type ? "a string type" : "an NSString")
|
<< "a string type" << IdxExpr->getSourceRange()
|
||||||
<< IdxExpr->getSourceRange() << getFunctionOrMethodParamRange(D, 0);
|
<< getFunctionOrMethodParamRange(D, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Ty = getFunctionOrMethodResultType(D);
|
Ty = getFunctionOrMethodResultType(D);
|
||||||
|
@ -2510,7 +2510,7 @@ static void handleFormatArgAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
||||||
(!Ty->isPointerType() ||
|
(!Ty->isPointerType() ||
|
||||||
!Ty->getAs<PointerType>()->getPointeeType()->isCharType())) {
|
!Ty->getAs<PointerType>()->getPointeeType()->isCharType())) {
|
||||||
S.Diag(Attr.getLoc(), diag::err_format_attribute_result_not)
|
S.Diag(Attr.getLoc(), diag::err_format_attribute_result_not)
|
||||||
<< (not_nsstring_type ? "string type" : "NSString")
|
<< (NotNSStringTy ? "string type" : "NSString")
|
||||||
<< IdxExpr->getSourceRange() << getFunctionOrMethodParamRange(D, 0);
|
<< IdxExpr->getSourceRange() << getFunctionOrMethodParamRange(D, 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue