Nate Chandler via llvm-dev
2019-Sep-27 00:56 UTC
[llvm-dev] Suppressing lit's non-error logs when --quiet is specified
Lit can accept a --quiet/-q flag which is documented to "suppress no error output". If I'm understanding correctly, the intent here is to suppress both notes and warnings and only show errors. Such a behavior would be handy. Editors could pass the --quiet flag to specify that they are only interested in getting logs for errors, and, when encountering errors, use the location data in lit's output to allow highlighting and jumping to the problematic lines. For example, the output could populate vim's quickfix window. While this is possible currently, there can be a number of locations which must first be skipped past before getting to the locations of interest. Currently, however, the flag does not necessarily have that behavior. Maintainers of lit.cfg files must manually check the flag to determine whether to call LitConfig.note and LitConfig.warning. Here's an example: https://github.com/apple/swift/blob/master/test/lit.cfg#L246 . It is possible ( https://github.com/apple/swift/pull/27361/files ) to be complete about this, but it would be nicer to just check the flag inside the function being called. Here ( https://reviews.llvm.org/D68044 ) is a patch which implements this behavior, tweaking LitConfig's note and warning methods to check the quiet flag before writing the message. Would suppressing notes and warnings in lit itself break users of that flag and/or is this in fact the intended behavior of the flag? If --quiet is intended to have a different purpose, then it would be nice to add a different flag ( "--print-errors-only" or similar) which does suppress notes and warnings. Nate