diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-05 00:46:14 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-05 00:46:14 +0000 |
| commit | 211c8ddb5b500ed84833751363d0cfe1115f4dd3 (patch) | |
| tree | 5b0d083ceed44493f376a802f9406073a0bffe35 /lib/CodeGen/CGExprConstant.cpp | |
| parent | 8c47432b747d51e40a1e23a99403e78c2c864bd1 (diff) | |
| download | clang-211c8ddb5b500ed84833751363d0cfe1115f4dd3.tar.gz clang-211c8ddb5b500ed84833751363d0cfe1115f4dd3.tar.bz2 clang-211c8ddb5b500ed84833751363d0cfe1115f4dd3.tar.xz | |
Model temporary lifetime-extension explicitly in the AST. Use this model to
handle temporaries which have been lifetime-extended to static storage duration
within constant expressions. This correctly handles nested lifetime extension
(through reference members of aggregates in aggregate initializers) but
non-constant-expression emission hasn't yet been updated to do the same.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183283 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExprConstant.cpp')
| -rw-r--r-- | lib/CodeGen/CGExprConstant.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprConstant.cpp b/lib/CodeGen/CGExprConstant.cpp index f5c8187c26..ca331cc92b 100644 --- a/lib/CodeGen/CGExprConstant.cpp +++ b/lib/CodeGen/CGExprConstant.cpp @@ -1003,6 +1003,15 @@ public: case Expr::CXXUuidofExprClass: { return CGM.GetAddrOfUuidDescriptor(cast<CXXUuidofExpr>(E)); } + case Expr::MaterializeTemporaryExprClass: { + MaterializeTemporaryExpr *MTE = cast<MaterializeTemporaryExpr>(E); + assert(MTE->getStorageDuration() == SD_Static); + SmallVector<const Expr *, 2> CommaLHSs; + SmallVector<SubobjectAdjustment, 2> Adjustments; + const Expr *Inner = MTE->GetTemporaryExpr() + ->skipRValueSubobjectAdjustments(CommaLHSs, Adjustments); + return CGM.GetAddrOfGlobalTemporary(MTE, Inner); + } } return 0; |
