[ELF] Pass Ctx & to InputFiles

This commit is contained in:
Fangrui Song
2024-10-06 11:27:24 -07:00
parent 26ca8ef836
commit 49865107d4
7 changed files with 44 additions and 38 deletions

View File

@@ -352,7 +352,7 @@ void ScriptParser::addFile(StringRef s) {
ctx.driver.addFile(s, /*withLOption=*/false);
} else {
// Finally, search in the list of library paths.
if (std::optional<std::string> path = findFromSearchPaths(s))
if (std::optional<std::string> path = findFromSearchPaths(ctx, s))
ctx.driver.addFile(saver().save(*path), /*withLOption=*/true);
else
setError("unable to find " + s);
@@ -400,8 +400,8 @@ void ScriptParser::readInclude() {
return;
}
if (std::optional<std::string> path = searchScript(name)) {
if (std::optional<MemoryBufferRef> mb = readFile(*path)) {
if (std::optional<std::string> path = searchScript(ctx, name)) {
if (std::optional<MemoryBufferRef> mb = readFile(ctx, *path)) {
buffers.push_back(curBuf);
curBuf = Buffer(ctx, *mb);
mbs.push_back(*mb);