[clang-tools-extra] 535e7b0 - [clangd] lookupSiblingsWithinContext - remove unnecessary nullptr check

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 18 03:13:03 PST 2022


Author: Simon Pilgrim
Date: 2022-02-18T11:12:53Z
New Revision: 535e7b09c189dd3a7ef65bd36a02962f0c98bd5e

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

LOG: [clangd] lookupSiblingsWithinContext - remove unnecessary nullptr check

The DC pointer is always dereferenced after the loop

Added: 
    

Modified: 
    clang-tools-extra/clangd/refactor/Rename.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/refactor/Rename.cpp b/clang-tools-extra/clangd/refactor/Rename.cpp
index b106664f0a446..46d884578d462 100644
--- a/clang-tools-extra/clangd/refactor/Rename.cpp
+++ b/clang-tools-extra/clangd/refactor/Rename.cpp
@@ -389,7 +389,7 @@ const NamedDecl *lookupSiblingsWithinContext(ASTContext &Ctx,
   DeclarationName LookupName(&II);
   DeclContextLookupResult LookupResult;
   const auto *DC = RenamedDecl.getDeclContext();
-  while (DC && DC->isTransparentContext())
+  while (DC->isTransparentContext())
     DC = DC->getParent();
   switch (DC->getDeclKind()) {
   // The enclosing DeclContext may not be the enclosing scope, it might have


        


More information about the cfe-commits mailing list