trigger access control or one of the many assertions we have for valid
access specifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@97767
91177308-0d34-0410-b5e6-
96231b3b80d8
/// setInvalidDecl - Indicates the Decl had a semantic error. This
/// allows for graceful error recovery.
- void setInvalidDecl(bool Invalid = true) { InvalidDecl = Invalid; }
+ void setInvalidDecl(bool Invalid = true);
bool isInvalidDecl() const { return (bool) InvalidDecl; }
/// isImplicit - Indicates whether the declaration was implicitly
}
}
+void Decl::setInvalidDecl(bool Invalid) {
+ InvalidDecl = Invalid;
+ if (Invalid) {
+ // 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);
+ }
+}
+
const char *DeclContext::getDeclKindName() const {
switch (DeclKind) {
default: assert(0 && "Declaration context not in DeclNodes.def!");