diff options
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 { |