MCPcopy Create free account
hub / github.com/chipsalliance/Surelog / createFileList_

Method createFileList_

src/SourceCompile/Compiler.cpp:328–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328bool Compiler::createFileList_() {
329 if (!((m_commandLineParser->writePpOutput() ||
330 m_commandLineParser->writePpOutputFileId()) &&
331 (!m_commandLineParser->parseOnly()))) {
332 return true;
333 }
334 FileSystem* const fileSystem = FileSystem::getInstance();
335 SymbolTable* symbolTable = getSymbolTable();
336 {
337 PathId fileId = fileSystem->getChild(m_commandLineParser->getCompileDirId(),
338 "file.lst", symbolTable);
339 std::ostream& ofs = fileSystem->openForWrite(fileId);
340 if (ofs.good()) {
341 for (CompileSourceFile* sourceFile : m_compilers) {
342 m_ppFileMap[sourceFile->getFileId()].emplace_back(
343 sourceFile->getPpOutputFileId());
344
345 ofs << fileSystem->toPath(sourceFile->getPpOutputFileId()) << std::endl;
346 }
347 ofs.flush();
348 fileSystem->close(ofs);
349 } else {
350 std::cerr << "Could not create filelist: " << PathIdPP(fileId)
351 << std::endl;
352 }
353 }
354 {
355 PathId fileId = fileSystem->getChild(m_commandLineParser->getCompileDirId(),
356 "file_map.lst",
357 m_commandLineParser->getSymbolTable());
358 std::ostream& ofs = fileSystem->openForWrite(fileId);
359 if (ofs.good()) {
360 for (CompileSourceFile* sourceFile : m_compilers) {
361 ofs << fileSystem->toPath(sourceFile->getPpOutputFileId()) << " "
362 << fileSystem->toPath(sourceFile->getFileId()) << std::endl;
363 }
364 ofs.flush();
365 fileSystem->close(ofs);
366 } else {
367 std::cerr << "Could not create filelist: " << PathIdPP(fileId)
368 << std::endl;
369 }
370 }
371 {
372 if (m_commandLineParser->sepComp()) {
373 std::ostringstream concatFiles;
374 for (CompileSourceFile* sourceFile : m_compilers) {
375 const PathId sourceFileId = sourceFile->getFileId();
376 concatFiles << fileSystem->toPath(sourceFileId) << "|";
377 }
378 std::size_t val = std::hash<std::string>{}(concatFiles.str());
379 {
380 std::string hashedName = std::to_string(val) + ".sep_lst";
381 PathId fileId = fileSystem->getChild(
382 m_commandLineParser->getCompileDirId(), hashedName,
383 m_commandLineParser->getSymbolTable());
384 std::ostream& ofs = fileSystem->openForWrite(fileId);
385 if (ofs.good()) {

Callers

nothing calls this directly

Calls 15

PathIdPPClass · 0.85
writePpOutputMethod · 0.80
writePpOutputFileIdMethod · 0.80
parseOnlyMethod · 0.80
getChildMethod · 0.80
getCompileDirIdMethod · 0.80
getPpOutputFileIdMethod · 0.80
toPathMethod · 0.80
flushMethod · 0.80
sepCompMethod · 0.80
toSplitPlatformPathMethod · 0.80
getWorkingDirsMethod · 0.80

Tested by

no test coverage detected