mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user