llvm-project/clang/test/Analysis/std-c-library-functions-POSIX-lookup.c
Aaron Ballman 1ea584377e A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the ninth batch of tests being updated (there are a
significant number of other tests left to be updated).
2022-02-13 08:03:40 -05:00

23 lines
1002 B
C

// 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(void) {
bar();
}
// CHECK-NOT: Loaded summary for: