AST: Serialize -enable-resilience flag on the ModuleDecl

Since resilience is a property of the module being compiled,
not decls being accessed, we need to record which types are
resilient as part of the module.

Previously we would only ever look at the @_fixed_layout
attribute on a type. If the flag was not specified, Sema
would slap this attribute on every type that gets validated.

This is wasteful for non-resilient builds, because there
all types get the attribute. It was also apparently wrong,
and I don't fully understand when Sema decides to validate
which decls.

It is much cleaner conceptually to just serialize this flag
with the module, and check for its presence if the
attribute was not found on a type.
This commit is contained in:
Slava Pestov
2016-01-16 01:01:58 -08:00
parent 3ec0df1233
commit 81267ce1db
18 changed files with 99 additions and 71 deletions

View File

@@ -109,6 +109,9 @@ static bool readOptionsBlock(llvm::BitstreamCursor &cursor,
case options_block::IS_TESTABLE:
extendedInfo.setIsTestable(true);
break;
case options_block::IS_RESILIENT:
extendedInfo.setIsResilient(true);
break;
default:
// Unknown options record, possibly for use by a future version of the
// module format.