IWYU: Don't filter for already-included header files.
The Google C++ style guide says that when both use a declaration, both the .h file and the .cc file should include the relevant header. Bug: webrtc:12057 Change-Id: I4c01ce8930d73418cb23c7fe1bb7bcd12c1e2568 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/189541 Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32435}
This commit is contained in:

committed by
Commit Bot

parent
4b18e24967
commit
3eaee6bff8
@ -13,6 +13,7 @@
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
|
||||
#include "absl/algorithm/container.h"
|
||||
#include "absl/strings/match.h"
|
||||
|
@ -12,6 +12,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <iterator>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <type_traits>
|
||||
|
||||
@ -42,8 +43,11 @@
|
||||
#include "pc/peer_connection_message_handler.h"
|
||||
#include "pc/rtp_data_channel.h"
|
||||
#include "pc/rtp_media_utils.h"
|
||||
#include "pc/rtp_sender.h"
|
||||
#include "pc/rtp_transport_internal.h"
|
||||
#include "pc/sctp_transport.h"
|
||||
#include "pc/simulcast_description.h"
|
||||
#include "pc/stats_collector.h"
|
||||
#include "pc/usage_pattern.h"
|
||||
#include "rtc_base/bind.h"
|
||||
#include "rtc_base/helpers.h"
|
||||
|
@ -11,6 +11,9 @@
|
||||
set -e
|
||||
set -x
|
||||
FILE=$1
|
||||
# If you want to exclude files that are in $FILE.h from $FILE.cc, set
|
||||
# the following variable to "yes". This is a style guide violation.
|
||||
REMOVE_CC_INCLUDES=no
|
||||
|
||||
if [ ! -f $FILE.h ]; then
|
||||
echo "$FILE.h not found"
|
||||
@ -22,11 +25,16 @@ if [ ! -f $FILE.cc ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
iwyu -Xiwyu --no_fwd_decls --no-default-mappings -D__X86_64__ -DWEBRTC_POSIX -I . -I third_party/abseil-cpp $FILE.cc |& fix_include || echo "Some files modified"
|
||||
iwyu -Xiwyu --no_fwd_decls -D__X86_64__ -DWEBRTC_POSIX -I . -I third_party/abseil-cpp $FILE.cc |& fix_include || echo "Some files modified"
|
||||
|
||||
grep ^#include $FILE.h | grep -v -f - $FILE.cc > $FILE.ccnew
|
||||
grep -v -f tools_webrtc/iwyu/iwyu-filter-list $FILE.ccnew > $FILE.cc
|
||||
rm $FILE.ccnew
|
||||
if [ $REMOVE_CC_INCLUDES == "yes" ]; then
|
||||
grep ^#include $FILE.h | grep -v -f - $FILE.cc > $FILE.ccnew
|
||||
grep -v -f tools_webrtc/iwyu/iwyu-filter-list $FILE.ccnew > $FILE.cc
|
||||
rm $FILE.ccnew
|
||||
else
|
||||
grep -v -f tools_webrtc/iwyu/iwyu-filter-list $FILE.cc > $FILE.ccnew
|
||||
mv $FILE.ccnew $FILE.cc
|
||||
fi
|
||||
grep -v -f tools_webrtc/iwyu/iwyu-filter-list $FILE.h > $FILE.hnew
|
||||
mv $FILE.hnew $FILE.h
|
||||
|
||||
|
Reference in New Issue
Block a user