diff options
Diffstat (limited to 'lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r-- | lib/Bitcode/Reader/BitcodeReader.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 7f3be2b84a..3a385cbe38 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -840,7 +840,15 @@ bool BitcodeReader::ParseMetadata() { for (unsigned i = 1; i != RecordLength; ++i) Name[i-1] = Record[i]; MetadataContext &TheMetadata = Context.getMetadata(); - TheMetadata.MDHandlerNames[Name.str()] = Kind; + unsigned ExistingKind = TheMetadata.getMDKind(Name.str()); + if (ExistingKind == 0) { + unsigned NewKind = TheMetadata.registerMDKind(Name.str()); + assert (Kind == NewKind + && "Unable to handle custom metadata mismatch!"); + } else { + assert (ExistingKind == Kind + && "Unable to handle custom metadata mismatch!"); + } break; } } |