diff options
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(); |