Author: Michael Buch
Date: 2026-01-19T11:50:39Z
New Revision: cf4cf854df3c878813b9fa568ae04858b39633d8

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

LOG: [lldb][TypeSystemClang] Remove redundant allow_completion parameter to 
GetCompleteQualType

No caller sets this parameter to `false`. It's odd that we would provide
such an option to a user. This gets used whenever we want to
ensure/check that a type has a definition. Never do we actually want to
expose the underlying mechanism of whether the type has been lazily
completed or not. A more dedicated API could introduced for this
purpose if we really wanted one.

Added: 
    

Modified: 
    lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp 
b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index 0109105d04977..ee3f17e975d80 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -2652,9 +2652,8 @@ TypeSystemClang::GetDeclContextForType(clang::QualType 
type) {
 /// function will try to complete the type if necessary (and allowed
 /// by the specified \ref allow_completion). If we fail to return a *complete*
 /// type, returns nullptr.
-static const clang::RecordType *GetCompleteRecordType(clang::ASTContext *ast,
-                                                      clang::QualType 
qual_type,
-                                                      bool allow_completion) {
+static const clang::RecordType *
+GetCompleteRecordType(clang::ASTContext *ast, clang::QualType qual_type) {
   assert(qual_type->isRecordType());
 
   const auto *tag_type = llvm::cast<clang::RecordType>(qual_type.getTypePtr());
@@ -2674,9 +2673,6 @@ static const clang::RecordType 
*GetCompleteRecordType(clang::ASTContext *ast,
   if (is_complete && fields_loaded)
     return tag_type;
 
-  if (!allow_completion)
-    return nullptr;
-
   // Call the field_begin() accessor to for it to use the external source
   // to load the fields...
   //
@@ -2699,8 +2695,7 @@ static const clang::RecordType 
*GetCompleteRecordType(clang::ASTContext *ast,
 /// by the specified \ref allow_completion). If we fail to return a *complete*
 /// type, returns nullptr.
 static const clang::EnumType *GetCompleteEnumType(clang::ASTContext *ast,
-                                                  clang::QualType qual_type,
-                                                  bool allow_completion) {
+                                                  clang::QualType qual_type) {
   assert(qual_type->isEnumeralType());
   assert(ast);
 
@@ -2714,9 +2709,6 @@ static const clang::EnumType 
*GetCompleteEnumType(clang::ASTContext *ast,
   if (tag_decl->getDefinition())
     return enum_type;
 
-  if (!allow_completion)
-    return nullptr;
-
   // No definition but can't complete it, error out.
   if (!tag_decl->hasExternalLexicalStorage())
     return nullptr;
@@ -2735,8 +2727,7 @@ static const clang::EnumType 
*GetCompleteEnumType(clang::ASTContext *ast,
 /// by the specified \ref allow_completion). If we fail to return a *complete*
 /// type, returns nullptr.
 static const clang::ObjCObjectType *
-GetCompleteObjCObjectType(clang::ASTContext *ast, QualType qual_type,
-                          bool allow_completion) {
+GetCompleteObjCObjectType(clang::ASTContext *ast, QualType qual_type) {
   assert(qual_type->isObjCObjectType());
   assert(ast);
 
@@ -2754,9 +2745,6 @@ GetCompleteObjCObjectType(clang::ASTContext *ast, 
QualType qual_type,
   if (class_interface_decl->getDefinition())
     return objc_class_type;
 
-  if (!allow_completion)
-    return nullptr;
-
   // No definition but can't complete it, error out.
   if (!class_interface_decl->hasExternalLexicalStorage())
     return nullptr;
@@ -2771,8 +2759,7 @@ GetCompleteObjCObjectType(clang::ASTContext *ast, 
QualType qual_type,
 }
 
 static bool GetCompleteQualType(clang::ASTContext *ast,
-                                clang::QualType qual_type,
-                                bool allow_completion = true) {
+                                clang::QualType qual_type) {
   qual_type = RemoveWrappingTypes(qual_type);
   const clang::Type::TypeClass type_class = qual_type->getTypeClass();
   switch (type_class) {
@@ -2783,27 +2770,24 @@ static bool GetCompleteQualType(clang::ASTContext *ast,
         llvm::dyn_cast<clang::ArrayType>(qual_type.getTypePtr());
 
     if (array_type)
-      return GetCompleteQualType(ast, array_type->getElementType(),
-                                 allow_completion);
+      return GetCompleteQualType(ast, array_type->getElementType());
   } break;
   case clang::Type::Record: {
-    if (const auto *RT =
-            GetCompleteRecordType(ast, qual_type, allow_completion))
+    if (const auto *RT = GetCompleteRecordType(ast, qual_type))
       return !RT->isIncompleteType();
 
     return false;
   } break;
 
   case clang::Type::Enum: {
-    if (const auto *ET = GetCompleteEnumType(ast, qual_type, allow_completion))
+    if (const auto *ET = GetCompleteEnumType(ast, qual_type))
       return !ET->isIncompleteType();
 
     return false;
   } break;
   case clang::Type::ObjCObject:
   case clang::Type::ObjCInterface: {
-    if (const auto *OT =
-            GetCompleteObjCObjectType(ast, qual_type, allow_completion))
+    if (const auto *OT = GetCompleteObjCObjectType(ast, qual_type))
       return !OT->isIncompleteType();
 
     return false;
@@ -2811,8 +2795,7 @@ static bool GetCompleteQualType(clang::ASTContext *ast,
 
   case clang::Type::Attributed:
     return GetCompleteQualType(
-        ast, llvm::cast<clang::AttributedType>(qual_type)->getModifiedType(),
-        allow_completion);
+        ast, llvm::cast<clang::AttributedType>(qual_type)->getModifiedType());
 
   case clang::Type::MemberPointer:
     // MS C++ ABI requires type of the class to be complete of which the 
pointee
@@ -2820,8 +2803,7 @@ static bool GetCompleteQualType(clang::ASTContext *ast,
     if (ast->getTargetInfo().getCXXABI().isMicrosoft()) {
       auto *MPT = qual_type.getTypePtr()->castAs<clang::MemberPointerType>();
       if (auto *RD = MPT->getMostRecentCXXRecordDecl())
-        GetCompleteRecordType(ast, ast->getCanonicalTagType(RD),
-                              allow_completion);
+        GetCompleteRecordType(ast, ast->getCanonicalTagType(RD));
 
       return !qual_type.getTypePtr()->isIncompleteType();
     }
@@ -3037,9 +3019,7 @@ bool 
TypeSystemClang::IsCompleteType(lldb::opaque_compiler_type_t type) {
   // definition. Without completing the type now we would just tell the user
   // the current (internal) completeness state of the type and most users don't
   // care (or even know) about this behavior.
-  const bool allow_completion = true;
-  return GetCompleteQualType(&getASTContext(), GetQualType(type),
-                             allow_completion);
+  return GetCompleteQualType(&getASTContext(), GetQualType(type));
 }
 
 bool TypeSystemClang::IsConst(lldb::opaque_compiler_type_t type) {
@@ -3821,9 +3801,7 @@ bool TypeSystemClang::IsObjCObjectPointerType(const 
CompilerType &type,
 bool TypeSystemClang::GetCompleteType(lldb::opaque_compiler_type_t type) {
   if (!type)
     return false;
-  const bool allow_completion = true;
-  return GetCompleteQualType(&getASTContext(), GetQualType(type),
-                             allow_completion);
+  return GetCompleteQualType(&getASTContext(), GetQualType(type));
 }
 
 ConstString TypeSystemClang::GetTypeName(lldb::opaque_compiler_type_t type,


        
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to