-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: ConstString::GetConstCStringAndSetMangledCounterPart() should up…
…date the value if the key exists already Summary: This issue came up because it caused problems in our unit tests. The StringPool did connect counterparts only once and silently ignored the values passed in subsequent calls. The simplest solution for the unit tests would be silent overwrite. In practice, however, it seems useful to assert that we never overwrite a different mangled counterpart. If we ever have mangled counterparts for other languages than C++, this makes it more likely to notice collisions. I added an assertion that allows the following cases: * inserting a new value * overwriting the empty string * overwriting with an identical value I fixed the unit tests, which used "random" strings and thus produced collisions. It would be even better if there was a way to reset or isolate the StringPool, but that's a different story. Reviewers: jingham, friss, labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D50536 llvm-svn: 339669
- Loading branch information
1 parent
c66d480
commit 2397a2b
Showing
2 changed files
with
43 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters