Skip to content

Commit

Permalink
Apply include what you use
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 573304660
Change-Id: I615aad26df071e1d4310ba18c499b065399f8a9c
  • Loading branch information
ckennelly authored and copybara-github committed Oct 13, 2023
1 parent 4ef8fe1 commit 2ee0510
Show file tree
Hide file tree
Showing 47 changed files with 118 additions and 90 deletions.
59 changes: 20 additions & 39 deletions tcmalloc/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,7 @@ cc_library(
visibility = [
"//tcmalloc:__subpackages__",
],
deps = [
":config",
"@com_google_absl//absl/base:core_headers",
],
deps = [":config"],
)

cc_library(
Expand All @@ -95,12 +92,7 @@ cc_library(
visibility = [
"//tcmalloc:__subpackages__",
],
deps = [
":config",
"@com_google_absl//absl/base",
"@com_google_absl//absl/functional:function_ref",
"@com_google_absl//absl/time",
],
deps = [":config"],
)

cc_library(
Expand Down Expand Up @@ -190,6 +182,7 @@ cc_library(
"//tcmalloc:__subpackages__",
],
deps = [
":config",
":logging",
"@com_google_absl//absl/base:core_headers",
],
Expand All @@ -201,6 +194,7 @@ create_tcmalloc_benchmark(
copts = TCMALLOC_DEFAULT_COPTS,
malloc = "//tcmalloc",
deps = [
":config",
":linked_list",
":logging",
":mock_span",
Expand Down Expand Up @@ -243,7 +237,6 @@ cc_library(
":allocation_guard",
":config",
":parameter_accessors",
"//tcmalloc:malloc_extension",
"@com_google_absl//absl/base",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/debugging:stacktrace",
Expand Down Expand Up @@ -326,7 +319,6 @@ cc_library(
":page_size",
":util",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
],
)

Expand Down Expand Up @@ -357,7 +349,6 @@ cc_test(
tags = [
],
deps = [
":page_size",
":pageflags",
":util",
"@com_github_google_benchmark//:benchmark",
Expand All @@ -377,11 +368,10 @@ create_tcmalloc_benchmark(
srcs = ["mincore_benchmark.cc"],
copts = TCMALLOC_DEFAULT_COPTS,
deps = [
":config",
":logging",
":mincore",
":page_size",
"@com_github_google_benchmark//:benchmark",
"@com_google_absl//absl/memory",
],
)

Expand Down Expand Up @@ -435,9 +425,7 @@ cc_library(
":logging",
":sysinfo",
":util",
"@com_google_absl//absl/base",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/functional:function_ref",
"@com_google_absl//absl/strings",
],
)
Expand Down Expand Up @@ -469,11 +457,8 @@ cc_library(
":percpu",
":sysinfo",
":util",
"@com_google_absl//absl/base",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/functional:function_ref",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:optional",
],
)

Expand Down Expand Up @@ -575,7 +560,6 @@ cc_library(
":util",
"@com_google_absl//absl/base",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/base:dynamic_annotations",
],
)

Expand Down Expand Up @@ -608,23 +592,22 @@ cc_test(
deps = [
":affinity",
":config",
":linux_syscall_support",
":logging",
":page_size",
":percpu",
":percpu_tcmalloc",
":sysinfo",
":util",
"//tcmalloc:malloc_extension",
"//tcmalloc/testing:testutil",
"@com_github_google_benchmark//:benchmark",
"@com_google_absl//absl/algorithm:container",
"@com_google_absl//absl/base",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/container:fixed_array",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/functional:function_ref",
"@com_google_absl//absl/random",
"@com_google_absl//absl/random:seed_sequences",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization",
"@com_google_absl//absl/time",
"@com_google_absl//absl/types:span",
Expand All @@ -639,10 +622,7 @@ cc_library(
visibility = [
"//tcmalloc:__subpackages__",
],
deps = [
":config",
"@com_google_absl//absl/base",
],
deps = [":config"],
)

cc_test(
Expand Down Expand Up @@ -678,11 +658,11 @@ cc_library(
":residency",
"//tcmalloc:malloc_extension",
"//tcmalloc/internal:profile_cc_proto",
"@com_google_absl//absl/base:config",
"@com_google_absl//absl/base",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/container:btree",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/numeric:bits",
"@com_google_absl//absl/hash",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
Expand Down Expand Up @@ -740,7 +720,6 @@ cc_library(
":config",
":logging",
":util",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/strings:str_format",
],
)
Expand All @@ -753,6 +732,7 @@ cc_library(
"//tcmalloc:__subpackages__",
],
deps = [
":config",
":logging",
":optimization",
"@com_google_absl//absl/numeric:bits",
Expand All @@ -765,10 +745,10 @@ create_tcmalloc_benchmark(
copts = TCMALLOC_DEFAULT_COPTS,
malloc = "//tcmalloc",
deps = [
":config",
":range_tracker",
"@com_github_google_benchmark//:benchmark",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/container:fixed_array",
"@com_google_absl//absl/random",
"@com_google_absl//absl/random:distributions",
],
Expand All @@ -793,9 +773,8 @@ cc_library(
copts = TCMALLOC_DEFAULT_COPTS,
visibility = ["//tcmalloc:__subpackages__"],
deps = [
":logging",
":sampled_allocation_recorder",
"//tcmalloc/internal:logging",
"@com_google_absl//absl/debugging:stacktrace",
],
)

Expand All @@ -804,8 +783,9 @@ cc_test(
srcs = ["sampled_allocation_test.cc"],
copts = TCMALLOC_DEFAULT_COPTS,
deps = [
":logging",
":sampled_allocation",
"//tcmalloc/internal:logging",
"@com_google_absl//absl/base",
"@com_google_absl//absl/debugging:stacktrace",
"@com_google_googletest//:gtest_main",
],
Expand All @@ -817,7 +797,7 @@ cc_library(
copts = TCMALLOC_DEFAULT_COPTS,
visibility = ["//tcmalloc:__subpackages__"],
deps = [
"//tcmalloc/internal:config",
":config",
"@com_google_absl//absl/base",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/functional:function_ref",
Expand Down Expand Up @@ -902,11 +882,12 @@ cc_test(
srcs = ["sysinfo_test.cc"],
copts = TCMALLOC_DEFAULT_COPTS,
deps = [
":logging",
":allocation_guard",
":sysinfo",
"@com_google_absl//absl/base",
"@com_google_absl//absl/random",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/types:optional",
"@com_google_googletest//:gtest_main",
],
)
Expand Down Expand Up @@ -944,7 +925,9 @@ cc_test(
srcs = ["timeseries_tracker_test.cc"],
copts = TCMALLOC_DEFAULT_COPTS,
deps = [
":clock",
":timeseries_tracker",
"@com_google_absl//absl/time",
"@com_google_googletest//:gtest_main",
],
)
Expand All @@ -959,8 +942,6 @@ cc_library(
],
deps = [
":config",
":logging",
"@com_google_absl//absl/base",
"@com_google_absl//absl/time",
],
)
6 changes: 3 additions & 3 deletions tcmalloc/internal/affinity.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
// limitations under the License.
#include "tcmalloc/internal/affinity.h"

#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>

#include <utility>
#include <vector>

#include "absl/types/span.h"
#include "tcmalloc/internal/config.h"
#include "tcmalloc/internal/logging.h"

GOOGLE_MALLOC_SECTION_BEGIN
Expand Down
2 changes: 2 additions & 0 deletions tcmalloc/internal/allocation_guard.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#ifndef TCMALLOC_INTERNAL_ALLOCATION_GUARD_H_
#define TCMALLOC_INTERNAL_ALLOCATION_GUARD_H_

#include "absl/base/attributes.h"
#include "absl/base/internal/spinlock.h"
#include "absl/base/thread_annotations.h"
#include "tcmalloc/internal/config.h"

GOOGLE_MALLOC_SECTION_BEGIN
Expand Down
2 changes: 1 addition & 1 deletion tcmalloc/internal/atomic_stats_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
#define TCMALLOC_INTERNAL_ATOMIC_STATS_COUNTER_H_

#include <atomic>
#include <cstdint>

#include "absl/base/macros.h"
#include "tcmalloc/internal/config.h"

GOOGLE_MALLOC_SECTION_BEGIN
Expand Down
3 changes: 3 additions & 0 deletions tcmalloc/internal/cache_topology.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
#include <fcntl.h>
#include <string.h>

#include <cerrno>
#include <cstdio>

#include "absl/strings/numbers.h"
#include "absl/strings/string_view.h"
#include "tcmalloc/internal/config.h"
Expand Down
3 changes: 3 additions & 0 deletions tcmalloc/internal/cache_topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
#ifndef TCMALLOC_INTERNAL_CACHE_TOPOLOGY_H_
#define TCMALLOC_INTERNAL_CACHE_TOPOLOGY_H_

#include <cstdint>

#include "absl/base/attributes.h"
#include "absl/strings/string_view.h"
#include "tcmalloc/internal/config.h"
#include "tcmalloc/internal/logging.h"

Expand Down
2 changes: 0 additions & 2 deletions tcmalloc/internal/declarations.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
#ifndef TCMALLOC_INTERNAL_DECLARATIONS_H_
#define TCMALLOC_INTERNAL_DECLARATIONS_H_

#include <cstddef>
#include <new>

#if !defined(__cpp_sized_deallocation)

Expand Down
2 changes: 2 additions & 0 deletions tcmalloc/internal/environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

#include <string.h>

#include "tcmalloc/internal/config.h"

GOOGLE_MALLOC_SECTION_BEGIN
namespace tcmalloc {
namespace tcmalloc_internal {
Expand Down
2 changes: 0 additions & 2 deletions tcmalloc/internal/fake_profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
#ifndef TCMALLOC_INTERNAL_FAKE_PROFILE_H_
#define TCMALLOC_INTERNAL_FAKE_PROFILE_H_

#include <cstdint>
#include <utility>
#include <vector>

#include "absl/functional/function_ref.h"
#include "absl/time/time.h"
#include "tcmalloc/internal_malloc_extension.h"
#include "tcmalloc/malloc_extension.h"

namespace tcmalloc {
Expand Down
1 change: 1 addition & 0 deletions tcmalloc/internal/linked_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include "absl/base/attributes.h"
#include "absl/base/optimization.h"
#include "tcmalloc/internal/config.h"
#include "tcmalloc/internal/logging.h"

GOOGLE_MALLOC_SECTION_BEGIN
Expand Down
1 change: 1 addition & 0 deletions tcmalloc/internal/linked_list_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "absl/random/random.h"
#include "benchmark/benchmark.h"
#include "tcmalloc/internal/config.h"
#include "tcmalloc/internal/linked_list.h"
#include "tcmalloc/internal/logging.h"
#include "tcmalloc/internal/mock_span.h"
Expand Down
1 change: 0 additions & 1 deletion tcmalloc/internal/linked_list_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#include <stdlib.h>

#include <algorithm>
#include <string>
#include <type_traits>
#include <vector>

Expand Down
6 changes: 4 additions & 2 deletions tcmalloc/internal/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,24 @@

#include "tcmalloc/internal/logging.h"

#include <inttypes.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#include <algorithm>
#include <cstddef>
#include <cstdint>

#include "absl/base/attributes.h"
#include "absl/base/const_init.h"
#include "absl/base/internal/spinlock.h"
#include "absl/base/macros.h"
#include "absl/debugging/stacktrace.h"
#include "absl/strings/string_view.h"
#include "tcmalloc/internal/config.h"
#include "tcmalloc/internal/parameter_accessors.h"
#include "tcmalloc/malloc_extension.h"

GOOGLE_MALLOC_SECTION_BEGIN
namespace tcmalloc {
Expand Down
Loading

0 comments on commit 2ee0510

Please sign in to comment.