Skip to content

Commit

Permalink
Add -disable-sil-linking to sil-function-extractor and enable it by d…
Browse files Browse the repository at this point in the history
…efault.

Requested by @gottesmm
  • Loading branch information
swiftix committed Mar 24, 2017
1 parent c01a953 commit 40f2fc7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test/ClangImporter/serialization-sil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ public func testPartialApply(_ obj: Test) {
// CHECK: = apply [[PROP2_PARTIAL]]() : $@callee_owned () -> UnsafeMutableRawPointer
_ = prop2
}
} // CHECK: {{^}$}}
} // CHECK: // end sil function '_T04Test16testPartialApplyySoAA_pF'
7 changes: 6 additions & 1 deletion tools/sil-func-extractor/SILFunctionExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ static llvm::cl::opt<bool> AssumeUnqualifiedOwnershipWhenParsing(
llvm::cl::init(false),
llvm::cl::desc("Assume all parsed functions have unqualified ownership"));

static llvm::cl::opt<bool>
DisableSILLinking("disable-sil-linking",
llvm::cl::init(true),
llvm::cl::desc("Disable SIL linking"));

// This function isn't referenced outside its translation unit, but it
// can't use the "static" keyword because its address is used for
// getMainExecutable (since some platforms don't support taking the
Expand Down Expand Up @@ -303,7 +308,7 @@ int main(int argc, char **argv) {
std::unique_ptr<SerializedSILLoader> SL = SerializedSILLoader::create(
CI.getASTContext(), CI.getSILModule(), nullptr);

if (extendedInfo.isSIB())
if (extendedInfo.isSIB() || DisableSILLinking)
SL->getAllForModule(CI.getMainModule()->getName(), nullptr);
else
SL->getAll();
Expand Down

0 comments on commit 40f2fc7

Please sign in to comment.