diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-08-11 22:25:46 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2016-08-11 22:25:46 +0000 |
commit | 7873de0cf65f48e6c8169691ee7eb203b89bfac5 (patch) | |
tree | 361febace1eab46aacfef2f710bf7720448f7f3a /clang/lib/AST/Expr.cpp | |
parent | fa7ae4f3b6316e60de4e3d9f4dd1f355889f970c (diff) | |
download | bcm5719-llvm-7873de0cf65f48e6c8169691ee7eb203b89bfac5.tar.gz bcm5719-llvm-7873de0cf65f48e6c8169691ee7eb203b89bfac5.zip |
P0217R3: Perform semantic checks and initialization for the bindings in a
decomposition declaration for arrays, aggregate-like structs, tuple-like
types, and (as an extension) for complex and vector types.
llvm-svn: 278435
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r-- | clang/lib/AST/Expr.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index e835686a1a9..15386aeec9d 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -3308,11 +3308,16 @@ FieldDecl *Expr::getSourceBitField() { if (Ivar->isBitField()) return Ivar; - if (DeclRefExpr *DeclRef = dyn_cast<DeclRefExpr>(E)) + if (DeclRefExpr *DeclRef = dyn_cast<DeclRefExpr>(E)) { if (FieldDecl *Field = dyn_cast<FieldDecl>(DeclRef->getDecl())) if (Field->isBitField()) return Field; + if (BindingDecl *BD = dyn_cast<BindingDecl>(DeclRef->getDecl())) + if (Expr *E = BD->getBinding()) + return E->getSourceBitField(); + } + if (BinaryOperator *BinOp = dyn_cast<BinaryOperator>(E)) { if (BinOp->isAssignmentOp() && BinOp->getLHS()) return BinOp->getLHS()->getSourceBitField(); @@ -3329,6 +3334,7 @@ FieldDecl *Expr::getSourceBitField() { } bool Expr::refersToVectorElement() const { + // FIXME: Why do we not just look at the ObjectKind here? const Expr *E = this->IgnoreParens(); while (const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(E)) { @@ -3345,6 +3351,11 @@ bool Expr::refersToVectorElement() const { if (isa<ExtVectorElementExpr>(E)) return true; + if (auto *DRE = dyn_cast<DeclRefExpr>(E)) + if (auto *BD = dyn_cast<BindingDecl>(DRE->getDecl())) + if (auto *E = BD->getBinding()) + return E->refersToVectorElement(); + return false; } |