blob: ca2d73996d3e8708d26049f6416412fa0de44b97 [file] [log] [blame]
//===-- SymbolIndexManager.h - Managing multiple SymbolIndices --*- C++ -*-===//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include "SymbolIndex.h"
#include "find-all-symbols/SymbolInfo.h"
#include "llvm/ADT/StringRef.h"
#ifdef _MSC_VER
// Disable warnings from ppltasks.h transitively included by <future>.
#pragma warning(push)
#pragma warning(disable:4530)
#include <future>
#ifdef _MSC_VER
#pragma warning(pop)
namespace clang {
namespace include_fixer {
/// This class provides an interface for finding the header files corresponding
/// to an identifier in the source code from multiple symbol databases.
class SymbolIndexManager {
void addSymbolIndex(std::function<std::unique_ptr<SymbolIndex>()> F) {
auto Strategy = std::launch::async;
auto Strategy = std::launch::deferred;
SymbolIndices.push_back(std::async(Strategy, F));
/// Search for header files to be included for an identifier.
/// \param Identifier The identifier being searched for. May or may not be
/// fully qualified.
/// \param IsNestedSearch Whether searching nested classes. If true, the
/// method tries to strip identifier name parts from the end until it
/// finds the corresponding candidates in database (e.g for identifier
/// "b::foo", the method will try to find "b" if it fails to find
/// "b::foo").
/// \returns A list of symbol candidates.
search(llvm::StringRef Identifier, bool IsNestedSearch = true,
llvm::StringRef FileName = "") const;
std::vector<std::shared_future<std::unique_ptr<SymbolIndex>>> SymbolIndices;
} // namespace include_fixer
} // namespace clang