diff options
| author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-12-05 01:41:34 +0000 |
|---|---|---|
| committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-12-05 01:41:34 +0000 |
| commit | c1a664fea2434de49d7d626a7eef38105161f712 (patch) | |
| tree | e2a198186113dee17edf647a71596767acc96b4a /llvm/lib | |
| parent | 221262996a7a81a4775879420e1f4e3f84a98ccd (diff) | |
| download | bcm5719-llvm-c1a664fea2434de49d7d626a7eef38105161f712.tar.gz bcm5719-llvm-c1a664fea2434de49d7d626a7eef38105161f712.zip | |
IR: Stop relying on GetStringMapEntryFromValue()
It relies on undefined behaviour.
llvm-svn: 223438
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/IR/Metadata.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index 27ba9f7a87b..3a7c293bcdd 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -48,11 +48,13 @@ MDString *MDString::get(LLVMContext &Context, StringRef Str) { bool WasInserted = Store.insert(Entry); (void)WasInserted; assert(WasInserted && "Expected entry to be inserted"); + Entry->second.Entry = Entry; return &Entry->second; } StringRef MDString::getString() const { - return StringMapEntry<MDString>::GetStringMapEntryFromValue(*this).first(); + assert(Entry && "Expected to find string map entry"); + return Entry->first(); } //===----------------------------------------------------------------------===// |

