@@ -632,19 +632,19 @@ void CodeViewDebug::beginModule(Module *M) {
632632 Asm = nullptr ;
633633 return ;
634634 }
635-
636635 Node = *CUs->operands ().begin ();
637636 }
638- const auto *CU = cast<DICompileUnit>(Node);
639- DISourceLanguageName Lang = CU->getSourceLanguage ();
637+
638+ TheCU = cast<DICompileUnit>(Node);
639+ DISourceLanguageName Lang = TheCU->getSourceLanguage ();
640640 CurrentSourceLanguage =
641641 Lang.hasVersionedName ()
642642 ? MapDWARFLanguageToCVLang (
643643 static_cast <dwarf::SourceLanguageName>(Lang.getName ()))
644644 : MapDWARFLanguageToCVLang (
645645 static_cast <dwarf::SourceLanguage>(Lang.getName ()));
646646 if (!M->getCodeViewFlag () ||
647- CU ->getEmissionKind () == DICompileUnit::NoDebug) {
647+ TheCU ->getEmissionKind () == DICompileUnit::NoDebug) {
648648 Asm = nullptr ;
649649 return ;
650650 }
@@ -905,14 +905,9 @@ void CodeViewDebug::emitCompilerInformation() {
905905 OS.AddComment (" CPUType" );
906906 OS.emitInt16 (static_cast <uint64_t >(TheCPU));
907907
908- NamedMDNode *CUs = MMI->getModule ()->getNamedMetadata (" llvm.dbg.cu" );
909-
910908 StringRef CompilerVersion = " 0" ;
911- if (!CUs->operands ().empty ()) {
912- const MDNode *Node = *CUs->operands ().begin ();
913- const auto *CU = cast<DICompileUnit>(Node);
914- CompilerVersion = CU->getProducer ();
915- }
909+ if (TheCU)
910+ CompilerVersion = TheCU->getProducer ();
916911
917912 Version FrontVer = parseVersion (CompilerVersion);
918913 OS.AddComment (" Frontend version" );
0 commit comments