CodeGenModule::EmitVTableBitSetEntries: Add check for identical bit set entries.

No two elements of this array should be the same, but the standard library
may pass the same element as both arguments to this function.

llvm-svn: 230293
This commit is contained in:
Peter Collingbourne 2015-02-24 01:12:53 +00:00
parent a586ea13a4
commit 4794190d81
1 changed files with 3 additions and 0 deletions

View File

@ -876,6 +876,9 @@ void CodeGenModule::EmitVTableBitSetEntries(llvm::GlobalVariable *VTable,
// Sort the bit set entries for determinism.
std::sort(BitsetEntries.begin(), BitsetEntries.end(), [](llvm::MDTuple *T1,
llvm::MDTuple *T2) {
if (T1 == T2)
return false;
StringRef S1 = cast<llvm::MDString>(T1->getOperand(0))->getString();
StringRef S2 = cast<llvm::MDString>(T2->getOperand(0))->getString();
if (S1 < S2)