mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 12:39:19 +00:00
[analyzer][StdLibraryFunctionsChecker] Use Optionals throughout the summary API
By using optionals, we no longer have to check the validity of types that we get from a lookup. This way, the definition of the summaries have a declarative form, there are no superflous conditions in the source code. Differential Revision: https://reviews.llvm.org/D86531
This commit is contained in:
parent
9fbb113247
commit
a787a4ed16
File diff suppressed because it is too large
Load Diff
22
clang/test/Analysis/std-c-library-functions-POSIX-lookup.c
Normal file
22
clang/test/Analysis/std-c-library-functions-POSIX-lookup.c
Normal file
@ -0,0 +1,22 @@
|
||||
// RUN: %clang_analyze_cc1 %s \
|
||||
// RUN: -analyzer-checker=core \
|
||||
// RUN: -analyzer-checker=apiModeling.StdCLibraryFunctions \
|
||||
// RUN: -analyzer-config apiModeling.StdCLibraryFunctions:ModelPOSIX=true \
|
||||
// RUN: -analyzer-config apiModeling.StdCLibraryFunctions:DisplayLoadedSummaries=true \
|
||||
// RUN: -analyzer-checker=debug.ExprInspection \
|
||||
// RUN: -analyzer-config eagerly-assume=false \
|
||||
// RUN: -triple i686-unknown-linux 2>&1 | FileCheck %s --allow-empty
|
||||
|
||||
// We test here the implementation of our summary API with Optional types. In
|
||||
// this TU we do not provide declaration for any of the functions that have
|
||||
// summaries. The implementation should be able to handle the nonexistent
|
||||
// declarations in a way that the summary is not added to the map. We expect no
|
||||
// crashes (i.e. no optionals should be 'dereferenced') and no output.
|
||||
|
||||
// Must have at least one call expression to initialize the summary map.
|
||||
int bar(void);
|
||||
void foo() {
|
||||
bar();
|
||||
}
|
||||
|
||||
// CHECK-NOT: Loaded summary for:
|
Loading…
x
Reference in New Issue
Block a user