Sema: Targeted fix for LLDB REPL issue

LLDB changes accessiblity of declarations after type checking,
which is not a good idea because it is likely to break invariants.
Indeed, the validateFixedLayoutAttribute() / hasFixedLayout()
logic was not prepared for this possibility.

This is a targeted fix to address the immediate breakage. A better
fix would be to change LLDB, and also to change Sema to store the
global -enable-resilience flag state in a bit in the serialized
module, instead of sticking it on every declaration.

Fixes <rdar://problem/23545959>.
This commit is contained in:
Slava Pestov
2015-11-20 16:39:17 -07:00
parent 88ca1e5323
commit 1a640d4ff8
3 changed files with 12 additions and 9 deletions

View File

@@ -1857,6 +1857,10 @@ bool NominalTypeDecl::hasFixedLayout() const {
return true;
}
// Objective-C enums always have a fixed layout.
if (isa<EnumDecl>(this) && isObjC())
return true;
// Otherwise, access via indirect "resilient" interfaces.
return false;
}