Skip to content
WinLinkDriver.cpp 34.6 KiB
Newer Older
    ctx.setManifestOutputPath(ctx.allocate(path));
  // Add the input files to the input graph.
  if (!ctx.hasInputGraph())
    ctx.setInputGraph(std::unique_ptr<InputGraph>(new InputGraph()));
  for (auto &file : files) {
    if (isReadingDirectiveSection)
      if (file->parse(ctx, diagnostics))
        return false;
    ctx.inputGraph().addInputElement(std::move(file));
  }

  // Add the library group to the input graph.
  if (!isReadingDirectiveSection) {
    auto group = std::unique_ptr<Group>(new PECOFFGroup());
    ctx.setLibraryGroup(group.get());
    ctx.inputGraph().addInputElement(std::move(group));
  }

  // Add the library files to the library group.
  for (std::unique_ptr<FileNode> &lib : libraries) {
    if (!hasLibrary(ctx, lib.get())) {
      if (isReadingDirectiveSection)
        if (lib->parse(ctx, diagnostics))
          return false;
      ctx.getLibraryGroup()->processInputElement(std::move(lib));
    }
  }
  // Validate the combination of options used.
  return ctx.validate(diagnostics);