summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Granata <egranata@apple.com>2014-10-10 22:45:38 +0000
committerEnrico Granata <egranata@apple.com>2014-10-10 22:45:38 +0000
commit0aa6926d0b7f049bdaf82c6f1503f232f157968e (patch)
tree70d188e23cf019627b6c987ebec6b51c20477627
parent337f7c971654d127adde6ed7232bba5b2ad86ff2 (diff)
downloadbcm5719-llvm-0aa6926d0b7f049bdaf82c6f1503f232f157968e.tar.gz
bcm5719-llvm-0aa6926d0b7f049bdaf82c6f1503f232f157968e.zip
When parsing ObjC types from encoded strings (and disallowing any-type), the ^? combination gets resolved to no type, while we could resolve it to void*
I don't think on any of the platforms where ObjC matters sizeof(T*) depends on T, so even if we never figured out the pointee type, the pointer type should still be sane This might also allow some limited inspection where previously none was possible, so a win llvm-svn: 219540
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp23
1 files changed, 17 insertions, 6 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
index 99d77ef5a16..817c4402c2d 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
@@ -249,13 +249,24 @@ AppleObjCTypeEncodingParser::BuildType (clang::ASTContext &ast_ctx, StringLexer&
if (type.NextIf('^'))
{
- clang::QualType target_type = BuildType(ast_ctx, type, allow_unknownanytype);
- if (target_type.isNull())
- return clang::QualType();
- else if (target_type == ast_ctx.UnknownAnyTy)
- return ast_ctx.UnknownAnyTy;
+ if (!allow_unknownanytype && type.NextIf('?'))
+ {
+ // if we are not supporting the concept of unknownAny, but what is being created here is an unknownAny*, then
+ // we can just get away with a void*
+ // this is theoretically wrong (in the same sense as 'theoretically nothing exists') but is way better than outright failure
+ // in many practical cases
+ return ast_ctx.VoidPtrTy;
+ }
else
- return ast_ctx.getPointerType(target_type);
+ {
+ clang::QualType target_type = BuildType(ast_ctx, type, allow_unknownanytype);
+ if (target_type.isNull())
+ return clang::QualType();
+ else if (target_type == ast_ctx.UnknownAnyTy)
+ return ast_ctx.UnknownAnyTy;
+ else
+ return ast_ctx.getPointerType(target_type);
+ }
}
if (type.NextIf('?'))
OpenPOWER on IntegriCloud