Skip to content

Commit dada3c3

Browse files
[libclang] Avoid repeated hash lookups (NFC) (llvm#111087)
1 parent c7895f0 commit dada3c3

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

clang/tools/libclang/CXIndexDataConsumer.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -952,18 +952,12 @@ void CXIndexDataConsumer::addContainerInMap(const DeclContext *DC,
952952
if (!DC)
953953
return;
954954

955-
ContainerMapTy::iterator I = ContainerMap.find(DC);
956-
if (I == ContainerMap.end()) {
957-
if (container)
958-
ContainerMap[DC] = container;
959-
return;
960-
}
961955
// Allow changing the container of a previously seen DeclContext so we
962956
// can handle invalid user code, like a function re-definition.
963957
if (container)
964-
I->second = container;
958+
ContainerMap[DC] = container;
965959
else
966-
ContainerMap.erase(I);
960+
ContainerMap.erase(DC);
967961
}
968962

969963
CXIdxClientEntity CXIndexDataConsumer::getClientEntity(const Decl *D) const {

0 commit comments

Comments
 (0)