[serialization] Yet Another Misuse of ArrayRef (#5216)

I wonder if we can assert that the lifetime is valid or something.

rdar://problem/28699599
This commit is contained in:
Jordan Rose
2016-10-10 16:24:25 -07:00
committed by GitHub
parent 299b47c8cc
commit 5d3a7f7c23

View File

@@ -1119,8 +1119,9 @@ Status ModuleFile::associateWithFileContext(FileUnit *file,
auto scopeID = ctx.getIdentifier(scopePath);
assert(!scopeID.empty() &&
"invalid decl name (non-top-level decls not supported)");
auto path = Module::AccessPathTy({scopeID, SourceLoc()});
dependency.Import = { ctx.AllocateCopy(path), module };
std::pair<Identifier, SourceLoc> accessPathElem(scopeID, SourceLoc());
dependency.Import = {ctx.AllocateCopy(llvm::makeArrayRef(accessPathElem)),
module};
}
}