Update apply-iwyu tool to report compile errors

Note: apply-iwyu on a lone .h file *will* fail due to c++/c confusion.

Bug: none
Change-Id: I3dda0df28cd4ec85ecb895efed1b04c3d70343bb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212680
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33525}
This commit is contained in:
Harald Alvestrand 2021-03-22 11:43:51 +00:00 committed by Commit Bot
parent ffb7603b60
commit 2ff25db72a

View File

@ -33,11 +33,22 @@ else
FILE_H=""
fi
# IWYU has a confusing set of exit codes. Discard it.
iwyu -Xiwyu --no_fwd_decls -D__X86_64__ -DWEBRTC_POSIX -I . \
-I third_party/abseil-cpp \
-I third_party/googletest/src/googlemock/include \
-I third_party/googletest/src/googletest/include \
$FILE_CC |& fix_include || echo "Some files modified"
$FILE_CC >& /tmp/includefixes$$ || echo "IWYU done, code $?"
if grep 'fatal error' /tmp/includefixes$$; then
echo "iwyu run failed"
cat /tmp/includefixes$$
rm /tmp/includefixes$$
exit 1
else
fix_include < /tmp/includefixes$$ || echo "Some files modified"
rm /tmp/includefixes$$
fi
if [ $REMOVE_CC_INCLUDES == "yes" ]; then
if [ -n "$FILE_H" ]; then