diff options
author | Reid Kleckner <rnk@google.com> | 2016-06-09 00:29:00 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2016-06-09 00:29:00 +0000 |
commit | 6d1d27542fd66465f5e1e3e4248910b15f47a8b2 (patch) | |
tree | 91fd333bb117ddc096a851fa5b98ff69256168e6 /llvm/lib | |
parent | 36eb047792aaa77a11d710e1ee4f2e9930464925 (diff) | |
download | bcm5719-llvm-6d1d27542fd66465f5e1e3e4248910b15f47a8b2.tar.gz bcm5719-llvm-6d1d27542fd66465f5e1e3e4248910b15f47a8b2.zip |
[codeview] Skip DIGlobalVariables with no variable
They have probably been discarded during optimization.
llvm-svn: 272231
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index 828f89e9254..8920d20ad39 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -1317,7 +1317,7 @@ void CodeViewDebug::emitDebugInfoForGlobals() { switchToDebugSectionForSymbol(nullptr); MCSymbol *EndLabel = nullptr; for (const DIGlobalVariable *G : CU->getGlobalVariables()) { - if (const auto *GV = dyn_cast<GlobalVariable>(G->getVariable())) + if (const auto *GV = dyn_cast_or_null<GlobalVariable>(G->getVariable())) { if (!GV->hasComdat()) { if (!EndLabel) { OS.AddComment("Symbol subsection for globals"); @@ -1325,6 +1325,7 @@ void CodeViewDebug::emitDebugInfoForGlobals() { } emitDebugInfoForGlobal(G, Asm->getSymbol(GV)); } + } } if (EndLabel) endCVSubsection(EndLabel); @@ -1332,7 +1333,7 @@ void CodeViewDebug::emitDebugInfoForGlobals() { // Second, emit each global that is in a comdat into its own .debug$S // section along with its own symbol substream. for (const DIGlobalVariable *G : CU->getGlobalVariables()) { - if (const auto *GV = dyn_cast<GlobalVariable>(G->getVariable())) { + if (const auto *GV = dyn_cast_or_null<GlobalVariable>(G->getVariable())) { if (GV->hasComdat()) { MCSymbol *GVSym = Asm->getSymbol(GV); OS.AddComment("Symbol subsection for " + |