From 8b1cd3749eb6872b3a71cee4fe65ae3b9de4dc93 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 24 Jan 2023 16:29:26 -0800 Subject: [PATCH] [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 --- .../ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp index 9877263..2cc5319 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 { -- 2.7.4