BugReporter/PathDiagnostics:
- Add an (optional) short description for BugReports for clients that want
  to distinguish between long and short descriptions for bugs
- Make the bug report for VLA less obscene for Plist diagnostics by using
  the short description


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70415 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRExprEngineInternalChecks.cpp b/lib/Analysis/GRExprEngineInternalChecks.cpp
index 1b03149..a40eff8 100644
--- a/lib/Analysis/GRExprEngineInternalChecks.cpp
+++ b/lib/Analysis/GRExprEngineInternalChecks.cpp
@@ -405,12 +405,23 @@
             "variable-length array (VLA) '"
          << VD->getNameAsString() << "' evaluates to ";
       
-      if (Eng.getStateManager().GetSVal(N->getState(), SizeExpr).isUndef())
+      bool isUndefined = Eng.getStateManager().GetSVal(N->getState(),
+                                                       SizeExpr).isUndef();
+      
+      if (isUndefined)
         os << "an undefined or garbage value.";
       else
         os << "0. VLAs with no elements have undefined behavior.";
+      
+      std::string shortBuf;
+      llvm::raw_string_ostream os_short(shortBuf);
+      os_short << "Variable-length array '" << VD->getNameAsString() << "' "
+               << (isUndefined ? " garbage value for array size"
+                   : " has zero elements (undefined behavior)");
 
-      RangedBugReport *report = new RangedBugReport(*this, os.str().c_str(), N);
+      RangedBugReport *report = new RangedBugReport(*this,
+                                                    os_short.str().c_str(),
+                                                    os.str().c_str(), N);
       report->addRange(SizeExpr->getSourceRange());
       BR.EmitReport(report);
     }