@@ -410,32 +410,12 @@ static const std::string STUB_BITCODE_FILES_NAME = "STUB_BITCODE_FILES";
410
410
static const std::string STUB_BITCODE_FILES = " $(STUB_BITCODE_FILES)" ;
411
411
412
412
Result<CollectionUtils::FileSet> Linker::generateStubsMakefile (
413
- const fs::path &root, const fs::path &outputFile, const fs::path &stubsMakefile) const {
414
- ShellExecTask::ExecutionParameters nmCommand (
415
- Paths::getLLVMnm (),
416
- { " --print-file-name" , " --undefined-only" , " --just-symbol-name" , outputFile });
417
- auto [out, status, _] = ShellExecTask::runShellCommandTask (nmCommand, testGen.serverBuildDir );
418
- if (status != 0 ) {
419
- std::string errorMessage =
420
- StringUtils::stringFormat (" llvm-nm on %s failed: %s" , outputFile, out);
421
- LOG_S (ERROR) << errorMessage;
422
- return errorMessage;
413
+ const fs::path &root, const fs::path &outputFile, const fs::path &stubsMakefile) const {
414
+ auto result = StubGen (testGen).getStubSetForObject (outputFile);
415
+ if (!result.isSuccess ()) {
416
+ return result;
423
417
}
424
- auto symbols =
425
- CollectionUtils::transform (StringUtils::split (out, ' \n ' ), [](std::string const &line) {
426
- return StringUtils::splitByWhitespaces (line).back ();
427
- });
428
- CollectionUtils::erase_if (symbols, [](std::string const &symbol) {
429
- return StringUtils::startsWith (symbol, " __ubsan" ) ||
430
- StringUtils::startsWith (symbol, " klee_" );
431
- });
432
- auto signatures = CollectionUtils::transform (symbols, [](std::string const &symbol) {
433
- Tests::MethodDescription methodDescription;
434
- methodDescription.name = symbol;
435
- return methodDescription;
436
- });
437
- auto rootLinkUnitInfo = testGen.getTargetBuildDatabase ()->getClientLinkUnitInfo (root);
438
- auto stubsSet = StubGen (testGen).findStubFilesBySignatures (signatures);
418
+ auto stubsSet = result.getOpt ().value ();
439
419
printer::DefaultMakefilePrinter makefilePrinter;
440
420
auto bitcodeStubFiles = CollectionUtils::transformTo<std::vector<fs::path>>(
441
421
Synchronizer::dropHeaders (stubsSet), [this , &makefilePrinter](const fs::path &stubPath) {
0 commit comments