[clang] [llvm] [mlir] [support] Use VFS in `SourceMgr` for loading includes (PR #162903)
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 21 10:29:58 PDT 2025
================
@@ -378,8 +378,10 @@ struct SourceMgrDiagnosticHandlerImpl {
}
// Otherwise, try to load the source file.
- std::string ignored;
- unsigned id = mgr.AddIncludeFile(std::string(filename), SMLoc(), ignored);
+ auto bufferOrErr = llvm::MemoryBuffer::getFile(filename);
+ if (!bufferOrErr)
+ return 0;
+ unsigned id = mgr.AddNewSourceBuffer(std::move(*bufferOrErr), SMLoc());
filenameToBufId[filename] = id;
----------------
jansvoboda11 wrote:
Ah, that makes sense, sorry for the breakage. With https://github.com/llvm/llvm-project/pull/163862 this is no longer necessary. Fix is here: https://github.com/llvm/llvm-project/pull/164464.
https://github.com/llvm/llvm-project/pull/162903
More information about the cfe-commits
mailing list