mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-05-14 09:56:33 +00:00

Output generation options (like `-save-temps`) will make the analyzer not executed even `--analyze` option is provided in the driver arguments. Besides, the original approach of adding `--analyze` option will not work when (more than one) `-fsyntax-only` options are provided in the driver arguments. This patch fixes these two problems by using the syntax-only adjuster to remove output generation options and manually filter out redundant `-fsyntax-only` options. In the new implementation, the adjusters added by `ClangTool` will not be removed but used as dependencies for clang-check adjusters for analyzer options. Reviewed By: sammccall Differential Revision: https://reviews.llvm.org/D116329
20 lines
577 B
C++
20 lines
577 B
C++
// Check whether output generation options (like -save-temps) will not affect
|
|
// the execution of the analyzer.
|
|
|
|
// RUN: clang-check -analyze %s -- -save-temps -c -Xclang -verify
|
|
|
|
// Check whether redundant -fsyntax-only options will affect the execution of
|
|
// the analyzer.
|
|
|
|
// RUN: clang-check -analyze %s -- \
|
|
// RUN: -fsyntax-only -c -fsyntax-only -Xclang -verify 2>&1 | \
|
|
// RUN: FileCheck %s --allow-empty
|
|
|
|
// CHECK-NOT: argument unused during compilation: '--analyze'
|
|
|
|
void a(int *x) {
|
|
if (x) {
|
|
}
|
|
*x = 47; // expected-warning {{Dereference of null pointer}}
|
|
}
|