Add back --no_fwd_decls to iwyu run
Applies IWYU to pc/peer_connection.cc as test.
Bug: webrtc:13532
Change-Id: Iec453fdf6525c6376cb73dd1199326a8e1a21ff6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/249986
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35845}
diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc
index 3b094f9..75feb79 100644
--- a/pc/peer_connection.cc
+++ b/pc/peer_connection.cc
@@ -16,14 +16,16 @@
#include <algorithm>
#include <memory>
#include <set>
+#include <string>
+#include <type_traits>
#include <utility>
#include "absl/algorithm/container.h"
#include "absl/strings/match.h"
+#include "absl/strings/string_view.h"
#include "api/jsep_ice_candidate.h"
#include "api/rtp_parameters.h"
#include "api/rtp_transceiver_direction.h"
-#include "api/task_queue/queued_task.h"
#include "api/transport/webrtc_key_value_config.h"
#include "api/uma_metrics.h"
#include "api/video/video_codec_constants.h"
@@ -31,6 +33,7 @@
#include "call/packet_receiver.h"
#include "media/base/media_channel.h"
#include "media/base/media_config.h"
+#include "media/base/media_engine.h"
#include "media/base/rid_description.h"
#include "media/base/stream_params.h"
#include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
@@ -44,7 +47,9 @@
#include "pc/channel.h"
#include "pc/ice_server_parsing.h"
#include "pc/rtp_receiver.h"
+#include "pc/rtp_receiver_proxy.h"
#include "pc/rtp_sender.h"
+#include "pc/rtp_sender_proxy.h"
#include "pc/sctp_transport.h"
#include "pc/simulcast_description.h"
#include "pc/webrtc_session_description_factory.h"
@@ -53,6 +58,7 @@
#include "rtc_base/location.h"
#include "rtc_base/logging.h"
#include "rtc_base/net_helper.h"
+#include "rtc_base/network.h"
#include "rtc_base/network_constants.h"
#include "rtc_base/ref_counted_object.h"
#include "rtc_base/socket_address.h"
diff --git a/pc/peer_connection.h b/pc/peer_connection.h
index 3555ffb..3f3dda6 100644
--- a/pc/peer_connection.h
+++ b/pc/peer_connection.h
@@ -14,6 +14,7 @@
#include <stdint.h>
#include <functional>
+#include <iosfwd>
#include <map>
#include <memory>
#include <set>
diff --git a/tools_webrtc/iwyu/apply-iwyu b/tools_webrtc/iwyu/apply-iwyu
index c0242aa..68b71fb 100755
--- a/tools_webrtc/iwyu/apply-iwyu
+++ b/tools_webrtc/iwyu/apply-iwyu
@@ -14,8 +14,14 @@
#
# To get iwyu on Debian/glinux, do "sudo apt-get install iwyu".
+# Set this to 1 to get more debug information.
+# Set this to 2 to also get a dump of the iwyu tool output.
+DEBUG=1
+
set -e
-set -x
+if [ $DEBUG -gt 0 ]; then
+ set -x
+fi
IWYU_TOOL="${IWYU_TOOL:-/usr/bin/iwyu_tool}"
FIX_INCLUDE="${FIX_INCLUDE:-/usr/bin/fix_include}"
@@ -57,13 +63,17 @@
fi
FILE_CC=$FILE.cc
else
- # Exact file, no .h file
+ # Exact cc file, no .h file - but iwyu will modify .h anyway if it exists.
FILE_CC=$FILE
- FILE_H=""
+ if [ -f $(dirname $FILE)/$(basename -s .cc $FILE).h ]; then
+ FILE_H=$(dirname $FILE)/$(basename -s .cc $FILE).h
+ else
+ FILE_H=""
+ fi
fi
# IWYU has a confusing set of exit codes. Discard it.
-"$IWYU_TOOL" -p "$COMPILE_COMMANDS" "$FILE_CC" \
+"$IWYU_TOOL" -p "$COMPILE_COMMANDS" "$FILE_CC" -- -Xiwyu --no_fwd_decls \
>& /tmp/includefixes$$ || echo "IWYU done, code $?"
if grep 'fatal error' /tmp/includefixes$$; then
@@ -72,6 +82,9 @@
rm /tmp/includefixes$$
exit 1
else
+ if [ $DEBUG -gt 1 ]; then
+ cat /tmp/includefixes$$
+ fi
# In compile_commands.json, the file name is recorded
# as a relative path to the build directory.
pushd "$(dirname "$COMPILE_COMMANDS")" || error "pushd failed"
diff --git a/tools_webrtc/iwyu/iwyu-filter-list b/tools_webrtc/iwyu/iwyu-filter-list
index 0c0c695..2332cd3 100644
--- a/tools_webrtc/iwyu/iwyu-filter-list
+++ b/tools_webrtc/iwyu/iwyu-filter-list
@@ -4,3 +4,5 @@
#include <sys/socket.h>
#include <ext/alloc_traits.h>
#include <netinet/in.h>
+#include <__memory/unique_ptr.h>
+#include <__tree>