diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-20 19:50:00 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2015-03-20 19:50:00 +0000 |
commit | 23e56ecf26e8a69efa6dc16aaaad959833c30ef5 (patch) | |
tree | 0d4d30e122eb9f0699bf176e5b47264bf87e805c /llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp | |
parent | bdfbde56e03a328f45c8f25dbb1a5b6f6361265b (diff) | |
download | bcm5719-llvm-23e56ecf26e8a69efa6dc16aaaad959833c30ef5.tar.gz bcm5719-llvm-23e56ecf26e8a69efa6dc16aaaad959833c30ef5.zip |
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).
llvm-svn: 232838
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp index 96a50367902..d2b4eec76f9 100644 --- a/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/WinCodeViewLineTables.cpp @@ -190,8 +190,11 @@ void WinCodeViewLineTables::emitDebugInfoForFunction(const Function *GV) { 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 |