2016-05-13 17:27:54 +08:00
|
|
|
//===-- InMemorySymbolIndex.cpp--------------------------------------------===//
|
2016-04-20 20:43:43 +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
|
|
|
#include "InMemorySymbolIndex.h"
|
2016-04-20 20:43:43 +08:00
|
|
|
|
2017-02-28 16:13:15 +08:00
|
|
|
using clang::find_all_symbols::SymbolAndSignals;
|
2016-05-04 16:22:35 +08:00
|
|
|
|
2016-04-20 20:43:43 +08:00
|
|
|
namespace clang {
|
|
|
|
namespace include_fixer {
|
|
|
|
|
2016-05-13 17:27:54 +08:00
|
|
|
InMemorySymbolIndex::InMemorySymbolIndex(
|
2017-02-28 16:13:15 +08:00
|
|
|
const std::vector<SymbolAndSignals> &Symbols) {
|
2016-05-13 23:17:17 +08:00
|
|
|
for (const auto &Symbol : Symbols)
|
2017-02-28 16:13:15 +08:00
|
|
|
LookupTable[Symbol.Symbol.getName()].push_back(Symbol);
|
2016-05-04 16:22:35 +08:00
|
|
|
}
|
|
|
|
|
2017-02-28 16:13:15 +08:00
|
|
|
std::vector<SymbolAndSignals>
|
2016-05-13 17:27:54 +08:00
|
|
|
InMemorySymbolIndex::search(llvm::StringRef Identifier) {
|
2016-04-20 20:43:43 +08:00
|
|
|
auto I = LookupTable.find(Identifier);
|
|
|
|
if (I != LookupTable.end())
|
|
|
|
return I->second;
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace include_fixer
|
|
|
|
} // namespace clang
|