mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 15:46:45 +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>
|
std::vector<SymbolAndSignals>
|
||||||
InMemorySymbolIndex::search(llvm::StringRef Identifier) {
|
InMemorySymbolIndex::search(llvm::StringRef Identifier) {
|
||||||
auto I = LookupTable.find(std::string(Identifier));
|
auto I = LookupTable.find(Identifier);
|
||||||
if (I != LookupTable.end())
|
if (I != LookupTable.end())
|
||||||
return I->second;
|
return I->second;
|
||||||
return {};
|
return {};
|
||||||
|
@ -27,7 +27,8 @@ public:
|
|||||||
search(llvm::StringRef Identifier) override;
|
search(llvm::StringRef Identifier) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, std::vector<find_all_symbols::SymbolAndSignals>>
|
std::map<std::string, std::vector<find_all_symbols::SymbolAndSignals>,
|
||||||
|
std::less<>>
|
||||||
LookupTable;
|
LookupTable;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user