mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
This should cover `-merge-modules` mode. Dumping of the configuration to the target files was moved to a separate pair of header/source files, as now it is also done in `SwiftOutputRewrite.cpp`.
24 lines
811 B
C++
24 lines
811 B
C++
#include "swift/extractor/TargetTrapFile.h"
|
|
#include <iomanip>
|
|
namespace codeql {
|
|
std::optional<TargetFile> createTargetTrapFile(const SwiftExtractorConfiguration& configuration,
|
|
std::string_view target) {
|
|
std::string trap{target};
|
|
trap += ".trap";
|
|
auto ret = TargetFile::create(trap, configuration.trapDir, configuration.getTempTrapDir());
|
|
if (ret) {
|
|
*ret << "/* extractor-args:\n";
|
|
for (const auto& opt : configuration.frontendOptions) {
|
|
*ret << " " << std::quoted(opt) << " \\\n";
|
|
}
|
|
*ret << "\n*/\n"
|
|
"/* swift-frontend-args:\n";
|
|
for (const auto& opt : configuration.patchedFrontendOptions) {
|
|
*ret << " " << std::quoted(opt) << " \\\n";
|
|
}
|
|
*ret << "\n*/\n";
|
|
}
|
|
return ret;
|
|
}
|
|
} // namespace codeql
|