Skip to content

Commit

Permalink
[clang][NFC] remove unneeded nullptr checks after dereference (#100489)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mikerice1969 authored Jul 25, 2024
1 parent 010dcfd commit 51d4980
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions clang/lib/Sema/SemaDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 51d4980

Please sign in to comment.