Skip to content

Commit 03b539d

Browse files
author
Zak Kent
committed
[TBD] [Immediate] Revert implementation of SymbolSourceMap
1 parent d1c5b4a commit 03b539d

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

include/swift/AST/TBDGenRequests.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,27 @@ class SymbolSourceMap {
209209
friend class SymbolSourceMapRequest;
210210

211211
using Storage = llvm::StringMap<SymbolSource>;
212+
const Storage *storage;
212213

213-
explicit SymbolSourceMap(Storage *storage) : storage(storage) {
214+
explicit SymbolSourceMap(const Storage *storage) : storage(storage) {
214215
assert(storage);
215216
}
216217

217218
public:
218-
Storage *storage;
219219
llvm::Optional<SymbolSource> find(StringRef symbol) const {
220220
auto result = storage->find(symbol);
221221
if (result == storage->end())
222222
return llvm::None;
223223
return result->second;
224224
}
225+
226+
Storage::const_iterator begin() const {
227+
return storage->begin();
228+
}
229+
230+
Storage::const_iterator end() const {
231+
return storage->end();
232+
}
225233

226234
friend bool operator==(const SymbolSourceMap &lhs,
227235
const SymbolSourceMap &rhs) {

lib/Immediate/SwiftMaterializationUnit.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ LazySwiftMaterializationUnit::Create(SwiftJIT &JIT, CompilerInstance &CI) {
295295
auto Sources =
296296
llvm::cantFail(M->getASTContext().evaluator(std::move(SourceReq)));
297297
llvm::orc::SymbolFlagsMap PublicInterface;
298-
for (const auto &Entry : *Sources.storage) {
298+
for (const auto &Entry : Sources) {
299299
const auto &Source = Entry.getValue();
300300
if (Source.kind != SymbolSource::Kind::SIL) {
301301
continue;
@@ -330,8 +330,9 @@ void LazySwiftMaterializationUnit::materialize(
330330
const auto &RS = MR->getRequestedSymbols();
331331
for (auto &Sym : RS) {
332332
auto Name = demangle(*Sym);
333-
const auto &Source = Sources.storage->find(Name)->getValue();
334-
auto Ref = Source.getSILDeclRef();
333+
auto Source = Sources.find(Name);
334+
assert(Source && "Requested symbol doesn't have source?");
335+
auto Ref = Source->getSILDeclRef();
335336
if (auto *AFD = Ref.getAbstractFunctionDecl()) {
336337
AFD->getTypecheckedBody();
337338
if (CI.getASTContext().hadError()) {

0 commit comments

Comments
 (0)