]> granicus.if.org Git - clang/commitdiff
Enhance diagnostics concerning attribute 'ns_returns_retained' and 'cf_returns_retain...
authorTed Kremenek <kremenek@apple.com>
Wed, 19 Aug 2009 23:56:48 +0000 (23:56 +0000)
committerTed Kremenek <kremenek@apple.com>
Wed, 19 Aug 2009 23:56:48 +0000 (23:56 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@79496 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclAttr.cpp

index a840e6f5d1aa345d5a386b8928dd66aa0e37c9ee..af0f03d2d9f083ec4730ae77aaefeb53fcd1e6c2 100644 (file)
@@ -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;
   }