@@ -1515,15 +1515,15 @@ void RuntimeDyldELF::resolveAArch64Branch(unsigned SectionID,
1515
1515
uint64_t Offset = RelI->getOffset ();
1516
1516
unsigned RelType = RelI->getType ();
1517
1517
// Look for an existing stub.
1518
- StubMap::const_iterator i = Stubs.find (Value);
1519
- if (i != Stubs. end () ) {
1518
+ auto [It, Inserted] = Stubs.try_emplace (Value);
1519
+ if (!Inserted ) {
1520
1520
resolveRelocation (Section, Offset,
1521
- Section.getLoadAddressWithOffset (i ->second ), RelType, 0 );
1521
+ Section.getLoadAddressWithOffset (It ->second ), RelType, 0 );
1522
1522
LLVM_DEBUG (dbgs () << " Stub function found\n " );
1523
1523
} else if (!resolveAArch64ShortBranch (SectionID, RelI, Value)) {
1524
1524
// Create a new stub function.
1525
1525
LLVM_DEBUG (dbgs () << " Create a new stub function\n " );
1526
- Stubs[Value] = Section.getStubOffset ();
1526
+ It-> second = Section.getStubOffset ();
1527
1527
uint8_t *StubTargetAddr = createStubFunction (
1528
1528
Section.getAddressWithOffset (Section.getStubOffset ()));
1529
1529
@@ -1837,15 +1837,15 @@ RuntimeDyldELF::processRelocationRef(
1837
1837
SectionEntry &Section = Sections[SectionID];
1838
1838
1839
1839
// Look up for existing stub.
1840
- StubMap::const_iterator i = Stubs.find (Value);
1841
- if (i != Stubs. end () ) {
1842
- RelocationEntry RE (SectionID, Offset, RelType, i ->second );
1840
+ auto [It, Inserted] = Stubs.try_emplace (Value);
1841
+ if (!Inserted ) {
1842
+ RelocationEntry RE (SectionID, Offset, RelType, It ->second );
1843
1843
addRelocationForSection (RE, SectionID);
1844
1844
LLVM_DEBUG (dbgs () << " Stub function found\n " );
1845
1845
} else {
1846
1846
// Create a new stub function.
1847
1847
LLVM_DEBUG (dbgs () << " Create a new stub function\n " );
1848
- Stubs[Value] = Section.getStubOffset ();
1848
+ It-> second = Section.getStubOffset ();
1849
1849
1850
1850
unsigned AbiVariant = Obj.getPlatformFlags ();
1851
1851
@@ -2075,10 +2075,10 @@ RuntimeDyldELF::processRelocationRef(
2075
2075
SectionEntry &Section = Sections[SectionID];
2076
2076
2077
2077
// Look for an existing stub.
2078
- StubMap::const_iterator i = Stubs.find (Value);
2078
+ auto [It, Inserted] = Stubs.try_emplace (Value);
2079
2079
uintptr_t StubAddress;
2080
- if (i != Stubs. end () ) {
2081
- StubAddress = uintptr_t (Section.getAddressWithOffset (i ->second ));
2080
+ if (!Inserted ) {
2081
+ StubAddress = uintptr_t (Section.getAddressWithOffset (It ->second ));
2082
2082
LLVM_DEBUG (dbgs () << " Stub function found\n " );
2083
2083
} else {
2084
2084
// Create a new stub function.
@@ -2089,7 +2089,7 @@ RuntimeDyldELF::processRelocationRef(
2089
2089
alignTo (BaseAddress + Section.getStubOffset (), getStubAlignment ());
2090
2090
unsigned StubOffset = StubAddress - BaseAddress;
2091
2091
2092
- Stubs[Value] = StubOffset;
2092
+ It-> second = StubOffset;
2093
2093
createStubFunction ((uint8_t *)StubAddress);
2094
2094
RelocationEntry RE (SectionID, StubOffset + 8 , ELF::R_390_64,
2095
2095
Value.Offset );
0 commit comments