[llvm] b5c42ef - [NFC][CodeView] Use one unified access to the module in beginModule.

Chih-Ping Chen via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 7 10:48:49 PST 2021


Author: Chih-Ping Chen
Date: 2021-12-07T13:45:48-05:00
New Revision: b5c42ef3da4ddf32a57781b8a44c30eee3dc0545

URL: https://github.com/llvm/llvm-project/commit/b5c42ef3da4ddf32a57781b8a44c30eee3dc0545
DIFF: https://github.com/llvm/llvm-project/commit/b5c42ef3da4ddf32a57781b8a44c30eee3dc0545.diff

LOG: [NFC][CodeView] Use one unified access to the module in beginModule.

Differential Revision: https://reviews.llvm.org/D115257

Added: 
    

Modified: 
    llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index 85ff84484cedf..928252a3d0419 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -611,8 +611,8 @@ static SourceLanguage MapDWLangToCVLang(unsigned DWLang) {
 void CodeViewDebug::beginModule(Module *M) {
   // If module doesn't have named metadata anchors or COFF debug section
   // is not available, skip any debug info related stuff.
-  if (!M->getNamedMetadata("llvm.dbg.cu") ||
-      !Asm->getObjFileLowering().getCOFFDebugSymbolsSection()) {
+  NamedMDNode *CUs = M->getNamedMetadata("llvm.dbg.cu");
+  if (!CUs || !Asm->getObjFileLowering().getCOFFDebugSymbolsSection()) {
     Asm = nullptr;
     return;
   }
@@ -622,7 +622,6 @@ void CodeViewDebug::beginModule(Module *M) {
   TheCPU = mapArchToCVCPUType(Triple(M->getTargetTriple()).getArch());
 
   // Get the current source language.
-  NamedMDNode *CUs = MMI->getModule()->getNamedMetadata("llvm.dbg.cu");
   const MDNode *Node = *CUs->operands().begin();
   const auto *CU = cast<DICompileUnit>(Node);
 


        


More information about the llvm-commits mailing list