summaryrefslogtreecommitdiffstats
path: root/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2014-08-04 15:17:29 +0000
committerAaron Ballman <aaron@aaronballman.com>2014-08-04 15:17:29 +0000
commita41cfc753729d2a996a024b0d7b48fec78e70ad6 (patch)
tree7dc1445895b6165fb2257b3021f2fc417554585f /lib/Sema/SemaDeclAttr.cpp
parent54e272c2816ce05ddf8f62b867459c0374e68c9e (diff)
Highlight the offending function parameter when the format_arg argument refers to an invalid function parameter type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214722 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--lib/Sema/SemaDeclAttr.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index ff2594e114..4408abb7d8 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -2362,10 +2362,9 @@ static void handleFormatArgAttr(Sema &S, Decl *D, const AttributeList &Attr) {
!isCFStringType(Ty, S.Context) &&
(!Ty->isPointerType() ||
!Ty->getAs<PointerType>()->getPointeeType()->isCharType())) {
- // FIXME: Should highlight the actual expression that has the wrong type.
S.Diag(Attr.getLoc(), diag::err_format_attribute_not)
- << (not_nsstring_type ? "a string type" : "an NSString")
- << IdxExpr->getSourceRange();
+ << (not_nsstring_type ? "a string type" : "an NSString")
+ << IdxExpr->getSourceRange() << getFunctionOrMethodParamRange(D, 0);
return;
}
Ty = getFunctionOrMethodResultType(D);
@@ -2373,10 +2372,9 @@ static void handleFormatArgAttr(Sema &S, Decl *D, const AttributeList &Attr) {
!isCFStringType(Ty, S.Context) &&
(!Ty->isPointerType() ||
!Ty->getAs<PointerType>()->getPointeeType()->isCharType())) {
- // FIXME: Should highlight the actual expression that has the wrong type.
S.Diag(Attr.getLoc(), diag::err_format_attribute_result_not)
- << (not_nsstring_type ? "string type" : "NSString")
- << IdxExpr->getSourceRange();
+ << (not_nsstring_type ? "string type" : "NSString")
+ << IdxExpr->getSourceRange() << getFunctionOrMethodParamRange(D, 0);
return;
}