The attached patch fixes spurious outputs from 
JSONCompilationDatabase::getCompileCommands when the file is not found.

This spurious output garbles the screen when libclang is used for example with 
clang_complete.

Let me known if I can apply it

Cheers,
--
Arnaud A. de Grandmaison
>From 16f46c069668904df9750ecc7e775c9868861b9b Mon Sep 17 00:00:00 2001
From: "Arnaud A. de Grandmaison" <[email protected]>
Date: Sat, 12 Jan 2013 18:26:03 +0100
Subject: [PATCH] Fix spurious output in JSONCompilationDatabase

---
 lib/Tooling/JSONCompilationDatabase.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/Tooling/JSONCompilationDatabase.cpp b/lib/Tooling/JSONCompilationDatabase.cpp
index 25284cf..197b7e7 100644
--- a/lib/Tooling/JSONCompilationDatabase.cpp
+++ b/lib/Tooling/JSONCompilationDatabase.cpp
@@ -167,12 +167,8 @@ JSONCompilationDatabase::getCompileCommands(StringRef FilePath) const {
   std::string Error;
   llvm::raw_string_ostream ES(Error);
   StringRef Match = MatchTrie.findEquivalent(NativeFilePath.str(), ES);
-  if (Match.empty()) {
-    if (Error.empty())
-      Error = "No match found.";
-    llvm::outs() << Error << "\n";
+  if (Match.empty())
     return std::vector<CompileCommand>();
-  }
   llvm::StringMap< std::vector<CompileCommandRef> >::const_iterator
     CommandsRefI = IndexByFile.find(Match);
   if (CommandsRefI == IndexByFile.end())
-- 
1.7.12.4

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to