mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-04 16:41:43 +00:00

Main reason for this change is that these checkers were implemented in the same class but had different dependency ordering. (NonNullParamChecker should run before StdCLibraryFunctionArgs to get more special warning about null arguments, but the apiModeling.StdCLibraryFunctions was a modeling checker that should run before other non-modeling checkers. The modeling checker changes state in a way that makes it impossible to detect a null argument by NonNullParamChecker.) To make it more simple, the modeling part is removed as separate checker and can be only used if checker StdCLibraryFunctions is turned on, that produces the warnings too. Modeling the functions without bug detection (for invalid argument) is not possible. The modeling of standard functions does not happen by default from this change on. Reviewed By: Szelethus Differential Revision: https://reviews.llvm.org/D151225
25 lines
1.1 KiB
C
25 lines
1.1 KiB
C
// RUN: %clang_analyze_cc1 %s \
|
|
// RUN: -analyzer-checker=core \
|
|
// RUN: -analyzer-checker=alpha.unix.StdCLibraryFunctions \
|
|
// RUN: -analyzer-checker=debug.StdCLibraryFunctionsTester \
|
|
// RUN: -analyzer-config alpha.unix.StdCLibraryFunctions:DisplayLoadedSummaries=true \
|
|
// RUN: -triple i686-unknown-linux 2>&1 | FileCheck %s
|
|
|
|
// The signatures for these functions are the same and they specify their
|
|
// parameter with the restrict qualifier. In C, the signature should match only
|
|
// if the restrict qualifier is there on the parameter. Thus, the summary
|
|
// should be loaded for the last two declarations only.
|
|
void __test_restrict_param_0(void *p);
|
|
void __test_restrict_param_1(void *__restrict p);
|
|
void __test_restrict_param_2(void *restrict p);
|
|
|
|
// CHECK-NOT: Loaded summary for: void __test_restrict_param_0
|
|
// CHECK: Loaded summary for: void __test_restrict_param_1(void *restrict p)
|
|
// CHECK: Loaded summary for: void __test_restrict_param_2(void *restrict p)
|
|
|
|
// Must have at least one call expression to initialize the summary map.
|
|
int bar(void);
|
|
void foo(void) {
|
|
bar();
|
|
}
|