aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Bitcode
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Bitcode')
-rw-r--r--lib/Bitcode/Reader/BitcodeReader.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp
index 7f3be2b..3a385cb 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;
}
}