Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] Allow clang-check to customize analyzer output file or dir name
Required by https://stackoverflow.com/questions/58073606 As the output argument is stripped out in the clang-check tool, it seems impossible for clang-check users to customize the output file name, even with -extra-args and -extra-arg-before. This patch adds the -analyzer-output-path argument to allow users to adjust the output name. And if the argument is not set or the analyzer is not enabled, the original strip output adjuster will remove the output arguments. Differential Revision: https://reviews.llvm.org/D97265
- Loading branch information
1 parent
677df8c
commit da168dd
Showing
2 changed files
with
31 additions
and
1 deletion.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
clang/test/Tooling/clang-check-set-analyzer-output-path.cpp
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,14 @@ | ||
// RUN: rm -rf %t | ||
// RUN: mkdir %t | ||
// RUN: cd %t | ||
// RUN: echo '[{"directory":".","command":"clang++ -c %t/test.cpp -o foo -ofoo","file":"%t/test.cpp"}]' | sed -e 's/\\/\//g' > %t/compile_commands.json | ||
// RUN: cp "%s" "%t/test.cpp" | ||
// RUN: echo '// CHECK: {{qwerty}}' > %t/cclog-check | ||
// RUN: clang-check -p "%t" "%t/test.cpp" -analyze -analyzer-output-path=%t/qwerty -extra-arg=-v -extra-arg=-Xclang -extra-arg=-verify 2>&1 | FileCheck %t/cclog-check | ||
// RUN: FileCheck %s --input-file=%t/qwerty | ||
|
||
// CHECK: DOCTYPE plist | ||
// CHECK: Division by zero | ||
int f() { | ||
return 1 / 0; // expected-warning {{Division by zero}} | ||
} |
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