[Lldb-commits] [lldb] 8b1cd37 - [lldb] Use lldbassert in BuildObjCObjectPointerType

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Jan 30 13:53:03 PST 2023


Author: Jonas Devlieghere
Date: 2023-01-30T13:52:44-08:00
New Revision: 8b1cd3749eb6872b3a71cee4fe65ae3b9de4dc93

URL: https://github.com/llvm/llvm-project/commit/8b1cd3749eb6872b3a71cee4fe65ae3b9de4dc93
DIFF: https://github.com/llvm/llvm-project/commit/8b1cd3749eb6872b3a71cee4fe65ae3b9de4dc93.diff

LOG: [lldb] Use lldbassert in BuildObjCObjectPointerType

This assert is only checked in Debug builds but ignored in all other
builds. This replaces this code with lldbassert which should print a
warning to the user in release builds and actually asserts in debug
builds.

Differential revision: https://reviews.llvm.org/D76697

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
index 9877263796232..2cc5319c84bbe 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
@@ -234,15 +234,12 @@ clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType(
 
     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
+    // 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.
+    lldbassert(!types.empty());
     if (types.empty())
       return ast_ctx.getObjCIdType();
-#endif
 
     return ClangUtil::GetQualType(types.front().GetPointerType());
   } else {


        


More information about the lldb-commits mailing list