diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-01-21 18:05:27 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-01-21 18:05:27 +0000 |
commit | f5d8f466c3eebaffc51468812bdcbe7f0fe4891a (patch) | |
tree | 52fd20cb43a74996551e5b3e164c1bf87ff7f881 /test/CodeGenCXX/nrvo.cpp | |
parent | b939a1987318f802fd25f89e15ae7d2423161cac (diff) |
Promote the static getNRVOCandidate() function, which computed the
NRVO candidate for a return statement, to
Sema::getCopyElisionCandidate(), and teach it enough to also determine
the NRVO candidate for a throw expression. We still don't use the
latter information, however.
Along the way, implement core issue 1148, which eliminates copy
elision from catch parameters and clarifies that copy elision cannot
occur from function parameters (which we already implemented).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@123982 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/nrvo.cpp')
-rw-r--r-- | test/CodeGenCXX/nrvo.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/CodeGenCXX/nrvo.cpp b/test/CodeGenCXX/nrvo.cpp index 8d19b1effe..ecf6afdc7c 100644 --- a/test/CodeGenCXX/nrvo.cpp +++ b/test/CodeGenCXX/nrvo.cpp @@ -131,3 +131,16 @@ X test4(bool B) { // CHECK: tail call void @exit(i32 1) exit(1); } + +// CHECK-EH: define void @_Z5test5 +void may_throw(); +X test5() { + try { + may_throw(); + } catch (X x) { + // CHECK-EH: invoke void @_ZN1XC1ERKS_ + // CHECK-EH: call void @__cxa_end_catch() + // CHECK-EH: ret void + return x; + } +} |