[PATCH] D115257: [NFC][CodeView] Use one unified access to the module in beginModule.
Chih-Ping Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 7 08:36:56 PST 2021
cchen15 created this revision.
cchen15 added a reviewer: rnk.
Herald added a subscriber: hiraditya.
cchen15 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Use the argument M throughout the function.
The current code can trigger warnings from a static checker as the checker may not be able to deduce that M is the same as MMI->getModule().
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D115257
Files:
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
Index: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -611,8 +611,8 @@
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 @@
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);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115257.392422.patch
Type: text/x-patch
Size: 1007 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211207/60046805/attachment.bin>
More information about the llvm-commits
mailing list