[llvm-commits] [llvm] r158582 - /llvm/trunk/lib/Support/Unix/Signals.inc

Chandler Carruth chandlerc at gmail.com
Fri Jun 15 17:44:07 PDT 2012


Author: chandlerc
Date: Fri Jun 15 19:44:07 2012
New Revision: 158582

URL: http://llvm.org/viewvc/llvm-project?rev=158582&view=rev
Log:
Don't call 'FilesToRemove[0]' when the vector is empty, even to compute
the address of it. Found by a checking STL implementation used on
a dragonegg builder. Sorry about this one. =/

Modified:
    llvm/trunk/lib/Support/Unix/Signals.inc

Modified: llvm/trunk/lib/Support/Unix/Signals.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Signals.inc?rev=158582&r1=158581&r2=158582&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Signals.inc (original)
+++ llvm/trunk/lib/Support/Unix/Signals.inc Fri Jun 15 19:44:07 2012
@@ -189,7 +189,7 @@
 bool llvm::sys::RemoveFileOnSignal(const sys::Path &Filename,
                                    std::string* ErrMsg) {
   SignalsMutex.acquire();
-  std::string *OldPtr = &FilesToRemove[0];
+  std::string *OldPtr = FilesToRemove.empty() ? 0 : &FilesToRemove[0];
   FilesToRemove.push_back(Filename.str());
 
   // We want to call 'c_str()' on every std::string in this vector so that if





More information about the llvm-commits mailing list