Revert "[analyzer] Improve CloneChecker diagnostics" as its depends on reverted r283092

This reverts commit r283094.

llvm-svn: 283182
diff --git a/clang/lib/Analysis/CloneDetection.cpp b/clang/lib/Analysis/CloneDetection.cpp
index 4fdac5a..1b43cfb 100644
--- a/clang/lib/Analysis/CloneDetection.cpp
+++ b/clang/lib/Analysis/CloneDetection.cpp
@@ -82,10 +82,6 @@
 
 SourceLocation StmtSequence::getEndLoc() const { return back()->getLocEnd(); }
 
-SourceRange StmtSequence::getSourceRange() const {
-  return SourceRange(getStartLoc(), getEndLoc());
-}
-
 namespace {
 
 /// \brief Analyzes the pattern of the referenced variables in a statement.
@@ -95,11 +91,11 @@
   struct VariableOccurence {
     /// The index of the associated VarDecl in the Variables vector.
     size_t KindID;
-    /// The statement in the code where the variable was referenced.
-    const Stmt *Mention;
+    /// The source range in the code where the variable was referenced.
+    SourceRange Range;
 
-    VariableOccurence(size_t KindID, const Stmt *Mention)
-        : KindID(KindID), Mention(Mention) {}
+    VariableOccurence(size_t KindID, SourceRange Range)
+        : KindID(KindID), Range(Range) {}
   };
 
   /// All occurences of referenced variables in the order of appearance.
@@ -111,19 +107,19 @@
   /// \brief Adds a new variable referenced to this pattern.
   /// \param VarDecl The declaration of the variable that is referenced.
   /// \param Mention The statement in the code where the variable was referenced.
-  void addVariableOccurence(const VarDecl *VarDecl, const Stmt *Mention) {
+  void addVariableOccurence(const VarDecl *VarDecl, SourceRange Range) {
     // First check if we already reference this variable
     for (size_t KindIndex = 0; KindIndex < Variables.size(); ++KindIndex) {
       if (Variables[KindIndex] == VarDecl) {
         // If yes, add a new occurence that points to the existing entry in
         // the Variables vector.
-        Occurences.emplace_back(KindIndex, Mention);
+        Occurences.emplace_back(KindIndex, Range);
         return;
       }
     }
     // If this variable wasn't already referenced, add it to the list of
     // referenced variables and add a occurence that points to this new entry.
-    Occurences.emplace_back(Variables.size(), Mention);
+    Occurences.emplace_back(Variables.size(), Range);
     Variables.push_back(VarDecl);
   }
 
@@ -138,7 +134,7 @@
     // Check if S is a reference to a variable. If yes, add it to the pattern.
     if (auto D = dyn_cast<DeclRefExpr>(S)) {
       if (auto VD = dyn_cast<VarDecl>(D->getDecl()->getCanonicalDecl()))
-        addVariableOccurence(VD, D);
+        addVariableOccurence(VD, D->getSourceRange());
     }
 
     // Recursively check all children of the given statement.
@@ -212,7 +208,7 @@
       // Store information about the first clone.
       FirstMismatch->FirstCloneInfo =
           CloneDetector::SuspiciousClonePair::SuspiciousCloneInfo(
-              Variables[ThisOccurence.KindID], ThisOccurence.Mention,
+              Variables[ThisOccurence.KindID], ThisOccurence.Range,
               FirstSuggestion);
 
       // Same as above but with the other clone. We do this for both clones as
@@ -225,7 +221,7 @@
       // Store information about the second clone.
       FirstMismatch->SecondCloneInfo =
           CloneDetector::SuspiciousClonePair::SuspiciousCloneInfo(
-              Other.Variables[OtherOccurence.KindID], OtherOccurence.Mention,
+              Variables[ThisOccurence.KindID], OtherOccurence.Range,
               SecondSuggestion);
 
       // SuspiciousClonePair guarantees that the first clone always has a