summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCall.h
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2013-06-21 12:45:15 +0000
committerReid Kleckner <reid@kleckner.net>2013-06-21 12:45:15 +0000
commit23f4c4b64f1a35be406c66ab4e0113a8522b4905 (patch)
tree32d612ab8a5015a669c0c918d0843099be1cf479 /clang/lib/CodeGen/CGCall.h
parentae4e1ec4e6c616e50794d895555f8ebb49dd05f5 (diff)
downloadbcm5719-llvm-23f4c4b64f1a35be406c66ab4e0113a8522b4905.tar.gz
bcm5719-llvm-23f4c4b64f1a35be406c66ab4e0113a8522b4905.zip
[ms-cxxabi] Destroy temporary record arguments in the callee
Itanium destroys them in the caller at the end of the full expression, but MSVC destroys them in the callee. This is further complicated by the need to emit EH-only destructor cleanups in the caller. This should help clang compile MSVC's debug iterators more correctly. There is still an outstanding issue in PR5064 of a memcpy emitted by the LLVM backend, which is not correct for C++ records. Fixes PR16226. Reviewers: rjmccall Differential Revision: http://llvm-reviews.chandlerc.com/D929 llvm-svn: 184543
Diffstat (limited to 'clang/lib/CodeGen/CGCall.h')
-rw-r--r--clang/lib/CodeGen/CGCall.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCall.h b/clang/lib/CodeGen/CGCall.h
index 85c3320ec0e..04e600536e5 100644
--- a/clang/lib/CodeGen/CGCall.h
+++ b/clang/lib/CodeGen/CGCall.h
@@ -16,6 +16,7 @@
#define CLANG_CODEGEN_CGCALL_H
#include "CGValue.h"
+#include "EHScopeStack.h"
#include "clang/AST/CanonicalType.h"
#include "clang/AST/Type.h"
#include "llvm/ADT/FoldingSet.h"
@@ -67,6 +68,14 @@ namespace CodeGen {
llvm::Value *ToUse;
};
+ struct CallArgCleanup {
+ EHScopeStack::stable_iterator Cleanup;
+
+ /// The "is active" insertion point. This instruction is temporary and
+ /// will be removed after insertion.
+ llvm::Instruction *IsActiveIP;
+ };
+
void add(RValue rvalue, QualType type, bool needscopy = false) {
push_back(CallArg(rvalue, type, needscopy));
}
@@ -92,8 +101,25 @@ namespace CodeGen {
writeback_iterator writeback_begin() const { return Writebacks.begin(); }
writeback_iterator writeback_end() const { return Writebacks.end(); }
+ void addArgCleanupDeactivation(EHScopeStack::stable_iterator Cleanup,
+ llvm::Instruction *IsActiveIP) {
+ CallArgCleanup ArgCleanup;
+ ArgCleanup.Cleanup = Cleanup;
+ ArgCleanup.IsActiveIP = IsActiveIP;
+ CleanupsToDeactivate.push_back(ArgCleanup);
+ }
+
+ ArrayRef<CallArgCleanup> getCleanupsToDeactivate() const {
+ return CleanupsToDeactivate;
+ }
+
private:
SmallVector<Writeback, 1> Writebacks;
+
+ /// Deactivate these cleanups immediately before making the call. This
+ /// is used to cleanup objects that are owned by the callee once the call
+ /// occurs.
+ SmallVector<CallArgCleanup, 1> CleanupsToDeactivate;
};
/// A class for recording the number of arguments that a function
OpenPOWER on IntegriCloud