r232037 - Instead of dereferencing std::vector::end() (which is UB and causes failed assertions in debug builds with Visual Studio), use data() + size() to calculate the end iterator. Amends r231952.

Aaron Ballman aaron at aaronballman.com
Thu Mar 12 06:49:45 PDT 2015


Author: aaronballman
Date: Thu Mar 12 08:49:45 2015
New Revision: 232037

URL: http://llvm.org/viewvc/llvm-project?rev=232037&view=rev
Log:
Instead of dereferencing std::vector::end() (which is UB and causes failed assertions in debug builds with Visual Studio), use data() + size() to calculate the end iterator. Amends r231952.

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=232037&r1=232036&r2=232037&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Thu Mar 12 08:49:45 2015
@@ -3296,7 +3296,8 @@ MicrosoftCXXABI::getAddrOfCXXCopyCtorClo
   CodeGenFunction::RunCleanupsScope Cleanups(CGF);
 
   const auto *FPT = CD->getType()->castAs<FunctionProtoType>();
-  ConstExprIterator ArgBegin(ArgVec.data()), ArgEnd(&*ArgVec.end());
+  ConstExprIterator ArgBegin(ArgVec.data()),
+      ArgEnd(ArgVec.data() + ArgVec.size());
   CGF.EmitCallArgs(Args, FPT, ArgBegin, ArgEnd, CD, 1);
 
   // Insert any ABI-specific implicit constructor arguments.





More information about the cfe-commits mailing list