diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-02 02:11:36 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-02-02 02:11:36 +0000 |
commit | 4be2c3692112a841f1baf606bf4fcfaff163c2cb (patch) | |
tree | 7af7363ea59b1ab2f07a403daf7a2d29f91827b4 /clang/lib/AST/ExprClassification.cpp | |
parent | 26c777c409bf2d3178055cdcb146ecd72f179adb (diff) | |
download | bcm5719-llvm-4be2c3692112a841f1baf606bf4fcfaff163c2cb.tar.gz bcm5719-llvm-4be2c3692112a841f1baf606bf4fcfaff163c2cb.zip |
Correctly classify T{} as an array temporary if T is an array of class type with nontrivial destructor.
llvm-svn: 174261
Diffstat (limited to 'clang/lib/AST/ExprClassification.cpp')
-rw-r--r-- | clang/lib/AST/ExprClassification.cpp | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/clang/lib/AST/ExprClassification.cpp b/clang/lib/AST/ExprClassification.cpp index a064541ffc7..61bc3e2de5c 100644 --- a/clang/lib/AST/ExprClassification.cpp +++ b/clang/lib/AST/ExprClassification.cpp @@ -34,21 +34,6 @@ static Cl::Kinds ClassifyConditional(ASTContext &Ctx, static Cl::ModifiableType IsModifiable(ASTContext &Ctx, const Expr *E, Cl::Kinds Kind, SourceLocation &Loc); -static Cl::Kinds ClassifyExprValueKind(const LangOptions &Lang, - const Expr *E, - ExprValueKind Kind) { - switch (Kind) { - case VK_RValue: - return Lang.CPlusPlus && E->getType()->isRecordType() ? - Cl::CL_ClassTemporary : Cl::CL_PRValue; - case VK_LValue: - return Cl::CL_LValue; - case VK_XValue: - return Cl::CL_XValue; - } - llvm_unreachable("Invalid value category of implicit cast."); -} - Cl Expr::ClassifyImpl(ASTContext &Ctx, SourceLocation *Loc) const { assert(!TR->isReferenceType() && "Expressions can't have reference type."); @@ -100,6 +85,20 @@ static Cl::Kinds ClassifyTemporary(QualType T) { return Cl::CL_PRValue; } +static Cl::Kinds ClassifyExprValueKind(const LangOptions &Lang, + const Expr *E, + ExprValueKind Kind) { + switch (Kind) { + case VK_RValue: + return Lang.CPlusPlus ? ClassifyTemporary(E->getType()) : Cl::CL_PRValue; + case VK_LValue: + return Cl::CL_LValue; + case VK_XValue: + return Cl::CL_XValue; + } + llvm_unreachable("Invalid value category of implicit cast."); +} + static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { // This function takes the first stab at classifying expressions. const LangOptions &Lang = Ctx.getLangOpts(); |