llvm.org GIT mirror llvm / f8cc547
Use windows path syntax when writing PDB module name. Without this we would just append whatever the user wrote on the command line, so if we're in C:\foo and we run lld-link bar/baz.obj, we would write C:\foo\bar/baz.obj in various places in the PDB. MSVC linker does not do this, so we shouldn't either. This fixes some differences in the diff test, so we update the test as well. Differential Revision: https://reviews.llvm.org/D35092 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@307423 91177308-0d34-0410-b5e6-96231b3b80d8 Zachary Turner 3 years ago
2 changed file(s) with 51 addition(s) and 41 deletion(s). Raw diff Collapse all Expand all
345345 for (uint32_t I = 0; I < ML.getModuleCount(); ++I)
346346 List.emplace_back(I, ML.getModuleDescriptor(I));
347347 return List;
348 }
349
350 static void diffOneModule(
351 DiffPrinter &D, const std::pair Item,
352 std::vector> &Other, bool Invert) {
353 D.printFullRow(
354 truncateQuotedNameFront("Module", Item.second.getModuleName(), 70));
355
356 auto Iter = llvm::find_if(
357 Other, [&Item](const std::pair &Other) {
358 return Other.second.getModuleName().equals_lower(
359 Item.second.getModuleName());
360 });
361 if (Iter == Other.end()) {
362 // We didn't find this module at all on the other side. Just print one row
363 // and continue.
364 D.print("- Modi", Item.first, None);
365 return;
366 }
367
368 // We did find this module. Go through and compare each field.
369 const auto *L = &Item;
370 const auto *R = &*Iter;
371 if (Invert)
372 std::swap(L, R);
373
374 D.print("- Modi", L->first, R->first);
375 D.print("- Obj File Name",
376 shortFilePath(L->second.getObjFileName(), 28),
377 shortFilePath(R->second.getObjFileName(), 28));
378 D.print("- Debug Stream",
379 L->second.getModuleStreamIndex(),
380 R->second.getModuleStreamIndex());
381 D.print("- C11 Byte Size", L->second.getC11LineInfoByteSize(),
382 R->second.getC11LineInfoByteSize());
383 D.print("- C13 Byte Size", L->second.getC13LineInfoByteSize(),
384 R->second.getC13LineInfoByteSize());
385 D.print("- # of files", L->second.getNumberOfFiles(),
386 R->second.getNumberOfFiles());
387 D.print("- Pdb File Path Index", L->second.getPdbFilePathNameIndex(),
388 R->second.getPdbFilePathNameIndex());
389 D.print("- Source File Name Index", L->second.getSourceFileNameIndex(),
390 R->second.getSourceFileNameIndex());
391 D.print("- Symbol Byte Size", L->second.getSymbolDebugInfoByteSize(),
392 R->second.getSymbolDebugInfoByteSize());
393 Other.erase(Iter);
348394 }
349395
350396 Error DiffStyle::diffDbiStream() {
438484 auto MDR = getModuleDescriptors(MR);
439485 // Scan all module descriptors from the left, and look for corresponding
440486 // module descriptors on the right.
441 for (const auto &L : MDL) {
442 D.printFullRow(
443 truncateQuotedNameFront("Module", L.second.getModuleName(), 70));
444
445 auto Iter = llvm::find_if(
446 MDR, [&L](const std::pair &R) {
447 return R.second.getModuleName().equals_lower(
448 L.second.getModuleName());
449 });
450 if (Iter == MDR.end()) {
451 // We didn't find this module at all on the right. Just print one row
452 // and continue.
453 D.print("- Modi", L.first, None);
454 continue;
455 }
456
457 // We did find this module. Go through and compare each field.
458 const auto &R = *Iter;
459 D.print("- Modi", L.first, R.first);
460 D.print("- Obj File Name",
461 shortFilePath(L.second.getObjFileName(), 28),
462 shortFilePath(R.second.getObjFileName(), 28));
463 D.print("- Debug Stream",
464 L.second.getModuleStreamIndex(),
465 R.second.getModuleStreamIndex());
466 D.print("- C11 Byte Size", L.second.getC11LineInfoByteSize(),
467 R.second.getC11LineInfoByteSize());
468 D.print("- C13 Byte Size", L.second.getC13LineInfoByteSize(),
469 R.second.getC13LineInfoByteSize());
470 D.print("- # of files", L.second.getNumberOfFiles(),
471 R.second.getNumberOfFiles());
472 D.print("- Pdb File Path Index", L.second.getPdbFilePathNameIndex(),
473 R.second.getPdbFilePathNameIndex());
474 D.print("- Source File Name Index", L.second.getSourceFileNameIndex(),
475 R.second.getSourceFileNameIndex());
476 D.print("- Symbol Byte Size", L.second.getSymbolDebugInfoByteSize(),
477 R.second.getSymbolDebugInfoByteSize());
478 MDR.erase(Iter);
479 }
487 for (const auto &L : MDL)
488 diffOneModule(D, L, MDR, false);
489
490 for (const auto &R : MDR)
491 diffOneModule(D, R, MDL, true);
480492
481493 return Error::success();
482494 }
109109 case DiffResult::UNSPECIFIED:
110110 printValue(" ", Result, AlignStyle::Center, 3, true);
111111 break;
112 default:
113 llvm_unreachable("unreachable!");
114112 }
115113 }
116114