[clang] b19473c - [clang] RewriteObjCClassMetaData - remove superfluous null pointer check. NFCI.
Simon Pilgrim via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 27 06:20:48 PDT 2020
Author: Simon Pilgrim
Date: 2020-10-27T13:14:55Z
New Revision: b19473cf590eca13d23a20191c820d0f9d835beb
URL: https://github.com/llvm/llvm-project/commit/b19473cf590eca13d23a20191c820d0f9d835beb
DIFF: https://github.com/llvm/llvm-project/commit/b19473cf590eca13d23a20191c820d0f9d835beb.diff
LOG: [clang] RewriteObjCClassMetaData - remove superfluous null pointer check. NFCI.
We've already dereferenced the pointer and no other getClassInterface() calls appear to bother with such a check.
Reported as "Snippet 6" in https://www.viva64.com/en/b/0771/
Added:
Modified:
clang/lib/Frontend/Rewrite/RewriteObjC.cpp
Removed:
################################################################################
diff --git a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
index 3caf9a672062..543b3b09a9cc 100644
--- a/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
+++ b/clang/lib/Frontend/Rewrite/RewriteObjC.cpp
@@ -5285,9 +5285,8 @@ void RewriteObjCFragileABI::RewriteObjCClassMetaData(ObjCImplementationDecl *IDe
}
// Build _objc_ivar_list metadata for classes ivars if needed
- unsigned NumIvars = !IDecl->ivar_empty()
- ? IDecl->ivar_size()
- : (CDecl ? CDecl->ivar_size() : 0);
+ unsigned NumIvars =
+ !IDecl->ivar_empty() ? IDecl->ivar_size() : CDecl->ivar_size();
if (NumIvars > 0) {
static bool objc_ivar = false;
if (!objc_ivar) {
More information about the cfe-commits
mailing list