summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2013-12-04 19:23:12 +0000
committerReid Kleckner <reid@kleckner.net>2013-12-04 19:23:12 +0000
commit739756c0f925fbb967109f4ba289d26be69c9c0a (patch)
tree6f6102249a4aee2dd120cafc29141fbb42feb290 /clang/lib/Sema/SemaChecking.cpp
parent91a9b247d473cebc23cee55309aecc56a0c29f64 (diff)
downloadbcm5719-llvm-739756c0f925fbb967109f4ba289d26be69c9c0a.tar.gz
bcm5719-llvm-739756c0f925fbb967109f4ba289d26be69c9c0a.zip
[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 llvm-svn: 196402
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 0b95c48d4f8..9e711c63321 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6190,8 +6190,9 @@ bool Sema::CheckParmsForFunctionDef(ParmVarDecl *const *P,
// MSVC destroys objects passed by value in the callee. Therefore a
// function definition which takes such a parameter must be able to call the
// object's destructor.
- if (getLangOpts().CPlusPlus &&
- Context.getTargetInfo().getCXXABI().isArgumentDestroyedByCallee()) {
+ if (getLangOpts().CPlusPlus && Context.getTargetInfo()
+ .getCXXABI()
+ .areArgsDestroyedLeftToRightInCallee()) {
if (const RecordType *RT = Param->getType()->getAs<RecordType>())
FinalizeVarWithDestructor(Param, RT);
}
OpenPOWER on IntegriCloud