forked from OSchip/llvm-project
Performance improvements to the IsObjCNil () - we only try to resolve the value if the variable under consideration truly is an “Objective-C thing”
This also changes the ClangASTContext to make sure that id is correctly marked as being such an ObjC thing llvm-svn: 177203
This commit is contained in:
parent
7b641e97ed
commit
7277d201a9
|
@ -1899,10 +1899,13 @@ ValueObject::IsPossibleDynamicType ()
|
|||
bool
|
||||
ValueObject::IsObjCNil ()
|
||||
{
|
||||
bool isObjCpointer = ClangASTContext::IsObjCObjectPointerType(GetClangType(), NULL);
|
||||
const uint32_t mask = ClangASTContext::eTypeIsObjC | ClangASTContext::eTypeIsPointer;
|
||||
bool isObjCpointer = ( ((ClangASTContext::GetTypeInfo(GetClangType(), GetClangAST(), NULL)) & mask) == mask);
|
||||
if (!isObjCpointer)
|
||||
return false;
|
||||
bool canReadValue = true;
|
||||
bool isZero = GetValueAsUnsigned(0,&canReadValue) == 0;
|
||||
return canReadValue && isZero && isObjCpointer;
|
||||
return canReadValue && isZero;
|
||||
}
|
||||
|
||||
ValueObjectSP
|
||||
|
|
|
@ -2920,7 +2920,7 @@ ClangASTContext::GetTypeInfo
|
|||
case clang::BuiltinType::ObjCClass:
|
||||
if (ast && pointee_or_element_clang_type)
|
||||
*pointee_or_element_clang_type = ast->ObjCBuiltinClassTy.getAsOpaquePtr();
|
||||
return eTypeIsBuiltIn | eTypeIsPointer | eTypeHasValue;
|
||||
return eTypeIsBuiltIn | eTypeIsPointer | eTypeHasValue | eTypeIsObjC;
|
||||
break;
|
||||
case clang::BuiltinType::Bool:
|
||||
case clang::BuiltinType::Char_U:
|
||||
|
|
Loading…
Reference in New Issue