From: Greg Clayton Date: Tue, 12 Apr 2016 00:06:27 +0000 (+0000) Subject: Fixed Variable::GetDecl() and Variable::GetDeclContext() to check the "Type *" before... X-Git-Tag: llvmorg-3.9.0-rc1~9397 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a15942ff051e378d5af5f399a827ad1051112c21;p=platform%2Fupstream%2Fllvm.git Fixed Variable::GetDecl() and Variable::GetDeclContext() to check the "Type *" before using it so we don't crash if a variable's type can't be realized which happens more often recently due to -gmodules. llvm-svn: 266023 --- diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp index 47f573d..29fe4bb 100644 --- a/lldb/source/Symbol/Variable.cpp +++ b/lldb/source/Symbol/Variable.cpp @@ -244,16 +244,22 @@ CompilerDeclContext Variable::GetDeclContext () { Type *type = GetType(); - return type->GetSymbolFile()->GetDeclContextContainingUID(GetID()); + if (type) + return type->GetSymbolFile()->GetDeclContextContainingUID(GetID()); + return CompilerDeclContext(); } CompilerDecl Variable::GetDecl () { + CompilerDecl decl; Type *type = GetType(); - CompilerDecl decl = type->GetSymbolFile()->GetDeclForUID(GetID()); - if (decl) - decl.GetTypeSystem()->DeclLinkToObject(decl.GetOpaqueDecl(), shared_from_this()); + if (type) + { + decl = type->GetSymbolFile()->GetDeclForUID(GetID()); + if (decl) + decl.GetTypeSystem()->DeclLinkToObject(decl.GetOpaqueDecl(), shared_from_this()); + } return decl; }