[Lldb-commits] [PATCH] D50536: Fix: ConstString::GetConstCStringAndSetMangledCounterPart() should update the value if the key exists already
Frederic Riss via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 10 09:25:21 PDT 2018
friss added inline comments.
================
Comment at: source/Utility/ConstString.cpp:123-126
+ assert((map.find(demangled) == map.end() || strlen(map[demangled]) == 0 ||
+ map[demangled] == mangled_ccstr) &&
+ "The demangled string must have a unique counterpart or otherwise "
+ "it must be empty");
----------------
In an asserts build, this is going to d a bunch of additional lookups. Can we move the assert after the try_emplace and basically assert that entry.second == nullptr || !strcmp(mangled_ccstr, entry.second).
(It's unclear to me whether a pointer comparison is enough to test string equality in this case, do we know that everything passed to this function has been uniqued?)
https://reviews.llvm.org/D50536
More information about the lldb-commits
mailing list