1 //===-- YamlSymbolIndex.h ---------------------------------------*- C++ -*-===//
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
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"
19 namespace include_fixer
{
21 /// Yaml format database.
22 class YamlSymbolIndex
: public SymbolIndex
{
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
;
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
45 #endif // LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_YAMLSYMBOLINDEX_H