From 6de7daa60412744bcf168c6c0d521688435fe221 Mon Sep 17 00:00:00 2001
From: Anna Zaks <ganna@apple.com>
Date: Fri, 11 Jan 2013 03:52:44 +0000
Subject: [PATCH] [analyzer] Rename the warning: state the issue before the
 hint of how it can be fixed

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172170 91177308-0d34-0410-b5e6-96231b3b80d8
---
 .../Checkers/IvarInvalidationChecker.cpp              | 11 +++++------
 test/Analysis/objc_invalidation.m                     |  8 ++++----
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp b/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
index 4f2a9097b4..9d25ce0364 100644
--- a/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp
@@ -408,11 +408,10 @@ void IvarInvalidationChecker::checkASTDecl(const ObjCImplementationDecl *ImplD,
   if (!Info.needsInvalidation()) {
     SmallString<128> sbuf;
     llvm::raw_svector_ostream os(sbuf);
-    os << "No invalidation method declared in the @interface for "
-       << InterfaceD->getName() << "; ";
     assert(FirstIvarDecl);
     printIvar(os, FirstIvarDecl, IvarToPopertyMap);
-    os << "needs to be invalidated";
+    os << "needs to be invalidated; ";
+    os << "No invalidation method is declared for " << InterfaceD->getName();
 
     PathDiagnosticLocation IvarDecLocation =
       PathDiagnosticLocation::createBegin(FirstIvarDecl, BR.getSourceManager());
@@ -473,11 +472,11 @@ void IvarInvalidationChecker::checkASTDecl(const ObjCImplementationDecl *ImplD,
   if (!AtImplementationContainsAtLeastOneInvalidationMethod) {
     SmallString<128> sbuf;
     llvm::raw_svector_ostream os(sbuf);
-    os << "No invalidation method defined in the @implementation for "
-       << InterfaceD->getName() << "; ";
     assert(FirstIvarDecl);
     printIvar(os, FirstIvarDecl, IvarToPopertyMap);
-    os << "needs to be invalidated";
+    os << "needs to be invalidated; ";
+    os << "No invalidation method is defined in the @implementation for "
+       << InterfaceD->getName();
 
     PathDiagnosticLocation IvarDecLocation =
         PathDiagnosticLocation::createBegin(FirstIvarDecl,
diff --git a/test/Analysis/objc_invalidation.m b/test/Analysis/objc_invalidation.m
index 84028ddc2e..5189de43c5 100644
--- a/test/Analysis/objc_invalidation.m
+++ b/test/Analysis/objc_invalidation.m
@@ -225,20 +225,20 @@ extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1,
 @end
 
 @interface MissingInvalidationMethod : Foo <FooBar_Protocol>
-@property (assign) MissingInvalidationMethod *foobar15_warn; // expected-warning {{No invalidation method defined in the @implementation for MissingInvalidationMethod; Property foobar15_warn needs to be invalidated}}
+@property (assign) MissingInvalidationMethod *foobar15_warn; // expected-warning {{Property foobar15_warn needs to be invalidated; No invalidation method is defined in the @implementation for MissingInvalidationMethod}}
 @end
 @implementation MissingInvalidationMethod
 @end
 
 @interface MissingInvalidationMethod2 : Foo <FooBar_Protocol> {
-  Foo *Ivar1;// expected-warning {{No invalidation method defined in the @implementation for MissingInvalidationMethod2; Instance variable Ivar1 needs to be invalidated}}
+  Foo *Ivar1;// expected-warning {{Instance variable Ivar1 needs to be invalidated; No invalidation method is defined in the @implementation for MissingInvalidationMethod2}}
 }
 @end
 @implementation MissingInvalidationMethod2
 @end
 
 @interface MissingInvalidationMethodDecl : NSObject {
-  Foo *Ivar1;// expected-warning {{No invalidation method declared in the @interface for MissingInvalidationMethodDecl; Instance variable Ivar1 needs to be invalidated}}
+  Foo *Ivar1;// expected-warning {{Instance variable Ivar1 needs to be invalidated; No invalidation method is declared for MissingInvalidationMethodDecl}}
 }
 @end
 @implementation MissingInvalidationMethodDecl
@@ -246,7 +246,7 @@ extern void NSLog(NSString *format, ...) __attribute__((format(__NSString__, 1,
 
 @interface MissingInvalidationMethodDecl2 : NSObject {
 @private
-    Foo *_foo1; // expected-warning {{No invalidation method declared in the @interface for MissingInvalidationMethodDecl2; Instance variable _foo1 needs to be invalidated}} 
+    Foo *_foo1; // expected-warning {{Instance variable _foo1 needs to be invalidated; No invalidation method is declared for MissingInvalidationMethodDecl2}} 
 }
 @property (strong) Foo *bar1; 
 @end
-- 
2.40.0