summaryrefslogtreecommitdiffstats
path: root/clang/lib/Tooling/CompilationDatabase.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2012-07-11 19:13:13 +0000
committerDaniel Jasper <djasper@google.com>2012-07-11 19:13:13 +0000
commitbb89ae939241f166521d74bc4159eaf45377fff3 (patch)
tree847a76feb9f3a41de70aadf58b8be4974eaa0b75 /clang/lib/Tooling/CompilationDatabase.cpp
parent4dce73af05b28ec30761c4b47f5de34b0b087e16 (diff)
downloadbcm5719-llvm-bb89ae939241f166521d74bc4159eaf45377fff3.tar.gz
bcm5719-llvm-bb89ae939241f166521d74bc4159eaf45377fff3.zip
Add a hook to supply a custom CompilationDatabase. To add a custom CompilationDatabase, make it implement findCompilationDatabaseForDirectory in CustomCompilationDatabase.h and set USE_COSTUM_COMPILATION_DATABASE.
Differential Revision: http://llvm-reviews.chandlerc.com/D4 llvm-svn: 160061
Diffstat (limited to 'clang/lib/Tooling/CompilationDatabase.cpp')
-rw-r--r--clang/lib/Tooling/CompilationDatabase.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/Tooling/CompilationDatabase.cpp b/clang/lib/Tooling/CompilationDatabase.cpp
index a06343ddab6..d54a5e79ebd 100644
--- a/clang/lib/Tooling/CompilationDatabase.cpp
+++ b/clang/lib/Tooling/CompilationDatabase.cpp
@@ -18,6 +18,10 @@
#include "llvm/Support/Path.h"
#include "llvm/Support/system_error.h"
+#ifdef USE_CUSTOM_COMPILATION_DATABASE
+#include "CustomCompilationDatabase.h"
+#endif
+
namespace clang {
namespace tooling {
@@ -124,6 +128,11 @@ CompilationDatabase::loadFromDirectory(StringRef BuildDirectory,
static CompilationDatabase *
findCompilationDatabaseFromDirectory(StringRef Directory) {
+#ifdef USE_CUSTOM_COMPILATION_DATABASE
+ if (CompilationDatabase *DB =
+ ::findCompilationDatabaseForDirectory(Directory))
+ return DB;
+#endif
while (!Directory.empty()) {
std::string LoadErrorMessage;
OpenPOWER on IntegriCloud