[analyzer] Make NonNullParamChecker as dependency for StdCLibraryFunctionsChecker

Summary:
If a given parameter in a FunctionDecl has a nonull attribute then the NonNull
constraint in StdCLibraryFunctionsChecker has the same effect as
NonNullParamChecker. I think it is better to emit diagnostics from the simpler
checker. By making NonNullParamChecker as a dependency, in these cases it will
be the first to emit a diagnostic and to stop the analysis on that path.

Reviewers: Szelethus, NoQ, baloghadamsoftware, balazske, steakhal

Subscribers: whisperity, xazax.hun, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, gamesh411, Charusso, ASDenysPetrov, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D79420
This commit is contained in:
Gabor Marton 2020-05-05 16:37:10 +02:00
parent 7b8e306560
commit d061685a83
2 changed files with 4 additions and 3 deletions

View File

@ -293,13 +293,14 @@ let ParentPackage = APIModeling in {
def StdCLibraryFunctionsChecker : Checker<"StdCLibraryFunctions">,
HelpText<"Improve modeling of the C standard library functions">,
Dependencies<[NonNullParamChecker, CallAndMessageChecker]>,
Documentation<NotDocumented>;
def StdCLibraryFunctionArgsChecker : Checker<"StdCLibraryFunctionArgs">,
HelpText<"Check constraints of arguments of C standard library functions, "
"such as whether the parameter of isalpha is in the range [0, 255] "
"or is EOF.">,
Dependencies<[StdCLibraryFunctionsChecker, CallAndMessageChecker]>,
Dependencies<[StdCLibraryFunctionsChecker]>,
Documentation<NotDocumented>;
def TrustNonnullChecker : Checker<"TrustNonnull">,

View File

@ -6,15 +6,15 @@
// CHECK: OVERVIEW: Clang Static Analyzer Enabled Checkers List
// CHECK-EMPTY:
// CHECK-NEXT: apiModeling.StdCLibraryFunctions
// CHECK-NEXT: core.NonNullParamChecker
// CHECK-NEXT: core.CallAndMessage
// CHECK-NEXT: apiModeling.StdCLibraryFunctions
// CHECK-NEXT: apiModeling.StdCLibraryFunctionArgs
// CHECK-NEXT: apiModeling.TrustNonnull
// CHECK-NEXT: apiModeling.llvm.CastValue
// CHECK-NEXT: apiModeling.llvm.ReturnValue
// CHECK-NEXT: core.DivideZero
// CHECK-NEXT: core.DynamicTypePropagation
// CHECK-NEXT: core.NonNullParamChecker
// CHECK-NEXT: core.NonnilStringConstants
// CHECK-NEXT: core.NullDereference
// CHECK-NEXT: core.StackAddrEscapeBase