[clang-tools-extra] 003e038 - [clang-tidy] getOutermostNamespace - remove redundant nullptr check

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 12 02:56:36 PST 2022


Author: Simon Pilgrim
Date: 2022-02-12T10:49:54Z
New Revision: 003e0382647fa311e1bd48bc5298a3182d6f2552

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

LOG: [clang-tidy] getOutermostNamespace - remove redundant nullptr check

The pointer is always dereferenced

Added: 
    

Modified: 
    clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp b/clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp
index 0636883c48193..91e9e026d0ad1 100644
--- a/clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp
+++ b/clang-tools-extra/clang-tidy/llvmlibc/CalleeNamespaceCheck.cpp
@@ -22,7 +22,7 @@ namespace llvm_libc {
 // Unit.
 const DeclContext *getOutermostNamespace(const DeclContext *Decl) {
   const DeclContext *Parent = Decl->getParent();
-  if (Parent && Parent->isTranslationUnit())
+  if (Parent->isTranslationUnit())
     return Decl;
   return getOutermostNamespace(Parent);
 }


        


More information about the cfe-commits mailing list