Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
14 | pmbaty | 1 | //===- CompilationDatabasePluginRegistry.h ----------------------*- C++ -*-===// |
2 | // |
||
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
||
4 | // See https://llvm.org/LICENSE.txt for license information. |
||
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
||
6 | // |
||
7 | //===----------------------------------------------------------------------===// |
||
8 | |||
9 | #ifndef LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H |
||
10 | #define LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H |
||
11 | |||
12 | #include "clang/Tooling/CompilationDatabase.h" |
||
13 | #include "llvm/Support/Registry.h" |
||
14 | |||
15 | namespace clang { |
||
16 | namespace tooling { |
||
17 | |||
18 | /// Interface for compilation database plugins. |
||
19 | /// |
||
20 | /// A compilation database plugin allows the user to register custom compilation |
||
21 | /// databases that are picked up as compilation database if the corresponding |
||
22 | /// library is linked in. To register a plugin, declare a static variable like: |
||
23 | /// |
||
24 | /// \code |
||
25 | /// static CompilationDatabasePluginRegistry::Add<MyDatabasePlugin> |
||
26 | /// X("my-compilation-database", "Reads my own compilation database"); |
||
27 | /// \endcode |
||
28 | class CompilationDatabasePlugin { |
||
29 | public: |
||
30 | virtual ~CompilationDatabasePlugin(); |
||
31 | |||
32 | /// Loads a compilation database from a build directory. |
||
33 | /// |
||
34 | /// \see CompilationDatabase::loadFromDirectory(). |
||
35 | virtual std::unique_ptr<CompilationDatabase> |
||
36 | loadFromDirectory(StringRef Directory, std::string &ErrorMessage) = 0; |
||
37 | }; |
||
38 | |||
39 | using CompilationDatabasePluginRegistry = |
||
40 | llvm::Registry<CompilationDatabasePlugin>; |
||
41 | |||
42 | } // namespace tooling |
||
43 | } // namespace clang |
||
44 | |||
45 | #endif // LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H |