[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang-tools-extra / clang-include-fixer / YamlSymbolIndex.h
blob3c4f514401d180c739c0ca74f5bdb5dd2ac50696
1 //===-- YamlSymbolIndex.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 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_YAMLSYMBOLINDEX_H
10 #define LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_YAMLSYMBOLINDEX_H
12 #include "SymbolIndex.h"
13 #include "find-all-symbols/SymbolInfo.h"
14 #include "llvm/Support/ErrorOr.h"
15 #include <map>
16 #include <vector>
18 namespace clang {
19 namespace include_fixer {
21 /// Yaml format database.
22 class YamlSymbolIndex : public SymbolIndex {
23 public:
24 /// Create a new Yaml db from a file.
25 static llvm::ErrorOr<std::unique_ptr<YamlSymbolIndex>>
26 createFromFile(llvm::StringRef FilePath);
27 /// Look for a file called \c Name in \c Directory and all parent directories.
28 static llvm::ErrorOr<std::unique_ptr<YamlSymbolIndex>>
29 createFromDirectory(llvm::StringRef Directory, llvm::StringRef Name);
31 std::vector<find_all_symbols::SymbolAndSignals>
32 search(llvm::StringRef Identifier) override;
34 private:
35 explicit YamlSymbolIndex(
36 std::vector<find_all_symbols::SymbolAndSignals> Symbols)
37 : Symbols(std::move(Symbols)) {}
39 std::vector<find_all_symbols::SymbolAndSignals> Symbols;
42 } // namespace include_fixer
43 } // namespace clang
45 #endif // LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_YAMLSYMBOLINDEX_H