forked from OSchip/llvm-project
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> llvm-svn: 266023
This commit is contained in:
parent
4f43cfd2c2
commit
a15942ff05
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue