[Lldb-commits] [lldb] r224038 - Removed the assertion that we can find any named

Sean Callanan scallanan at apple.com
Thu Dec 11 11:33:57 PST 2014


Author: spyffe
Date: Thu Dec 11 13:33:57 2014
New Revision: 224038

URL: http://llvm.org/viewvc/llvm-project?rev=224038&view=rev
Log:
Removed the assertion that we can find any named
Objective-C type in the runtime.  This is not actually
true, it's entirely possible to say

@class DoesntExist;

@interface DoesExist {
  DoesntExist *whyyyyy;
}
@end

and this code will not only compile but also run.  So
this assertion will fire in situations users might
encounter.

I left the assertion enabled in debug mode, because we
could still catch a case we're not aware of (i.e., a
class that we *ought* to have found but where somehow
we mis-parsed the name).

<rdar://problem/19151914>

Modified:
    lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp

Modified: lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp?rev=224038&r1=224037&r2=224038&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp (original)
+++ lldb/trunk/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp Thu Dec 11 13:33:57 2014
@@ -253,7 +253,14 @@ AppleObjCTypeEncodingParser::BuildObjCOb
                                                     max_matches,
                                                     decls);
 
-        assert(num_types); // how can a type be mentioned in runtime type signatures and not be in the runtime?
+        // The user can forward-declare something that has no definition.  The runtime doesn't prohibit this at all.
+        // This is a rare and very weird case.  We keep this assert in debug builds so we catch other weird cases.
+#ifdef LLDB_CONFIGURATION_DEBUG
+        assert(num_types);
+#else
+        if (!num_types)
+            return ast_ctx.getObjCIdType();
+#endif
         
         return ClangASTContext::GetTypeForDecl(decls[0]).GetPointerType().GetQualType();
     }





More information about the lldb-commits mailing list