diff options
author | Peter Collingbourne <peter@pcc.me.uk> | 2011-04-15 00:35:48 +0000 |
---|---|---|
committer | Peter Collingbourne <peter@pcc.me.uk> | 2011-04-15 00:35:48 +0000 |
commit | f111d935722ed488144600cea5ed03a6b5069e8f (patch) | |
tree | b9890fee5ac2d94380e448777c0a49223fbc578d /lib/AST/ExprClassification.cpp | |
parent | 7e7fbd05a5dfdb0addfc8b5af2fcbed8c7b5fb87 (diff) |
C1X: implement generic selections
As an extension, generic selection support has been added for all
supported languages. The syntax is the same as for C1X.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129554 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/ExprClassification.cpp')
-rw-r--r-- | lib/AST/ExprClassification.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/AST/ExprClassification.cpp b/lib/AST/ExprClassification.cpp index e94ae82786..803bc561ba 100644 --- a/lib/AST/ExprClassification.cpp +++ b/lib/AST/ExprClassification.cpp @@ -233,6 +233,14 @@ static Cl::Kinds ClassifyInternal(ASTContext &Ctx, const Expr *E) { case Expr::ParenExprClass: return ClassifyInternal(Ctx, cast<ParenExpr>(E)->getSubExpr()); + // C1X 6.5.1.1p4: [A generic selection] is an lvalue, a function designator, + // or a void expression if its result expression is, respectively, an + // lvalue, a function designator, or a void expression. + case Expr::GenericSelectionExprClass: + if (cast<GenericSelectionExpr>(E)->isResultDependent()) + return Cl::CL_PRValue; + return ClassifyInternal(Ctx,cast<GenericSelectionExpr>(E)->getResultExpr()); + case Expr::BinaryOperatorClass: case Expr::CompoundAssignOperatorClass: // C doesn't have any binary expressions that are lvalues. |