Author: Mike Rice Date: 2024-07-25T08:03:16-07:00 New Revision: 51d4980a133db12888207698e39c469cb7055cac
URL: https://github.com/llvm/llvm-project/commit/51d4980a133db12888207698e39c469cb7055cac DIFF: https://github.com/llvm/llvm-project/commit/51d4980a133db12888207698e39c469cb7055cac.diff LOG: [clang][NFC] remove unneeded nullptr checks after dereference (#100489) Fix static verifer concerns of null pointer checks after dereferencing the pointer. Update the assert to make it super clear it is not null and remove the checks. Added: Modified: clang/lib/Sema/SemaDeclCXX.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 04b8d88cae217..1cca8ac9b9343 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -12248,16 +12248,15 @@ Decl *Sema::ActOnUsingEnumDeclaration(Scope *S, AccessSpecifier AS, SourceLocation EnumLoc, SourceRange TyLoc, const IdentifierInfo &II, ParsedType Ty, CXXScopeSpec *SS) { - assert(!SS->isInvalid() && "ScopeSpec is invalid"); + assert(SS && !SS->isInvalid() && "ScopeSpec is invalid"); TypeSourceInfo *TSI = nullptr; SourceLocation IdentLoc = TyLoc.getBegin(); QualType EnumTy = GetTypeFromParser(Ty, &TSI); if (EnumTy.isNull()) { - Diag(IdentLoc, SS && isDependentScopeSpecifier(*SS) + Diag(IdentLoc, isDependentScopeSpecifier(*SS) ? diag::err_using_enum_is_dependent : diag::err_unknown_typename) - << II.getName() - << SourceRange(SS ? SS->getBeginLoc() : IdentLoc, TyLoc.getEnd()); + << II.getName() << SourceRange(SS->getBeginLoc(), TyLoc.getEnd()); return nullptr; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits