Author: gclayton
Date: Mon Apr 11 19:06:27 2016
New Revision: 266023
URL: http://llvm.org/viewvc/llvm-project?rev=266023&view=rev
Log:
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.
<rdar://problem/25612626>
Modified:
lldb/trunk/source/Symbol/Variable.cpp
Modified: lldb/trunk/source/Symbol/Variable.cpp
URL:
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=266023&r1=266022&r2=266023&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Mon Apr 11 19:06:27 2016
@@ -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;
}
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits