1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-02-01 05:01:59 +01:00

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
This commit is contained in:
Duncan P. N. Exon Smith 2015-03-20 19:50:00 +00:00
parent 2ca5cf8fba
commit 12f98cf159

View File

@ -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