We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4510071 commit 2fee5efCopy full SHA for 2fee5ef
clang/lib/AST/ByteCode/Program.cpp
@@ -18,14 +18,12 @@ using namespace clang;
18
using namespace clang::interp;
19
20
unsigned Program::getOrCreateNativePointer(const void *Ptr) {
21
- auto It = NativePointerIndices.find(Ptr);
22
- if (It != NativePointerIndices.end())
23
- return It->second;
+ auto [It, Inserted] =
+ NativePointerIndices.try_emplace(Ptr, NativePointers.size());
+ if (Inserted)
24
+ NativePointers.push_back(Ptr);
25
- unsigned Idx = NativePointers.size();
26
- NativePointers.push_back(Ptr);
27
- NativePointerIndices[Ptr] = Idx;
28
- return Idx;
+ return It->second;
29
}
30
31
const void *Program::getNativePointer(unsigned Idx) {
0 commit comments