[Lldb-commits] [lldb] 7323d07 - [lldb][NFC] Remove a bunch of unnecessary nullptr checks
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Thu Nov 4 07:21:20 PDT 2021
Author: Raphael Isemann
Date: 2021-11-04T15:21:03+01:00
New Revision: 7323d07483f201b2d73009deef45d2eff4dcd856
URL: https://github.com/llvm/llvm-project/commit/7323d07483f201b2d73009deef45d2eff4dcd856
DIFF: https://github.com/llvm/llvm-project/commit/7323d07483f201b2d73009deef45d2eff4dcd856.diff
LOG: [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
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 bb57d53426b5..e9c45f12b842 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -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,
More information about the lldb-commits
mailing list