[clangd] lookupSiblingsWithinContext - remove unnecessary nullptr check
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 18 Feb 2022 11:12:33 +0000 (11:12 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 18 Feb 2022 11:12:53 +0000 (11:12 +0000)
The DC pointer is always dereferenced after the loop

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

index b106664..46d8845 100644 (file)
@@ -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