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

Peter Collingbourne peter at pcc.me.uk
Mon Feb 23 17:12:53 PST 2015


Author: pcc
Date: Mon Feb 23 19:12:53 2015
New Revision: 230293

URL: http://llvm.org/viewvc/llvm-project?rev=230293&view=rev
Log:
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.

Modified:
    cfe/trunk/lib/CodeGen/CGVTables.cpp

Modified: cfe/trunk/lib/CodeGen/CGVTables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGVTables.cpp?rev=230293&r1=230292&r2=230293&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGVTables.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGVTables.cpp Mon Feb 23 19:12:53 2015
@@ -876,6 +876,9 @@ void CodeGenModule::EmitVTableBitSetEntr
   // 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)





More information about the cfe-commits mailing list