2016-05-13 17:27:54 +08:00
|
|
|
//===-- SymbolIndexManager.h - Managing multiple SymbolIndices --*- C++ -*-===//
|
2016-05-04 16:22:35 +08:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-05-13 17:27:54 +08:00
|
|
|
#ifndef LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_SYMBOLINDEXMANAGER_H
|
|
|
|
#define LLVM_CLANG_TOOLS_EXTRA_INCLUDE_FIXER_SYMBOLINDEXMANAGER_H
|
2016-05-04 16:22:35 +08:00
|
|
|
|
2016-05-13 17:27:54 +08:00
|
|
|
#include "SymbolIndex.h"
|
2016-07-08 17:10:29 +08:00
|
|
|
#include "find-all-symbols/SymbolInfo.h"
|
2016-05-04 16:22:35 +08:00
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
|
|
|
|
|
|
namespace clang {
|
|
|
|
namespace include_fixer {
|
|
|
|
|
|
|
|
/// This class provides an interface for finding the header files corresponding
|
|
|
|
/// to an indentifier in the source code from multiple symbol databases.
|
2016-05-13 17:27:54 +08:00
|
|
|
class SymbolIndexManager {
|
2016-05-04 16:22:35 +08:00
|
|
|
public:
|
2016-05-13 17:27:54 +08:00
|
|
|
void addSymbolIndex(std::unique_ptr<SymbolIndex> DB) {
|
|
|
|
SymbolIndices.push_back(std::move(DB));
|
2016-05-04 16:22:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Search for header files to be included for an identifier.
|
|
|
|
/// \param Identifier The identifier being searched for. May or may not be
|
|
|
|
/// fully qualified.
|
2016-08-02 18:43:10 +08:00
|
|
|
/// \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.
|
2016-07-08 17:10:29 +08:00
|
|
|
std::vector<find_all_symbols::SymbolInfo>
|
2016-08-02 18:43:10 +08:00
|
|
|
search(llvm::StringRef Identifier, bool IsNestedSearch = true) const;
|
2016-05-04 16:22:35 +08:00
|
|
|
|
|
|
|
private:
|
2016-05-13 17:27:54 +08:00
|
|
|
std::vector<std::unique_ptr<SymbolIndex>> SymbolIndices;
|
2016-05-04 16:22:35 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace include_fixer
|
|
|
|
} // namespace clang
|
|
|
|
|
|
|
|
#endif
|