[lldb][NFC] Remove a bunch of unnecessary nullptr checks

Those nullptr checks are after we already accessed the pointer.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D113175
This commit is contained in:
Raphael Isemann 2021-11-04 14:49:58 +01:00
parent b8b6a5bc86
commit 7323d07483
1 changed files with 20 additions and 29 deletions

View File

@ -1327,19 +1327,16 @@ CompilerType TypeSystemClang::CreateRecordType(
decl->setAnonymousStructOrUnion(true);
}
if (decl) {
if (metadata)
SetMetadata(decl, *metadata);
if (metadata)
SetMetadata(decl, *metadata);
if (access_type != eAccessNone)
decl->setAccess(ConvertAccessTypeToAccessSpecifier(access_type));
if (access_type != eAccessNone)
decl->setAccess(ConvertAccessTypeToAccessSpecifier(access_type));
if (decl_ctx)
decl_ctx->addDecl(decl);
if (decl_ctx)
decl_ctx->addDecl(decl);
return GetType(ast.getTagDeclType(decl));
}
return CompilerType();
return GetType(ast.getTagDeclType(decl));
}
namespace {
@ -1605,15 +1602,13 @@ ClassTemplateDecl *TypeSystemClang::CreateClassTemplateDecl(
template_cxx_decl->setDescribedClassTemplate(class_template_decl);
SetOwningModule(class_template_decl, owning_module);
if (class_template_decl) {
if (access_type != eAccessNone)
class_template_decl->setAccess(
ConvertAccessTypeToAccessSpecifier(access_type));
if (access_type != eAccessNone)
class_template_decl->setAccess(
ConvertAccessTypeToAccessSpecifier(access_type));
decl_ctx->addDecl(class_template_decl);
decl_ctx->addDecl(class_template_decl);
VerifyDecl(class_template_decl);
}
VerifyDecl(class_template_decl);
return class_template_decl;
}
@ -1803,7 +1798,7 @@ CompilerType TypeSystemClang::CreateObjCClass(
decl->setImplicit(isInternal);
SetOwningModule(decl, owning_module);
if (decl && metadata)
if (metadata)
SetMetadata(decl, *metadata);
return GetType(ast.getObjCInterfaceType(decl));
@ -2141,8 +2136,7 @@ FunctionDecl *TypeSystemClang::CreateFunctionDeclaration(
? ConstexprSpecKind::Constexpr
: ConstexprSpecKind::Unspecified);
SetOwningModule(func_decl, owning_module);
if (func_decl)
decl_ctx->addDecl(func_decl);
decl_ctx->addDecl(func_decl);
VerifyDecl(func_decl);
@ -2305,18 +2299,15 @@ CompilerType TypeSystemClang::CreateEnumerationType(
enum_decl->setScopedUsingClassTag(is_scoped);
enum_decl->setFixed(false);
SetOwningModule(enum_decl, owning_module);
if (enum_decl) {
if (decl_ctx)
decl_ctx->addDecl(enum_decl);
if (decl_ctx)
decl_ctx->addDecl(enum_decl);
// TODO: check if we should be setting the promotion type too?
enum_decl->setIntegerType(ClangUtil::GetQualType(integer_clang_type));
// TODO: check if we should be setting the promotion type too?
enum_decl->setIntegerType(ClangUtil::GetQualType(integer_clang_type));
enum_decl->setAccess(AS_public); // TODO respect what's in the debug info
enum_decl->setAccess(AS_public); // TODO respect what's in the debug info
return GetType(ast.getTagDeclType(enum_decl));
}
return CompilerType();
return GetType(ast.getTagDeclType(enum_decl));
}
CompilerType TypeSystemClang::GetIntTypeFromBitSize(size_t bit_size,