Add "noreturn" attribute : stage 1

- Add the attribute to AnyFunctionType::ExtInfo.
- Propagate the attributes from DeclAttributes to AnyFunctionType for
  FuncDecls in TypeCheckDecl.cpp.
- Make sure the new attribute is serialized.

The main missing pieces are checking the applicability of the type attributes
on the FuncDecl and teaching typechecker about conversions on types with
noreturn.

Swift SVN r6359
This commit is contained in:
Anna Zaks
2013-07-18 22:57:22 +00:00
parent 92e07c6a54
commit 74bc6f05b2
13 changed files with 116 additions and 28 deletions

View File

@@ -1505,11 +1505,13 @@ Type ModuleFile::getType(TypeID TID) {
uint8_t rawCallingConvention;
bool autoClosure;
bool thin;
bool noreturn;
bool blockCompatible;
decls_block::FunctionTypeLayout::readRecord(scratch, inputID, resultID,
rawCallingConvention,
autoClosure, thin,
noreturn,
blockCompatible);
auto callingConvention = getActualCC(rawCallingConvention);
if (!callingConvention.hasValue()) {
@@ -1519,6 +1521,7 @@ Type ModuleFile::getType(TypeID TID) {
auto Info = FunctionType::ExtInfo(callingConvention.getValue(),
thin,
noreturn,
autoClosure,
blockCompatible);
@@ -1731,13 +1734,16 @@ Type ModuleFile::getType(TypeID TID) {
DeclID genericContextID;
uint8_t rawCallingConvention;
bool thin;
bool noreturn = false;
//todo add noreturn serialization.
decls_block::PolymorphicFunctionTypeLayout::readRecord(scratch,
inputID,
resultID,
genericContextID,
rawCallingConvention,
thin);
thin,
noreturn);
auto callingConvention = getActualCC(rawCallingConvention);
if (!callingConvention.hasValue()) {
error();
@@ -1766,7 +1772,8 @@ Type ModuleFile::getType(TypeID TID) {
assert(paramList && "missing generic params for polymorphic function");
auto Info = PolymorphicFunctionType::ExtInfo(callingConvention.getValue(),
thin);
thin,
noreturn);
typeOrOffset = PolymorphicFunctionType::get(getType(inputID),
getType(resultID),