diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Tooling/CompilationDatabase.h | 8 | ||||
-rw-r--r-- | include/clang/Tooling/Tooling.h | 16 |
2 files changed, 23 insertions, 1 deletions
diff --git a/include/clang/Tooling/CompilationDatabase.h b/include/clang/Tooling/CompilationDatabase.h index 625c8eced4..0dec6f8f87 100644 --- a/include/clang/Tooling/CompilationDatabase.h +++ b/include/clang/Tooling/CompilationDatabase.h @@ -81,6 +81,13 @@ public: static CompilationDatabase *loadFromDirectory(StringRef BuildDirectory, std::string &ErrorMessage); + /// \brief Tries to detect a compilation database location and load it. + /// + /// Looks for a compilation database in all parent paths by calling + /// loadFromDirectory. + static CompilationDatabase *autoDetectFromSource(StringRef SourceFile, + std::string &ErrorMessage); + /// \brief Returns all compile commands in which the specified file was /// compiled. /// @@ -215,4 +222,3 @@ private: } // end namespace clang #endif // LLVM_CLANG_TOOLING_COMPILATION_DATABASE_H - diff --git a/include/clang/Tooling/Tooling.h b/include/clang/Tooling/Tooling.h index 0e1dd58ac9..03f9d0b4bc 100644 --- a/include/clang/Tooling/Tooling.h +++ b/include/clang/Tooling/Tooling.h @@ -232,6 +232,22 @@ FrontendActionFactory *newFrontendActionFactory(FactoryT *ConsumerFactory) { return new FrontendActionFactoryAdapter(ConsumerFactory); } +/// \brief Returns the absolute path of \c File, by prepending it with +/// the current directory if \c File is not absolute. +/// +/// Otherwise returns \c File. +/// If 'File' starts with "./", the returned path will not contain the "./". +/// Otherwise, the returned path will contain the literal path-concatenation of +/// the current directory and \c File. +/// +/// The difference to llvm::sys::fs::make_absolute is that we prefer +/// ::getenv("PWD") if available. +/// FIXME: Make this functionality available from llvm::sys::fs and delete +/// this function. +/// +/// \param File Either an absolute or relative path. +std::string getAbsolutePath(StringRef File); + } // end namespace tooling } // end namespace clang |