diff options
author | Dani Ferreira Franco Moura <danimoura@google.com> | 2022-12-16 12:07:56 +0100 |
---|---|---|
committer | Dmitri Gribenko <gribozavr@gmail.com> | 2022-12-16 12:22:23 +0100 |
commit | 0da4cecfb6ad14ee0f0f9fa904e685fd6b64be60 (patch) | |
tree | 85c60e28e72ead9dfbf3f4cbca3c9c05cdaa7a1d /clang/lib/Sema/SemaChecking.cpp | |
parent | 47f0b6630c78ab52c2197ec5e1c2d13a6acffed1 (diff) | |
download | llvm-0da4cecfb6ad14ee0f0f9fa904e685fd6b64be60.zip llvm-0da4cecfb6ad14ee0f0f9fa904e685fd6b64be60.tar.gz llvm-0da4cecfb6ad14ee0f0f9fa904e685fd6b64be60.tar.bz2 |
[clang][dataflow] Remove unused argument in getNullability
This change will allow users to call getNullability() without providing an ASTContext.
Reviewed By: gribozavr2
Differential Revision: https://reviews.llvm.org/D140104
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 97345a8..9f0c849 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -5544,8 +5544,7 @@ bool Sema::getFormatStringInfo(const FormatAttr *Format, bool IsCXXMember, /// Returns true if the value evaluates to null. static bool CheckNonNullExpr(Sema &S, const Expr *Expr) { // If the expression has non-null type, it doesn't evaluate to null. - if (auto nullability - = Expr->IgnoreImplicit()->getType()->getNullability(S.Context)) { + if (auto nullability = Expr->IgnoreImplicit()->getType()->getNullability()) { if (*nullability == NullabilityKind::NonNull) return false; } @@ -5629,8 +5628,8 @@ DiagnoseCStringFormatDirectiveInCFAPI(Sema &S, } /// Determine whether the given type has a non-null nullability annotation. -static bool isNonNullType(ASTContext &ctx, QualType type) { - if (auto nullability = type->getNullability(ctx)) +static bool isNonNullType(QualType type) { + if (auto nullability = type->getNullability()) return *nullability == NullabilityKind::NonNull; return false; @@ -5683,8 +5682,7 @@ static void CheckNonNullArguments(Sema &S, for (ArrayRef<ParmVarDecl*>::iterator I = parms.begin(), E = parms.end(); I != E; ++I, ++ParamIndex) { const ParmVarDecl *PVD = *I; - if (PVD->hasAttr<NonNullAttr>() || - isNonNullType(S.Context, PVD->getType())) { + if (PVD->hasAttr<NonNullAttr>() || isNonNullType(PVD->getType())) { if (NonNullArgs.empty()) NonNullArgs.resize(Args.size()); @@ -5713,7 +5711,7 @@ static void CheckNonNullArguments(Sema &S, if (Proto) { unsigned Index = 0; for (auto paramType : Proto->getParamTypes()) { - if (isNonNullType(S.Context, paramType)) { + if (isNonNullType(paramType)) { if (NonNullArgs.empty()) NonNullArgs.resize(Args.size()); @@ -12026,7 +12024,7 @@ Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType, const FunctionDecl *FD) { // Check if the return value is null but should not be. if (((Attrs && hasSpecificAttr<ReturnsNonNullAttr>(*Attrs)) || - (!isObjCMethod && isNonNullType(Context, lhsType))) && + (!isObjCMethod && isNonNullType(lhsType))) && CheckNonNullExpr(*this, RetValExp)) Diag(ReturnLoc, diag::warn_null_ret) << (isObjCMethod ? 1 : 0) << RetValExp->getSourceRange(); |