-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[clang][NFC] remove unneeded nullptr checks after dereference #100489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang][NFC] remove unneeded nullptr checks after dereference #100489
Conversation
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.
@llvm/pr-subscribers-clang Author: Mike Rice (mikerice1969) ChangesFix static verifer concerns of null pointer checks after dereferencing Full diff: https://github.com/llvm/llvm-project/pull/100489.diff 1 Files Affected:
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;
}
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/2641 Here is the relevant piece of the build log for the reference:
|
Summary: 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. Test Plan: Reviewers: Subscribers: Tasks: Tags: Differential Revision: https://phabricator.intern.facebook.com/D60250760
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.