Skip to content

Commit 51d4980

Browse files
authored
[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.
1 parent 010dcfd commit 51d4980

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12248,16 +12248,15 @@ Decl *Sema::ActOnUsingEnumDeclaration(Scope *S, AccessSpecifier AS,
1224812248
SourceLocation EnumLoc, SourceRange TyLoc,
1224912249
const IdentifierInfo &II, ParsedType Ty,
1225012250
CXXScopeSpec *SS) {
12251-
assert(!SS->isInvalid() && "ScopeSpec is invalid");
12251+
assert(SS && !SS->isInvalid() && "ScopeSpec is invalid");
1225212252
TypeSourceInfo *TSI = nullptr;
1225312253
SourceLocation IdentLoc = TyLoc.getBegin();
1225412254
QualType EnumTy = GetTypeFromParser(Ty, &TSI);
1225512255
if (EnumTy.isNull()) {
12256-
Diag(IdentLoc, SS && isDependentScopeSpecifier(*SS)
12256+
Diag(IdentLoc, isDependentScopeSpecifier(*SS)
1225712257
? diag::err_using_enum_is_dependent
1225812258
: diag::err_unknown_typename)
12259-
<< II.getName()
12260-
<< SourceRange(SS ? SS->getBeginLoc() : IdentLoc, TyLoc.getEnd());
12259+
<< II.getName() << SourceRange(SS->getBeginLoc(), TyLoc.getEnd());
1226112260
return nullptr;
1226212261
}
1226312262

0 commit comments

Comments
 (0)