diff options
author | Richard Trieu <rtrieu@google.com> | 2016-11-11 20:51:04 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2016-11-11 20:51:04 +0000 |
commit | cbd54304a3551d4345367b0d7d8fbf88f4d80624 (patch) | |
tree | e9e82d274280d0f6d4047343d8184a0ee8e2971e /clang/lib/AST/DeclBase.cpp | |
parent | 9a2a1d27a591030da147dd709e0c85c75723e184 (diff) | |
download | bcm5719-llvm-cbd54304a3551d4345367b0d7d8fbf88f4d80624.tar.gz bcm5719-llvm-cbd54304a3551d4345367b0d7d8fbf88f4d80624.zip |
When a DecompositionDecl is marked invalid, also set the child BindingDecl's to
invalid.
llvm-svn: 286630
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 5d130acfbed..8deef3343db 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -109,12 +109,24 @@ const char *Decl::getDeclKindName() const { void Decl::setInvalidDecl(bool Invalid) { InvalidDecl = Invalid; assert(!isa<TagDecl>(this) || !cast<TagDecl>(this)->isCompleteDefinition()); - if (Invalid && !isa<ParmVarDecl>(this)) { + if (!Invalid) { + return; + } + + if (!isa<ParmVarDecl>(this)) { // Defensive maneuver for ill-formed code: we're likely not to make it to // a point where we set the access specifier, so default it to "public" // to avoid triggering asserts elsewhere in the front end. setAccess(AS_public); } + + // Marking a DecompositionDecl as invalid implies all the child BindingDecl's + // are invalid too. + if (DecompositionDecl *DD = dyn_cast<DecompositionDecl>(this)) { + for (BindingDecl *Binding : DD->bindings()) { + Binding->setInvalidDecl(); + } + } } const char *DeclContext::getDeclKindName() const { |