32 lines · cpp
1//===-- InMemorySymbolIndex.cpp--------------------------------------------===//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-exception6//7//===----------------------------------------------------------------------===//8 9#include "InMemorySymbolIndex.h"10 11using clang::find_all_symbols::SymbolAndSignals;12 13namespace clang {14namespace include_fixer {15 16InMemorySymbolIndex::InMemorySymbolIndex(17 const std::vector<SymbolAndSignals> &Symbols) {18 for (const auto &Symbol : Symbols)19 LookupTable[std::string(Symbol.Symbol.getName())].push_back(Symbol);20}21 22std::vector<SymbolAndSignals>23InMemorySymbolIndex::search(llvm::StringRef Identifier) {24 auto I = LookupTable.find(Identifier);25 if (I != LookupTable.end())26 return I->second;27 return {};28}29 30} // namespace include_fixer31} // namespace clang32