nicovank wrote:

Reproduced the buffering issue on my setup, but flushing didn't fix the problem.
I could also reproduce with the current version of this script, which does also 
flush after writing.
Python defaults input/output streams to buffered mode when it detects a pipe, 
and I don't think flushing overrides that setting.
One way to force unbuffering I know of is to run `python3 -u` when initially 
invoking the script, but that's not great here.

<details>

<summary>Reproduction with current script version.</summary>

```
% python3 run-clang-tidy.py -checks="-*,performance-*" -source-filter 
".*clang-tools-extra/clang-query.*" &>output

/home/nvankempen_umass_edu/work/build/bin/clang-tidy -checks=-*,performance-* 
-p=/home/nvankempen_umass_edu/work/llvm-project 
/home/nvankempen_umass_edu/work/llvm-project/clang-tools-extra/clang-query/QueryParser.cpp
/home/nvankempen_umass_edu/work/llvm-project/clang-tools-extra/clang-query/QueryParser.cpp:175:6:
 warning: enum 'ParsedQueryKind' uses a larger base type ('unsigned int', size: 
4 bytes) than necessary for its value set, consider using 'std::uint8_t' (1 
byte) as the base type to reduce its size [performance-enum-size]
  175 | enum ParsedQueryKind {
      |      ^
/home/nvankempen_umass_edu/work/llvm-project/clang-tools-extra/clang-query/QueryParser.cpp:189:6:
 warning: enum 'ParsedQueryVariable' uses a larger base type ('unsigned int', 
size: 4 bytes) than necessary for its value set, consider using 'std::uint8_t' 
(1 byte) as the base type to reduce its size [performance-enum-size]
  189 | enum ParsedQueryVariable {
      |      ^
/home/nvankempen_umass_edu/work/build/bin/clang-tidy -checks=-*,performance-* 
-p=/home/nvankempen_umass_edu/work/llvm-project 
/home/nvankempen_umass_edu/work/llvm-project/clang-tools-extra/clang-query/tool/ClangQuery.cpp
/home/nvankempen_umass_edu/work/build/bin/clang-tidy -checks=-*,performance-* 
-p=/home/nvankempen_umass_edu/work/llvm-project 
/home/nvankempen_umass_edu/work/llvm-project/clang-tools-extra/clang-query/Query.cpp
1363 warnings generated.
Suppressed 1361 warnings (1361 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
1595 warnings generated.
Suppressed 1595 warnings (1595 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
1633 warnings generated.
Suppressed 1633 warnings (1633 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use 
-system-headers to display errors from system headers as well.
```

</details>

I think the way to go here is just to print everything to stdout, stderr can be 
reserved to issues within the script itself.
**→ This is the behavior in the current version of this PR**.

Added an initial message with the number of files to process over the number of 
files in compilation database.

Added a runtime number for each file.
Thought about making a `ClangTidyResult` class to wrap the `run_tidy` return, 
but it's only used once and would make the deconstructing harder, so it's fine.

https://github.com/llvm/llvm-project/pull/89490
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to