1 //===- CompilationDatabasePluginRegistry.h ----------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H
11 #define LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H
13 #include "clang/Tooling/CompilationDatabase.h"
14 #include "llvm/Support/Registry.h"
19 /// Interface for compilation database plugins.
21 /// A compilation database plugin allows the user to register custom compilation
22 /// databases that are picked up as compilation database if the corresponding
23 /// library is linked in. To register a plugin, declare a static variable like:
26 /// static CompilationDatabasePluginRegistry::Add<MyDatabasePlugin>
27 /// X("my-compilation-database", "Reads my own compilation database");
29 class CompilationDatabasePlugin {
31 virtual ~CompilationDatabasePlugin();
33 /// Loads a compilation database from a build directory.
35 /// \see CompilationDatabase::loadFromDirectory().
36 virtual std::unique_ptr<CompilationDatabase>
37 loadFromDirectory(StringRef Directory, std::string &ErrorMessage) = 0;
40 using CompilationDatabasePluginRegistry =
41 llvm::Registry<CompilationDatabasePlugin>;
43 } // namespace tooling
46 #endif // LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H