[llvm] r232838 - AsmPrinter: Check subprogram before using it
Duncan P. N. Exon Smith
dexonsmith at apple.com
Fri Mar 20 12:50:00 PDT 2015
Author: dexonsmith
Date: Fri Mar 20 14:50:00 2015
New Revision: 232838
URL: http://llvm.org/viewvc/llvm-project?rev=232838&view=rev
Log:
AsmPrinter: Check subprogram before using it
Check return of `getDISubprogram()` before using it. A WIP patch makes
`DIDescriptor` accessors more strict (and would crash on this).
Modified:
llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp?rev=232838&r1=232837&r2=232838&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp Fri Mar 20 14:50:00 2015
@@ -190,8 +190,11 @@ void WinCodeViewLineTables::emitDebugInf
return;
assert(FI.End && "Don't know where the function ends?");
- StringRef FuncName = getDISubprogram(GV).getDisplayName(),
- GVName = GV->getName();
+ StringRef GVName = GV->getName();
+ StringRef FuncName;
+ if (DISubprogram SP = getDISubprogram(GV))
+ FuncName = SP.getDisplayName();
+
// FIXME Clang currently sets DisplayName to "bar" for a C++
// "namespace_foo::bar" function, see PR21528. Luckily, dbghelp.dll is trying
// to demangle display names anyways, so let's just put a mangled name into
More information about the llvm-commits
mailing list