mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-24 05:55:43 -04:00

I'm in the process of refactoring AnalyzerOptions. The main motivation behind here is to emit warnings if an invalid -analyzer-config option is given from the command line, and be able to list them all. In this patch, I found some flags that should've been used as checker options, or have absolutely no mention of in AnalyzerOptions, or are nonexistent. - NonLocalizedStringChecker now uses its "AggressiveReport" flag as a checker option - lib/StaticAnalyzer/Frontend/ModelInjector.cpp now accesses the "model-path" option through a getter in AnalyzerOptions - -analyzer-config path-diagnostics-alternate=false is not a thing, I removed it, - lib/StaticAnalyzer/Checkers/AllocationDiagnostics.cpp and lib/StaticAnalyzer/Checkers/AllocationDiagnostics.h are weird, they actually only contain an option getter. I deleted them, and fixed RetainCountChecker to get it's "leak-diagnostics-reference-allocation" option as a checker option, - "region-store-small-struct-limit" has a proper getter now. Differential Revision: https://reviews.llvm.org/D53276 llvm-svn: 345985
29 lines
794 B
C
29 lines
794 B
C
// RUN: rm -f %t
|
|
// RUN: %clang_analyze_cc1 -fblocks \
|
|
// RUN: -analyzer-checker=core,unix.Malloc,unix.cstring.NullArg \
|
|
// RUN: -analyzer-disable-checker=alpha.unix.cstring.OutOfBounds \
|
|
// RUN: -analyzer-output=plist -o %t %s
|
|
// RUN: FileCheck -input-file %t %s
|
|
|
|
typedef __typeof(sizeof(int)) size_t;
|
|
void *malloc(size_t);
|
|
void free(void *);
|
|
char *strncpy(char *restrict s1, const char *restrict s2, size_t n);
|
|
|
|
|
|
|
|
void cstringchecker_bounds_nocrash() {
|
|
char *p = malloc(2);
|
|
strncpy(p, "AAA", sizeof("AAA")); // we don't expect warning as the checker is disabled
|
|
free(p);
|
|
}
|
|
|
|
// CHECK: <key>diagnostics</key>
|
|
// CHECK-NEXT: <array>
|
|
// CHECK-NEXT: </array>
|
|
// CHECK-NEXT: <key>files</key>
|
|
// CHECK-NEXT: <array>
|
|
// CHECK-NEXT: </array>
|
|
// CHECK-NEXT: </dict>
|
|
// CHECK-NEXT: </plist>
|