Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-10 08:37:12

0001 //===- CompilationDatabasePluginRegistry.h ----------------------*- C++ -*-===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H
0010 #define LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H
0011 
0012 #include "clang/Support/Compiler.h"
0013 #include "clang/Tooling/CompilationDatabase.h"
0014 #include "llvm/Support/Registry.h"
0015 
0016 namespace clang {
0017 namespace tooling {
0018 
0019 /// Interface for compilation database plugins.
0020 ///
0021 /// A compilation database plugin allows the user to register custom compilation
0022 /// databases that are picked up as compilation database if the corresponding
0023 /// library is linked in. To register a plugin, declare a static variable like:
0024 ///
0025 /// \code
0026 /// static CompilationDatabasePluginRegistry::Add<MyDatabasePlugin>
0027 /// X("my-compilation-database", "Reads my own compilation database");
0028 /// \endcode
0029 class CompilationDatabasePlugin {
0030 public:
0031   virtual ~CompilationDatabasePlugin();
0032 
0033   /// Loads a compilation database from a build directory.
0034   ///
0035   /// \see CompilationDatabase::loadFromDirectory().
0036   virtual std::unique_ptr<CompilationDatabase>
0037   loadFromDirectory(StringRef Directory, std::string &ErrorMessage) = 0;
0038 };
0039 
0040 using CompilationDatabasePluginRegistry =
0041     llvm::Registry<CompilationDatabasePlugin>;
0042 
0043 } // namespace tooling
0044 } // namespace clang
0045 
0046 namespace llvm {
0047 extern template class CLANG_TEMPLATE_ABI
0048     Registry<clang::tooling::CompilationDatabasePlugin>;
0049 } // namespace llvm
0050 
0051 #endif // LLVM_CLANG_TOOLING_COMPILATIONDATABASEPLUGINREGISTRY_H