clang-tools 19.0.0git
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"
14#include "llvm/Support/ErrorOr.h"
15#include <map>
16#include <vector>
17
18namespace clang {
19namespace include_fixer {
20
21/// Yaml format database.
23public:
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
34private:
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
llvm::SmallString< 256U > Name
llvm::StringRef Directory
This class provides an interface for finding all SymbolInfos corresponding to a symbol name from a sy...
Definition: SymbolIndex.h:21
static llvm::ErrorOr< std::unique_ptr< YamlSymbolIndex > > createFromFile(llvm::StringRef FilePath)
Create a new Yaml db from a file.
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++ -*-===//