Skip to content

Commit b6fb6ed

Browse files
committed
Add type info for unique_ptr
1 parent 6ec3ab9 commit b6fb6ed

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

include/swift/AST/SILGenRequests.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct SILGenDescriptor {
7676

7777
class GenerateSILRequest :
7878
public SimpleRequest<GenerateSILRequest,
79-
SILModule *(SILGenDescriptor),
79+
std::unique_ptr<SILModule>(SILGenDescriptor),
8080
CacheKind::Uncached> {
8181
public:
8282
using SimpleRequest::SimpleRequest;
@@ -85,7 +85,7 @@ class GenerateSILRequest :
8585
friend SimpleRequest;
8686

8787
// Evaluation.
88-
llvm::Expected<SILModule *>
88+
llvm::Expected<std::unique_ptr<SILModule>>
8989
evaluate(Evaluator &evaluator, SILGenDescriptor desc) const;
9090

9191
public:

include/swift/AST/SILGenTypeIDZone.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@
1515
//===----------------------------------------------------------------------===//
1616

1717
SWIFT_REQUEST(SILGen, GenerateSILRequest,
18-
SILModule *(SILGenDescriptor),
18+
std::unique_ptr<SILModule>(SILGenDescriptor),
1919
Uncached, NoLocationInfo)

include/swift/Basic/CTypeIDZone.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ SWIFT_TYPEID_NAMED(std::string, String)
3636

3737
// C++ standard library types.
3838
SWIFT_TYPEID_TEMPLATE1_NAMED(std::vector, Vector, typename T, T)
39+
SWIFT_TYPEID_TEMPLATE1_NAMED(std::unique_ptr, UniquePtr, typename T, T)
3940

4041
// LLVM ADT types.
4142
SWIFT_TYPEID_TEMPLATE1_NAMED(llvm::TinyPtrVector, TinyPtrVector, typename T, T)

lib/SILGen/SILGen.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,29 +1755,23 @@ std::unique_ptr<SILModule>
17551755
swift::performSILGeneration(ModuleDecl *mod, Lowering::TypeConverter &tc,
17561756
const SILOptions &options) {
17571757
auto desc = SILGenDescriptor::forWholeModule(mod, tc, options);
1758-
return std::unique_ptr<SILModule>(
1759-
evaluateOrDefault(mod->getASTContext().evaluator,
1760-
GenerateSILRequest{desc},
1761-
nullptr));
1758+
return llvm::cantFail(mod->getASTContext().evaluator(GenerateSILRequest{desc}));
17621759
}
17631760

17641761
std::unique_ptr<SILModule>
17651762
swift::performSILGeneration(FileUnit &sf, Lowering::TypeConverter &tc,
17661763
const SILOptions &options) {
17671764
auto desc = SILGenDescriptor::forFile(sf, tc, options);
1768-
return std::unique_ptr<SILModule>(
1769-
evaluateOrDefault(sf.getASTContext().evaluator,
1770-
GenerateSILRequest{desc},
1771-
nullptr));
1765+
return llvm::cantFail(sf.getASTContext().evaluator(GenerateSILRequest{desc}));
17721766
}
17731767

1774-
llvm::Expected<SILModule *>
1768+
llvm::Expected<std::unique_ptr<SILModule>>
17751769
GenerateSILRequest::evaluate(Evaluator &evaluator, SILGenDescriptor sgd) const {
17761770
if (auto *MD = sgd.context.dyn_cast<ModuleDecl *>()) {
1777-
return SILModule::constructSIL(MD, sgd.conv, sgd.opts, nullptr).release();
1771+
return SILModule::constructSIL(MD, sgd.conv, sgd.opts, nullptr);
17781772
} else {
17791773
auto *SF = sgd.context.get<FileUnit *>();
17801774
return SILModule::constructSIL(SF->getParentModule(),
1781-
sgd.conv, sgd.opts, SF).release();
1775+
sgd.conv, sgd.opts, SF);
17821776
}
17831777
}

lib/SILGen/SILGenRequests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//===--- Condition.cpp - Implements the SILGen Condition class ------------===//
1+
//===--- SILGenRequests.cpp - Requests for SIL Generation ----------------===//
22
//
33
// This source file is part of the Swift.org open source project
44
//

0 commit comments

Comments
 (0)