[ms-cxxabi] Construct and destroy call arguments in the correct order
authorReid Kleckner <reid@kleckner.net>
Wed, 4 Dec 2013 19:23:12 +0000 (19:23 +0000)
committerReid Kleckner <reid@kleckner.net>
Wed, 4 Dec 2013 19:23:12 +0000 (19:23 +0000)
commitd4abf6549efb81da6ee9053af8bc7918d0a3b192
tree1f6992d9eafc8210adaf32c83dee1fb029b71a15
parent60fc878a5c311cbc77e7cb4146cdf683284a0316
[ms-cxxabi] Construct and destroy call arguments in the correct order

Summary:
MSVC destroys arguments in the callee from left to right.  Because C++
objects have to be destroyed in the reverse order of construction, Clang
has to construct arguments from right to left and destroy arguments from
left to right.

This patch fixes the ordering by reversing the order of evaluation of
all call arguments under the MS C++ ABI.

Fixes PR18035.

Reviewers: rsmith

Differential Revision: http://llvm-reviews.chandlerc.com/D2275

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@196402 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/TargetCXXABI.h
lib/CodeGen/CGCall.cpp
lib/CodeGen/CGClass.cpp
lib/CodeGen/CGDecl.cpp
lib/CodeGen/CGExprCXX.cpp
lib/CodeGen/CodeGenFunction.h
lib/Sema/SemaChecking.cpp
test/CodeGen/tbaa-ms-abi.cpp
test/CodeGenCXX/microsoft-abi-arg-order.cpp [new file with mode: 0644]
test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm [new file with mode: 0644]