From 4b40441ceec38e1e2d17dbfbf58aff5d69b192ed Mon Sep 17 00:00:00 2001 From: Jesse Beder Date: Sat, 22 Mar 2014 23:14:48 -0500 Subject: [PATCH] Run IWYU --- include/yaml-cpp/node/convert.h | 17 +++++++++++++---- include/yaml-cpp/node/detail/memory.h | 12 ++++++++++-- include/yaml-cpp/node/detail/node_data.h | 17 +++++++++++++---- include/yaml-cpp/node/node.h | 15 ++++++++++++--- src/convert.cpp | 4 ++-- src/memory.cpp | 4 +++- src/node_data.cpp | 15 +++++++++++---- src/nodebuilder.cpp | 13 +++++++++---- src/nodebuilder.h | 11 ++++++++++- src/nodeevents.cpp | 6 ++++-- src/nodeevents.h | 11 +++++++++-- src/parse.cpp | 7 ++++--- test/emittertests.cpp | 1 - test/new-api/nodetests.cpp | 11 ++++++++--- test/new-api/spectests.cpp | 7 ++++--- test/spectests.cpp | 4 ---- util/parse.cpp | 5 +++-- 17 files changed, 115 insertions(+), 45 deletions(-) diff --git a/include/yaml-cpp/node/convert.h b/include/yaml-cpp/node/convert.h index 76ceee5..2c7a40a 100644 --- a/include/yaml-cpp/node/convert.h +++ b/include/yaml-cpp/node/convert.h @@ -7,16 +7,25 @@ #pragma once #endif -#include "yaml-cpp/binary.h" -#include "yaml-cpp/node/node.h" -#include "yaml-cpp/node/iterator.h" -#include "yaml-cpp/null.h" #include #include #include #include #include +#include "yaml-cpp/binary.h" +#include "yaml-cpp/node/impl.h" +#include "yaml-cpp/node/iterator.h" +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/type.h" +#include "yaml-cpp/null.h" + +namespace YAML { +class Binary; +struct _Null; +template struct convert; +} // namespace YAML + namespace YAML { namespace conversion { inline bool IsInfinity(const std::string& input) { diff --git a/include/yaml-cpp/node/detail/memory.h b/include/yaml-cpp/node/detail/memory.h index 4584add..b5f257f 100644 --- a/include/yaml-cpp/node/detail/memory.h +++ b/include/yaml-cpp/node/detail/memory.h @@ -7,9 +7,17 @@ #pragma once #endif -#include "yaml-cpp/node/ptr.h" -#include #include +#include +#include + +#include "yaml-cpp/node/ptr.h" + +namespace YAML { +namespace detail { +class node; +} // namespace detail +} // namespace YAML namespace YAML { namespace detail { diff --git a/include/yaml-cpp/node/detail/node_data.h b/include/yaml-cpp/node/detail/node_data.h index 2892610..f82e332 100644 --- a/include/yaml-cpp/node/detail/node_data.h +++ b/include/yaml-cpp/node/detail/node_data.h @@ -7,10 +7,7 @@ #pragma once #endif -#include "yaml-cpp/dll.h" -#include "yaml-cpp/node/iterator.h" -#include "yaml-cpp/node/ptr.h" -#include "yaml-cpp/node/type.h" +#include #include #include #include @@ -18,6 +15,18 @@ #include #include +#include "yaml-cpp/dll.h" +#include "yaml-cpp/node/detail/node_iterator.h" +#include "yaml-cpp/node/iterator.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/type.h" + +namespace YAML { +namespace detail { +class node; +} // namespace detail +} // namespace YAML + namespace YAML { namespace detail { class node_data : private boost::noncopyable { diff --git a/include/yaml-cpp/node/node.h b/include/yaml-cpp/node/node.h index 75df149..394750f 100644 --- a/include/yaml-cpp/node/node.h +++ b/include/yaml-cpp/node/node.h @@ -7,12 +7,21 @@ #pragma once #endif +#include + #include "yaml-cpp/dll.h" +#include "yaml-cpp/node/detail/bool_type.h" +#include "yaml-cpp/node/detail/iterator_fwd.h" #include "yaml-cpp/node/ptr.h" #include "yaml-cpp/node/type.h" -#include "yaml-cpp/node/detail/iterator_fwd.h" -#include "yaml-cpp/node/detail/bool_type.h" -#include + +namespace YAML { +namespace detail { +class node; +class node_data; +struct iterator_value; +} // namespace detail +} // namespace YAML namespace YAML { class Node { diff --git a/src/convert.cpp b/src/convert.cpp index 50b15bc..349e2f7 100644 --- a/src/convert.cpp +++ b/src/convert.cpp @@ -1,7 +1,7 @@ -#include "yaml-cpp/node/convert.h" -#include "yaml-cpp/node/impl.h" #include +#include "yaml-cpp/node/convert.h" + namespace { // we're not gonna mess with the mess that is all the isupper/etc. functions bool IsLower(char ch) { return 'a' <= ch && ch <= 'z'; } diff --git a/src/memory.cpp b/src/memory.cpp index 1a02bf0..e5f8a9d 100644 --- a/src/memory.cpp +++ b/src/memory.cpp @@ -1,8 +1,10 @@ #include "yaml-cpp/node/detail/memory.h" -#include "yaml-cpp/node/detail/node.h" +#include "yaml-cpp/node/detail/node.h" // IWYU pragma: keep +#include "yaml-cpp/node/ptr.h" namespace YAML { namespace detail { + void memory_holder::merge(memory_holder& rhs) { if (m_pMemory == rhs.m_pMemory) return; diff --git a/src/node_data.cpp b/src/node_data.cpp index db80be9..90be9b9 100644 --- a/src/node_data.cpp +++ b/src/node_data.cpp @@ -1,11 +1,18 @@ -#include "yaml-cpp/node/detail/node_data.h" -#include "yaml-cpp/node/detail/memory.h" -#include "yaml-cpp/node/detail/node.h" -#include "yaml-cpp/exceptions.h" +#include +#include #include +#include "yaml-cpp/exceptions.h" +#include "yaml-cpp/node/detail/memory.h" +#include "yaml-cpp/node/detail/node.h" // IWYU pragma: keep +#include "yaml-cpp/node/detail/node_data.h" +#include "yaml-cpp/node/detail/node_iterator.h" +#include "yaml-cpp/node/ptr.h" +#include "yaml-cpp/node/type.h" + namespace YAML { namespace detail { + std::string node_data::empty_scalar; node_data::node_data() diff --git a/src/nodebuilder.cpp b/src/nodebuilder.cpp index 3ef2f7d..c69effa 100644 --- a/src/nodebuilder.cpp +++ b/src/nodebuilder.cpp @@ -1,10 +1,15 @@ -#include "nodebuilder.h" -#include "yaml-cpp/mark.h" -#include "yaml-cpp/node/node.h" -#include "yaml-cpp/node/impl.h" +#include #include +#include "nodebuilder.h" +#include "yaml-cpp/node/detail/node.h" +#include "yaml-cpp/node/impl.h" +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/type.h" + namespace YAML { +struct Mark; + NodeBuilder::NodeBuilder() : m_pMemory(new detail::memory_holder), m_pRoot(0), m_mapDepth(0) { m_anchors.push_back(0); // since the anchors start at 1 diff --git a/src/nodebuilder.h b/src/nodebuilder.h index 3600561..5006023 100644 --- a/src/nodebuilder.h +++ b/src/nodebuilder.h @@ -7,9 +7,18 @@ #pragma once #endif +#include + +#include "yaml-cpp/anchor.h" #include "yaml-cpp/eventhandler.h" #include "yaml-cpp/node/ptr.h" -#include + +namespace YAML { +namespace detail { +class node; +} // namespace detail +struct Mark; +} // namespace YAML namespace YAML { class Node; diff --git a/src/nodeevents.cpp b/src/nodeevents.cpp index 1f07482..38fa4d7 100644 --- a/src/nodeevents.cpp +++ b/src/nodeevents.cpp @@ -1,8 +1,10 @@ #include "nodeevents.h" -#include "yaml-cpp/node/node.h" -#include "yaml-cpp/node/impl.h" #include "yaml-cpp/eventhandler.h" #include "yaml-cpp/mark.h" +#include "yaml-cpp/node/detail/node.h" +#include "yaml-cpp/node/detail/node_iterator.h" +#include "yaml-cpp/node/node.h" +#include "yaml-cpp/node/type.h" namespace YAML { void NodeEvents::AliasManager::RegisterReference(const detail::node& node) { diff --git a/src/nodeevents.h b/src/nodeevents.h index 98b26ba..49c18eb 100644 --- a/src/nodeevents.h +++ b/src/nodeevents.h @@ -7,11 +7,18 @@ #pragma once #endif -#include "yaml-cpp/anchor.h" -#include "yaml-cpp/node/ptr.h" #include #include +#include "yaml-cpp/anchor.h" +#include "yaml-cpp/node/ptr.h" + +namespace YAML { +namespace detail { +class node; +} // namespace detail +} // namespace YAML + namespace YAML { class EventHandler; class Node; diff --git a/src/parse.cpp b/src/parse.cpp index 06292ae..1ef474d 100644 --- a/src/parse.cpp +++ b/src/parse.cpp @@ -1,12 +1,13 @@ #include "yaml-cpp/node/parse.h" + +#include +#include + #include "yaml-cpp/node/node.h" #include "yaml-cpp/node/impl.h" #include "yaml-cpp/parser.h" #include "nodebuilder.h" -#include -#include - namespace YAML { Node Load(const std::string& input) { std::stringstream stream(input); diff --git a/test/emittertests.cpp b/test/emittertests.cpp index 1cade03..8ba4937 100644 --- a/test/emittertests.cpp +++ b/test/emittertests.cpp @@ -1,7 +1,6 @@ #include #include "teststruct.h" -#include "yaml-cpp/eventhandler.h" #include "yaml-cpp/yaml.h" // IWYU pragma: keep namespace Test { diff --git a/test/new-api/nodetests.cpp b/test/new-api/nodetests.cpp index 8d77c6f..7c47674 100644 --- a/test/new-api/nodetests.cpp +++ b/test/new-api/nodetests.cpp @@ -1,8 +1,13 @@ -#include "nodetests.h" -#include "yaml-cpp/yaml.h" +#include #include -#include +#include "nodetests.h" +#include "yaml-cpp/yaml.h" // IWYU pragma: keep + +namespace YAML { +class InvalidNode; +template class TypedBadConversion; +} // namespace YAML #if BOOST_VERSION >= 103400 #include diff --git a/test/new-api/spectests.cpp b/test/new-api/spectests.cpp index 52b4e7e..eda2867 100644 --- a/test/new-api/spectests.cpp +++ b/test/new-api/spectests.cpp @@ -1,8 +1,9 @@ -#include "spectests.h" -#include "specexamples.h" -#include "yaml-cpp/yaml.h" #include +#include "specexamples.h" +#include "spectests.h" +#include "yaml-cpp/yaml.h" // IWYU pragma: keep + #define YAML_ASSERT(cond) \ do { \ if (!(cond)) \ diff --git a/test/spectests.cpp b/test/spectests.cpp index 156501f..907e161 100644 --- a/test/spectests.cpp +++ b/test/spectests.cpp @@ -3,10 +3,6 @@ #include "spectests.h" #include "yaml-cpp/yaml.h" // IWYU pragma: keep -namespace YAML { -class Exception; -} // namespace YAML - namespace Test { namespace { void RunSpecTest(TEST (*test)(), const std::string& index, diff --git a/util/parse.cpp b/util/parse.cpp index 7794177..6596db8 100644 --- a/util/parse.cpp +++ b/util/parse.cpp @@ -1,9 +1,10 @@ -#include "yaml-cpp/yaml.h" -#include "yaml-cpp/eventhandler.h" #include #include #include +#include "yaml-cpp/eventhandler.h" +#include "yaml-cpp/yaml.h" // IWYU pragma: keep + struct Params { bool hasFile; std::string fileName;