clang-tools 8.0.0

YamlSymbolIndex.h
Go to the documentation of this file.
1 //===-- YamlSymbolIndex.h ---------------------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_YAMLSYMBOLINDEX_H
11 #define LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_YAMLSYMBOLINDEX_H
12
13 #include "SymbolIndex.h"
14 #include "find-all-symbols/SymbolInfo.h"
15 #include "llvm/Support/ErrorOr.h"
16 #include <map>
17 #include <vector>
18
19 namespace clang {
20 namespace include_fixer {
21
22 /// Yaml format database.
23 class YamlSymbolIndex : public SymbolIndex {
24 public:
25 /// Create a new Yaml db from a file.
26 static llvm::ErrorOr<std::unique_ptr<YamlSymbolIndex>>
27 createFromFile(llvm::StringRef FilePath);
28 /// Look for a file called \c Name in \c Directory and all parent directories.
29 static llvm::ErrorOr<std::unique_ptr<YamlSymbolIndex>>
30 createFromDirectory(llvm::StringRef Directory, llvm::StringRef Name);
31
32 std::vector<find_all_symbols::SymbolAndSignals>
33 search(llvm::StringRef Identifier) override;
34
35 private:
36 explicit YamlSymbolIndex(
37 std::vector<find_all_symbols::SymbolAndSignals> Symbols)
38 : Symbols(std::move(Symbols)) {}
39
40 std::vector<find_all_symbols::SymbolAndSignals> Symbols;
41 };
42
43 } // namespace include_fixer
44 } // namespace clang
45
46 #endif // LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_YAMLSYMBOLINDEX_H
SymbolInfo.h
Directory
static cl::opt< std::string > Directory(cl::Positional, cl::Required, cl::desc("<Search Root Directory>"))
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:51
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:36
clang::include_fixer::YamlSymbolIndex
Yaml format database.
Definition: YamlSymbolIndex.h:23
Name
static constexpr llvm::StringLiteral Name
Definition: UppercaseLiteralSuffixCheck.cpp:28
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ChangeNamespace.cpp:18
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:22
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:26