clang-tools 10.0.0

YamlSymbolIndex.h
Go to the documentation of this file.
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 //===----------------------------------------------------------------------===//
8
9 #ifndef LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_YAMLSYMBOLINDEX_H
10 #define LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_YAMLSYMBOLINDEX_H
11
12 #include "SymbolIndex.h"
13 #include "find-all-symbols/SymbolInfo.h"
14 #include "llvm/Support/ErrorOr.h"
15 #include <map>
16 #include <vector>
17
18 namespace clang {
19 namespace include_fixer {
20
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);
30
31 std::vector<find_all_symbols::SymbolAndSignals>
32 search(llvm::StringRef Identifier) override;
33
34 private:
35 explicit YamlSymbolIndex(
36 std::vector<find_all_symbols::SymbolAndSignals> Symbols)
37 : Symbols(std::move(Symbols)) {}
38
39 std::vector<find_all_symbols::SymbolAndSignals> Symbols;
40 };
41
42 } // namespace include_fixer
43 } // namespace clang
44
45 #endif // LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_YAMLSYMBOLINDEX_H
SymbolInfo.h
clang::include_fixer::YamlSymbolIndex::search
std::vector< find_all_symbols::SymbolAndSignals > search(llvm::StringRef Identifier) override
Search for all SymbolInfos corresponding to an identifier.
Definition: YamlSymbolIndex.cpp:50
clang::include_fixer::YamlSymbolIndex::createFromDirectory
static llvm::ErrorOr< std::unique_ptr< YamlSymbolIndex > > createFromDirectory(llvm::StringRef Directory, llvm::StringRef Name)
Look for a file called Name in Directory and all parent directories.
Definition: YamlSymbolIndex.cpp:35
clang::include_fixer::YamlSymbolIndex
Yaml format database.
Definition: YamlSymbolIndex.h:22
Name
static constexpr llvm::StringLiteral Name
Definition: UppercaseLiteralSuffixCheck.cpp:27
Directory
llvm::StringRef Directory
Definition: Serialization.cpp:387
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27
SymbolIndex.h
clang::include_fixer::SymbolIndex
This class provides an interface for finding all SymbolInfos corresponding to a symbol name from a sy...
Definition: SymbolIndex.h:21
clang::include_fixer::YamlSymbolIndex::createFromFile
static llvm::ErrorOr< std::unique_ptr< YamlSymbolIndex > > createFromFile(llvm::StringRef FilePath)
Create a new Yaml db from a file.
Definition: YamlSymbolIndex.cpp:25