[cfe-commits] r165933 - /cfe/trunk/lib/Tooling/CompilationDatabase.cpp

Daniel Jasper djasper at google.com
Mon Oct 15 06:12:24 PDT 2012


Author: djasper
Date: Mon Oct 15 08:12:24 2012
New Revision: 165933

URL: http://llvm.org/viewvc/llvm-project?rev=165933&view=rev
Log:
Only report first error when no compilation database is found.

Review: http://llvm-reviews.chandlerc.com/D62

Modified:
    cfe/trunk/lib/Tooling/CompilationDatabase.cpp

Modified: cfe/trunk/lib/Tooling/CompilationDatabase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/CompilationDatabase.cpp?rev=165933&r1=165932&r2=165933&view=diff
==============================================================================
--- cfe/trunk/lib/Tooling/CompilationDatabase.cpp (original)
+++ cfe/trunk/lib/Tooling/CompilationDatabase.cpp Mon Oct 15 08:12:24 2012
@@ -49,14 +49,19 @@
 findCompilationDatabaseFromDirectory(StringRef Directory,
                                      std::string &ErrorMessage) {
   std::stringstream ErrorStream;
+  bool HasErrorMessage = false;
   while (!Directory.empty()) {
     std::string LoadErrorMessage;
 
     if (CompilationDatabase *DB =
            CompilationDatabase::loadFromDirectory(Directory, LoadErrorMessage))
       return DB;
-    ErrorStream << "No compilation database found in " << Directory.str()
-                << "\n" << LoadErrorMessage;
+
+    if (!HasErrorMessage) {
+      ErrorStream << "No compilation database found in " << Directory.str()
+                  << " or any parent directory\n" << LoadErrorMessage;
+      HasErrorMessage = true;
+    }
 
     Directory = llvm::sys::path::parent_path(Directory);
   }





More information about the cfe-commits mailing list