mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-16 04:36:31 +00:00
[clang-include-fixer] Use heterogenous lookups with std::map (NFC) (#115113)
Heterogenous lookups allow us to call find with StringRef, avoiding a temporary heap allocation of std::string.
This commit is contained in:
parent
6219c80839
commit
b7ee03ffb8
@ -21,7 +21,7 @@ InMemorySymbolIndex::InMemorySymbolIndex(
|
||||
|
||||
std::vector<SymbolAndSignals>
|
||||
InMemorySymbolIndex::search(llvm::StringRef Identifier) {
|
||||
auto I = LookupTable.find(std::string(Identifier));
|
||||
auto I = LookupTable.find(Identifier);
|
||||
if (I != LookupTable.end())
|
||||
return I->second;
|
||||
return {};
|
||||
|
@ -27,7 +27,8 @@ public:
|
||||
search(llvm::StringRef Identifier) override;
|
||||
|
||||
private:
|
||||
std::map<std::string, std::vector<find_all_symbols::SymbolAndSignals>>
|
||||
std::map<std::string, std::vector<find_all_symbols::SymbolAndSignals>,
|
||||
std::less<>>
|
||||
LookupTable;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user