================ @@ -3157,25 +2140,18 @@ bool ModuleMap::parseModuleMapFile(FileEntryRef File, bool IsSystem, assert((!Offset || *Offset <= Buffer->getBufferSize()) && "invalid buffer offset"); - // Parse this module map file. - Lexer L(SourceMgr.getLocForStartOfFile(ID), MMapLangOpts, - Buffer->getBufferStart(), - Buffer->getBufferStart() + (Offset ? *Offset : 0), - Buffer->getBufferEnd()); - SourceLocation Start = L.getSourceLocation(); - ModuleMapParser Parser(L, SourceMgr, Target, Diags, *this, ID, Dir, IsSystem); - bool Result = Parser.parseModuleMapFile(); - ParsedModuleMap[File] = Result; - - if (Offset) { - auto Loc = SourceMgr.getDecomposedLoc(Parser.getLocation()); - assert(Loc.first == ID && "stopped in a different file?"); - *Offset = Loc.second; + std::optional<modulemap::ModuleMapFile> MMF = modulemap::parseModuleMap( + ID, Dir, SourceMgr, Diags, IsSystem, Offset); ---------------- jansvoboda11 wrote:
What are your plans around making this independent of the main `SourceManager`? https://github.com/llvm/llvm-project/pull/119740 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits