Skip to content

Commit 9b81054

Browse files
committed
WIP
1 parent 66d75f8 commit 9b81054

File tree

5 files changed

+54
-1
lines changed

5 files changed

+54
-1
lines changed

lib/SIL/IR/Linker.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ void SILLinkerVisitor::deserializeAndPushToWorklist(SILFunction *F) {
101101
/// Deserialize a function and add it to the worklist for processing.
102102
void SILLinkerVisitor::maybeAddFunctionToWorklist(SILFunction *F,
103103
bool setToSerializable) {
104+
llvm::errs() << "ALLANXXX " << F->getName() << "\n";
104105
PrettyStackTraceSILFunction stackTrace("adding to linker worklist", F);
105106

106107
SILLinkage linkage = F->getLinkage();

lib/SILGen/SILGen.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,13 @@ static SILFunction *getFunctionToInsertAfter(SILGenModule &SGM,
684684
}
685685

686686
static bool shouldEmitFunctionBody(const AbstractFunctionDecl *AFD) {
687-
return AFD->hasBody() && !AFD->isBodySkipped();
687+
688+
if (AFD->hasBody() && !AFD->isBodySkipped()) {
689+
return true;
690+
} else {
691+
llvm::errs() << "ALLANXXX shouldEmitFunctionBody() false " << AFD->getName() << " " << static_cast<unsigned>(AFD->getBodyKind()) << "\n";
692+
return false;
693+
}
688694
}
689695

690696
static bool isEmittedOnDemand(SILModule &M, SILDeclRef constant) {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
#ifndef CEnums_h
3+
#define CEnums_h
4+
5+
typedef enum __attribute__((enum_extensibility(open))) YesOrNo {
6+
Yes,
7+
No,
8+
} YesOrNo;
9+
10+
#endif
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
module CEnums {
3+
header "CEnums.h"
4+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// RUN: %empty-directory(%t)
2+
// RUN: %target-swift-frontend -emit-module %s -o %t/SkipNonInlinable/Skip.swiftmodule -I %S/Inputs/c-enums -debug-forbid-typecheck-prefix SKIP_INLINABLE_NO_TYPECHECK -experimental-skip-non-inlinable-function-bodies
3+
// RUN: %target-swift-frontend -emit-module %s -o %t/SkipAll/Skip.swiftmodule -I %S/Inputs/c-enums -debug-forbid-typecheck-prefix SKIP_INLINABLE_NO_TYPECHECK -debug-forbid-typecheck-prefix SKIP_ALL_NO_TYPECHECK -experimental-skip-all-function-bodies
4+
5+
import CEnums
6+
7+
@usableFromInline
8+
@inline(never)
9+
func blackHole<T>(_ t: T) {}
10+
11+
public func publicFunc() {
12+
let SKIP_INLINABLE_NO_TYPECHECK = 1
13+
blackHole(SKIP_INLINABLE_NO_TYPECHECK)
14+
}
15+
16+
@inlinable public func inlinableFunc() -> YesOrNo {
17+
let SKIP_ALL_NO_TYPECHECK = 1
18+
blackHole(SKIP_ALL_NO_TYPECHECK)
19+
20+
let s = Struct("string")
21+
blackHole(s.string)
22+
23+
return YesOrNo(rawValue: 1)!
24+
}
25+
26+
public struct Struct {
27+
@_borrowed public var string: String
28+
29+
public init(_ string: String) {
30+
self.string = string
31+
}
32+
}

0 commit comments

Comments
 (0)