aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2022-10-07 08:34:05 +0200
committerSylvestre Ledru <sylvestre@debian.org>2022-10-07 08:34:57 +0200
commitd3b0e745e8a3ead8cc2f0cc246c19c13f0c35ebb (patch)
tree36e2e3f1ee0cf650a74e2f5cc21874bbc4d3cacd /llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
parenta64ea173d7b152678780d5443407d1071277642b (diff)
downloadllvm-d3b0e745e8a3ead8cc2f0cc246c19c13f0c35ebb.zip
llvm-d3b0e745e8a3ead8cc2f0cc246c19c13f0c35ebb.tar.gz
llvm-d3b0e745e8a3ead8cc2f0cc246c19c13f0c35ebb.tar.bz2
[CodeView] Avoid NULL deref of Scope
Regression from D131400: cross-language LTO causes a crash in the compiler on the NULL deref of Scope in `isa` call when Rust IR is involved. Presumably, this might affect other languages too, and even Rust itself without cross-language LTO when the Rust compiler switched to LLVM 16. Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D134616
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index a97eb9f..a6f1fbc 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -3362,7 +3362,7 @@ void CodeViewDebug::emitDebugInfoForGlobal(const CVGlobalVariable &CVGV) {
// in its name so that we can reference the variable in the command line
// of the VS debugger.
std::string QualifiedName =
- (moduleIsInFortran() || isa<DILocalScope>(Scope))
+ (moduleIsInFortran() || (Scope && isa<DILocalScope>(Scope)))
? std::string(DIGV->getName())
: getFullyQualifiedName(Scope, DIGV->getName());