r242622 - [CodeGen] Don't dereference vector::end if the vector can be empty

Benjamin Kramer benny.kra at googlemail.com
Sat Jul 18 13:30:11 PDT 2015


Author: d0k
Date: Sat Jul 18 15:30:11 2015
New Revision: 242622

URL: http://llvm.org/viewvc/llvm-project?rev=242622&view=rev
Log:
[CodeGen] Don't dereference vector::end if the vector can be empty

MSVC complains about this in debug mode. NFC.

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

Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=242622&r1=242621&r2=242622&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Sat Jul 18 15:30:11 2015
@@ -3803,7 +3803,7 @@ MicrosoftCXXABI::getAddrOfCXXCtorClosure
   CodeGenFunction::RunCleanupsScope Cleanups(CGF);
 
   const auto *FPT = CD->getType()->castAs<FunctionProtoType>();
-  CGF.EmitCallArgs(Args, FPT, &*ArgVec.begin(), &*ArgVec.end(), CD,
+  CGF.EmitCallArgs(Args, FPT, ArgVec.data(), ArgVec.data() + ArgVec.size(), CD,
                    IsCopy ? 1 : 0);
 
   // Insert any ABI-specific implicit constructor arguments.





More information about the cfe-commits mailing list