Commit 5181aa6e authored by Michael Lippautz's avatar Michael Lippautz Committed by V8 LUCI CQ

cppgc: IWYU cleanups

Used include-what-you-use [1] to clean up cppgc API headers. The tool
does somewhat work but requires some cleanup afterwards as it cannot
nicely deal with `v8config.h` and the defines it generates.

[1] https://github.com/include-what-you-use/include-what-you-use/

Bug: chromium:1056170
Change-Id: I7b03797c615f8e033510fc959bbdb792d8b7a4ee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2907612Reviewed-by: 's avatarOmer Katz <omerkatz@chromium.org>
Reviewed-by: 's avatarAnton Bikineev <bikineev@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74693}
parent 350be8d4
...@@ -5,25 +5,20 @@ ...@@ -5,25 +5,20 @@
#ifndef INCLUDE_CPPGC_ALLOCATION_H_ #ifndef INCLUDE_CPPGC_ALLOCATION_H_
#define INCLUDE_CPPGC_ALLOCATION_H_ #define INCLUDE_CPPGC_ALLOCATION_H_
#include <stdint.h>
#include <atomic> #include <atomic>
#include <cstddef>
#include <cstdint>
#include <new>
#include <type_traits> #include <type_traits>
#include "cppgc/custom-space.h" #include "cppgc/custom-space.h"
#include "cppgc/garbage-collected.h"
#include "cppgc/internal/api-constants.h" #include "cppgc/internal/api-constants.h"
#include "cppgc/internal/gc-info.h" #include "cppgc/internal/gc-info.h"
#include "cppgc/type-traits.h"
#include "v8config.h" // NOLINT(build/include_directory)
namespace cppgc { namespace cppgc {
template <typename T>
class MakeGarbageCollectedTraitBase;
namespace internal {
class ObjectAllocator;
} // namespace internal
/** /**
* AllocationHandle is used to allocate garbage-collected objects. * AllocationHandle is used to allocate garbage-collected objects.
*/ */
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
#ifndef INCLUDE_CPPGC_HEAP_STATISTICS_H_ #ifndef INCLUDE_CPPGC_HEAP_STATISTICS_H_
#define INCLUDE_CPPGC_HEAP_STATISTICS_H_ #define INCLUDE_CPPGC_HEAP_STATISTICS_H_
#include <memory> #include <cstddef>
#include <cstdint>
#include <string> #include <string>
#include <vector> #include <vector>
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef INCLUDE_CPPGC_HEAP_H_ #ifndef INCLUDE_CPPGC_HEAP_H_
#define INCLUDE_CPPGC_HEAP_H_ #define INCLUDE_CPPGC_HEAP_H_
#include <cstddef>
#include <cstdint>
#include <memory> #include <memory>
#include <vector> #include <vector>
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#ifndef INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ #ifndef INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_
#define INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_ #define INCLUDE_CPPGC_INTERNAL_API_CONSTANTS_H_
#include <stddef.h> #include <cstddef>
#include <stdint.h> #include <cstdint>
#include "v8config.h" // NOLINT(build/include_directory) #include "v8config.h" // NOLINT(build/include_directory)
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <atomic> #include <atomic>
#include <cstdint> #include <cstdint>
#include <type_traits>
#include "cppgc/internal/finalizer-trait.h" #include "cppgc/internal/finalizer-trait.h"
#include "cppgc/internal/name-trait.h" #include "cppgc/internal/name-trait.h"
......
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#ifndef INCLUDE_CPPGC_INTERNAL_WRITE_BARRIER_H_ #ifndef INCLUDE_CPPGC_INTERNAL_WRITE_BARRIER_H_
#define INCLUDE_CPPGC_INTERNAL_WRITE_BARRIER_H_ #define INCLUDE_CPPGC_INTERNAL_WRITE_BARRIER_H_
#include <cstddef>
#include <cstdint>
#include "cppgc/heap-state.h" #include "cppgc/heap-state.h"
#include "cppgc/internal/api-constants.h" #include "cppgc/internal/api-constants.h"
#include "cppgc/internal/atomic-entry-flag.h" #include "cppgc/internal/atomic-entry-flag.h"
...@@ -22,8 +25,11 @@ class HeapHandle; ...@@ -22,8 +25,11 @@ class HeapHandle;
namespace internal { namespace internal {
#if defined(CPPGC_CAGED_HEAP)
class WriteBarrierTypeForCagedHeapPolicy; class WriteBarrierTypeForCagedHeapPolicy;
#else // !CPPGC_CAGED_HEAP
class WriteBarrierTypeForNonCagedHeapPolicy; class WriteBarrierTypeForNonCagedHeapPolicy;
#endif // !CPPGC_CAGED_HEAP
class V8_EXPORT WriteBarrier final { class V8_EXPORT WriteBarrier final {
public: public:
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
#ifndef INCLUDE_CPPGC_MACROS_H_ #ifndef INCLUDE_CPPGC_MACROS_H_
#define INCLUDE_CPPGC_MACROS_H_ #define INCLUDE_CPPGC_MACROS_H_
#include <stddef.h> #include <cstddef>
#include "cppgc/internal/compiler-specific.h" #include "cppgc/internal/compiler-specific.h"
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#ifndef INCLUDE_CPPGC_PLATFORM_H_ #ifndef INCLUDE_CPPGC_PLATFORM_H_
#define INCLUDE_CPPGC_PLATFORM_H_ #define INCLUDE_CPPGC_PLATFORM_H_
#include <memory>
#include "v8-platform.h" // NOLINT(build/include_directory) #include "v8-platform.h" // NOLINT(build/include_directory)
#include "v8config.h" // NOLINT(build/include_directory) #include "v8config.h" // NOLINT(build/include_directory)
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef INCLUDE_CPPGC_SOURCE_LOCATION_H_ #ifndef INCLUDE_CPPGC_SOURCE_LOCATION_H_
#define INCLUDE_CPPGC_SOURCE_LOCATION_H_ #define INCLUDE_CPPGC_SOURCE_LOCATION_H_
#include <cstddef>
#include <string> #include <string>
#include "v8config.h" // NOLINT(build/include_directory) #include "v8config.h" // NOLINT(build/include_directory)
......
...@@ -4,8 +4,9 @@ ...@@ -4,8 +4,9 @@
#include "include/cppgc/allocation.h" #include "include/cppgc/allocation.h"
#include "src/base/logging.h" #include "include/cppgc/internal/api-constants.h"
#include "src/base/macros.h" #include "src/base/macros.h"
#include "src/heap/cppgc/globals.h"
#include "src/heap/cppgc/object-allocator.h" #include "src/heap/cppgc/object-allocator.h"
namespace cppgc { namespace cppgc {
......
...@@ -18,6 +18,10 @@ ...@@ -18,6 +18,10 @@
namespace cppgc { namespace cppgc {
namespace internal {
class ObjectAllocator;
} // namespace internal
class V8_EXPORT AllocationHandle { class V8_EXPORT AllocationHandle {
private: private:
AllocationHandle() = default; AllocationHandle() = default;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment