diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-04 17:36:40 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-04 17:36:40 +0000 |
commit | ad8a336b40370822fd95eadf2efdaa7d8122b983 (patch) | |
tree | cf73874162e49f08a8294b50fcee0a97dace8c29 /clang/lib/CodeGen/CGExprScalar.cpp | |
parent | 5673c0aacefd40f9eb760db2cb7dcfb7d7464d8d (diff) | |
download | bcm5719-llvm-ad8a336b40370822fd95eadf2efdaa7d8122b983.tar.gz bcm5719-llvm-ad8a336b40370822fd95eadf2efdaa7d8122b983.zip |
Implement AST, semantics, and CodeGen for C++ pseudo-destructor
expressions, e.g.,
p->~T()
when p is a pointer to a scalar type.
We don't currently diagnose errors when pseudo-destructor expressions
are used in any way other than by forming a call.
llvm-svn: 81009
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 4496c538d3c..8732dc91309 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -305,7 +305,17 @@ public: CGF.EmitCXXDeleteExpr(E); return 0; } - + + Value *VisitCXXPseudoDestructorExpr(const CXXPseudoDestructorExpr *E) { + // C++ [expr.pseudo]p1: + // The result shall only be used as the operand for the function call + // operator (), and the result of such a call has type void. The only + // effect is the evaluation of the postfix-expression before the dot or + // arrow. + CGF.EmitScalarExpr(E->getBase()); + return 0; + } + // Binary Operators. Value *EmitMul(const BinOpInfo &Ops) { if (CGF.getContext().getLangOptions().OverflowChecking |