]> granicus.if.org Git - clang/commitdiff
CodeGenModule::EmitVTableBitSetEntries: Add check for identical bit set entries.
authorPeter Collingbourne <peter@pcc.me.uk>
Tue, 24 Feb 2015 01:12:53 +0000 (01:12 +0000)
committerPeter Collingbourne <peter@pcc.me.uk>
Tue, 24 Feb 2015 01:12:53 +0000 (01:12 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@230293 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGVTables.cpp

index 14116e498ee52e699660eb3408cf34f1ac9c460d..2e8471eeb6c71f8bfd7e369d2dbb65ff5b77d78f 100644 (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)