summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclAttr.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-08-19 23:56:48 +0000
committerTed Kremenek <kremenek@apple.com>2009-08-19 23:56:48 +0000
commiteebcf574dd0ad79faee3a0a67528947db29cfdcb (patch)
tree5ff57b8b75240fc853e63995448a961180a00c5d /clang/lib/Sema/SemaDeclAttr.cpp
parentaec3830ce783f237298ae90781e5a56be1539edc (diff)
downloadbcm5719-llvm-eebcf574dd0ad79faee3a0a67528947db29cfdcb.tar.gz
bcm5719-llvm-eebcf574dd0ad79faee3a0a67528947db29cfdcb.zip
Enhance diagnostics concerning attribute 'ns_returns_retained' and 'cf_returns_retained' to present the range of the attribute and have the diagnostic location be the declaration that the attribute was falsely attached to. This solves the problem where these diagnostics were being suppressed when these attributes were wrapped in a macro that was defined in a system header.
llvm-svn: 79496
Diffstat (limited to 'clang/lib/Sema/SemaDeclAttr.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclAttr.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index a840e6f5d1a..af0f03d2d9f 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -1730,15 +1730,17 @@ static void HandleNSReturnsRetainedAttr(Decl *d, const AttributeList &Attr,
else if (FunctionDecl *FD = dyn_cast<FunctionDecl>(d))
RetTy = FD->getResultType();
else {
- S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
- << Attr.getName() << 3 /* function or method */;
+ SourceLocation L = Attr.getLoc();
+ S.Diag(d->getLocStart(), diag::warn_attribute_wrong_decl_type)
+ << SourceRange(L, L) << Attr.getName() << 3 /* function or method */;
return;
}
if (!(S.Context.isObjCNSObjectType(RetTy) || RetTy->getAs<PointerType>()
|| RetTy->getAsObjCObjectPointerType())) {
- S.Diag(Attr.getLoc(), diag::warn_ns_attribute_wrong_return_type)
- << Attr.getName();
+ SourceLocation L = Attr.getLoc();
+ S.Diag(d->getLocStart(), diag::warn_ns_attribute_wrong_return_type)
+ << SourceRange(L, L) << Attr.getName();
return;
}
OpenPOWER on IntegriCloud