clang-tools  7.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"
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
llvm::StringRef Name
static cl::opt< std::string > Directory(cl::Positional, cl::Required, cl::desc("<Search Root Directory>"))
std::vector< find_all_symbols::SymbolAndSignals > search(llvm::StringRef Identifier) override
Search for all SymbolInfos corresponding to an identifier.
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.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
This class provides an interface for finding all SymbolInfos corresponding to a symbol name from a sy...
Definition: SymbolIndex.h:22
static llvm::ErrorOr< std::unique_ptr< YamlSymbolIndex > > createFromFile(llvm::StringRef FilePath)
Create a new Yaml db from a file.