]> granicus.if.org Git - clang/commitdiff
[analyzer] Plist diagnostics: Fix a case where we fail to close an XML tag.
authorJordan Rose <jordan_rose@apple.com>
Thu, 30 Aug 2012 20:43:09 +0000 (20:43 +0000)
committerJordan Rose <jordan_rose@apple.com>
Thu, 30 Aug 2012 20:43:09 +0000 (20:43 +0000)
If the current path diagnostic does /not/ have files associated with it, we
were simply skipping on to the next diagnostic with 'continue'. But that
also skipped the close tag for the diagnostic's <dict> node.

Part of fixing our internal analyzer buildbot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162939 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/PlistDiagnostics.cpp

index 79b2a1ce7f138f40ba4b42ea267c28942a5fa238..c038b632e9aa2c9c5ff6f6c7d9aa0ae1db0efbbb 100644 (file)
@@ -500,8 +500,6 @@ void PlistDiagnostics::FlushDiagnosticsImpl(
     if (!filesMade->empty()) {
       StringRef lastName;
       PDFileEntry::ConsumerFiles *files = filesMade->getFiles(*D);
-      if (!files)
-        continue;
       for (PDFileEntry::ConsumerFiles::const_iterator CI = files->begin(),
               CE = files->end(); CI != CE; ++CI) {
         StringRef newName = CI->first;
@@ -515,7 +513,8 @@ void PlistDiagnostics::FlushDiagnosticsImpl(
         }
         o << "   <string>" << CI->second << "</string>\n";
       }
-      o << "  </array>\n";
+      if (!lastName.empty())
+        o << "  </array>\n";
     }
 
     // Close up the entry.