Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-check] Adjust argument adjusters for clang-check to strip opti…
…ons blocking the static analyzer 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
- Loading branch information
1 parent
263d198
commit bba729a
Showing
2 changed files
with
50 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// 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}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters