[Lldb-commits] [PATCH] D76697: [lldb] Remove Debug-only assert in AppleObjCTypeEncodingParser::BuildObjCObjectPointerType

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Mar 24 06:24:57 PDT 2020


teemperor created this revision.
teemperor added a reviewer: LLDB.
Herald added a subscriber: JDevlieghere.
teemperor updated this revision to Diff 252289.
teemperor added a comment.

- Upload correct diff.


This assert only triggers in Debug builds (and not in Rel+Assert builds). Let's always create a log if this
situation happens where we can't find the full type in the runtime and remove the Debug-only assert.


https://reviews.llvm.org/D76697

Files:
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp


Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
===================================================================
--- lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
+++ lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
@@ -230,15 +230,13 @@
 
     auto types = decl_vendor->FindTypes(ConstString(name), /*max_matches*/ 1);
 
-// 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(!types.empty());
-#else
-    if (types.empty())
+    // 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.
+    if (types.empty()) {
+      Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES);
+      LLDB_LOG(log, "Could not find type with name '{0}' in runtime", name);
       return ast_ctx.getObjCIdType();
-#endif
+    }
 
     return ClangUtil::GetQualType(types.front().GetPointerType());
   } else {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76697.252289.patch
Type: text/x-patch
Size: 1249 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200324/ed768062/attachment-0001.bin>


More information about the lldb-commits mailing list