2016-05-13 17:27:54 +08:00
|
|
|
//===-- InMemorySymbolIndex.cpp--------------------------------------------===//
|
2016-04-20 20:43:43 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2016-04-20 20:43:43 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
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)
|
2020-01-29 03:23:46 +08:00
|
|
|
LookupTable[std::string(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) {
|
2020-01-29 03:23:46 +08:00
|
|
|
auto I = LookupTable.find(std::string(Identifier));
|
2016-04-20 20:43:43 +08:00
|
|
|
if (I != LookupTable.end())
|
|
|
|
return I->second;
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace include_fixer
|
|
|
|
} // namespace clang
|