[analyzer] Refactor PathDiagnosticLocation: Make PathDiagnosticLocation(SourceLocation...) private. Most of the effort here goes to making BugReport refer to a PathDiagnosticLocation instead of FullSourceLocation. 

(Another step closer to the goal of having Diagnostics which can recover from invalid SourceLocations.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140182 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp b/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
index cb6c1c6..de9c021 100644
--- a/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
+++ b/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp
@@ -166,6 +166,9 @@
     }
   }
 
+  PathDiagnosticLocation DLoc =
+    PathDiagnosticLocation::createBegin(D, BR.getSourceManager());
+
   if (!MD) { // No dealloc found.
 
     const char* name = LOpts.getGC() == LangOptions::NonGC
@@ -176,7 +179,7 @@
     llvm::raw_string_ostream os(buf);
     os << "Objective-C class '" << D << "' lacks a 'dealloc' instance method";
 
-    BR.EmitBasicReport(name, os.str(), D->getLocStart());
+    BR.EmitBasicReport(name, os.str(), DLoc);
     return;
   }
 
@@ -193,7 +196,7 @@
        << "' does not send a 'dealloc' message to its super class"
            " (missing [super dealloc])";
 
-    BR.EmitBasicReport(name, os.str(), D->getLocStart());
+    BR.EmitBasicReport(name, os.str(), DLoc);
     return;
   }
 
@@ -257,7 +260,10 @@
               "but was released in 'dealloc'";
       }
 
-      BR.EmitBasicReport(name, category, os.str(), (*I)->getLocation());
+      PathDiagnosticLocation SDLoc =
+        PathDiagnosticLocation::createBegin((*I), BR.getSourceManager());
+
+      BR.EmitBasicReport(name, category, os.str(), SDLoc);
     }
   }
 }