[GWP-ASan] Cleanup (NFC)
Cleaning up some of the GWP-ASan code base:
- lots of headers didn't have the correct file name
- adding `#ifdef` guard to `utilities.h`
- correcting an `#ifdef` guard based on actual file name
- removing an extra `;`
- clang-format'ing the code (`-style=llvm`)
Differential Revision: https://reviews.llvm.org/D89721
GitOrigin-RevId: ae9d0400283229032fb3795b7b50920bf9be38dc
diff --git a/crash_handler.cpp b/crash_handler.cpp
index 3c64025..b9baace 100644
--- a/crash_handler.cpp
+++ b/crash_handler.cpp
@@ -1,4 +1,4 @@
-//===-- crash_handler_interface.cpp -----------------------------*- C++ -*-===//
+//===-- crash_handler.cpp ---------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/crash_handler.h b/crash_handler.h
index 631c319..4a95069 100644
--- a/crash_handler.h
+++ b/crash_handler.h
@@ -1,4 +1,4 @@
-//===-- crash_handler_interface.h -------------------------------*- C++ -*-===//
+//===-- crash_handler.h -----------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/definitions.h b/definitions.h
index 563c408..bec0290 100644
--- a/definitions.h
+++ b/definitions.h
@@ -1,4 +1,4 @@
-//===-- gwp_asan_definitions.h ----------------------------------*- C++ -*-===//
+//===-- definitions.h -------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/guarded_pool_allocator.h b/guarded_pool_allocator.h
index ae00506..12049e1 100644
--- a/guarded_pool_allocator.h
+++ b/guarded_pool_allocator.h
@@ -37,7 +37,7 @@
// GWP-ASan. The constructor value-initialises the class such that if no
// further initialisation takes place, calls to shouldSample() and
// pointerIsMine() will return false.
- constexpr GuardedPoolAllocator(){};
+ constexpr GuardedPoolAllocator() {}
GuardedPoolAllocator(const GuardedPoolAllocator &) = delete;
GuardedPoolAllocator &operator=(const GuardedPoolAllocator &) = delete;
diff --git a/optional/segv_handler.h b/optional/segv_handler.h
index 0fed4f2..e1d96a6 100644
--- a/optional/segv_handler.h
+++ b/optional/segv_handler.h
@@ -1,4 +1,4 @@
-//===-- crash_handler.h -----------------------------------------*- C++ -*-===//
+//===-- segv_handler.h ------------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
@@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef GWP_ASAN_OPTIONAL_CRASH_HANDLER_H_
-#define GWP_ASAN_OPTIONAL_CRASH_HANDLER_H_
+#ifndef GWP_ASAN_OPTIONAL_SEGV_HANDLER_H_
+#define GWP_ASAN_OPTIONAL_SEGV_HANDLER_H_
#include "gwp_asan/guarded_pool_allocator.h"
#include "gwp_asan/options.h"
@@ -87,4 +87,4 @@
} // namespace crash_handler
} // namespace gwp_asan
-#endif // GWP_ASAN_OPTIONAL_CRASH_HANDLER_H_
+#endif // GWP_ASAN_OPTIONAL_SEGV_HANDLER_H_
diff --git a/optional/segv_handler_posix.cpp b/optional/segv_handler_posix.cpp
index 9a80436..8d9f39a 100644
--- a/optional/segv_handler_posix.cpp
+++ b/optional/segv_handler_posix.cpp
@@ -1,4 +1,4 @@
-//===-- crash_handler_posix.cpp ---------------------------------*- C++ -*-===//
+//===-- segv_handler_posix.cpp ----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/platform_specific/common_posix.cpp b/platform_specific/common_posix.cpp
index e44e629..813882a 100644
--- a/platform_specific/common_posix.cpp
+++ b/platform_specific/common_posix.cpp
@@ -1,4 +1,4 @@
-//===-- common_posix.cpp ---------------------------------*- C++ -*-===//
+//===-- common_posix.cpp ----------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
diff --git a/platform_specific/utilities_posix.cpp b/platform_specific/utilities_posix.cpp
index 0e60598..98f74e0 100644
--- a/platform_specific/utilities_posix.cpp
+++ b/platform_specific/utilities_posix.cpp
@@ -28,7 +28,7 @@
android_set_abort_message(Message);
abort();
}
-#else // __BIONIC__
+#else // __BIONIC__
void Check(bool Condition, const char *Message) {
if (Condition)
return;
@@ -63,7 +63,7 @@
#ifdef __BIONIC__
static constexpr AlignmentStrategy PlatformDefaultAlignment =
AlignmentStrategy::BIONIC;
-#else // __BIONIC__
+#else // __BIONIC__
static constexpr AlignmentStrategy PlatformDefaultAlignment =
AlignmentStrategy::POWER_OF_TWO;
#endif // __BIONIC__
diff --git a/random.cpp b/random.cpp
index 2180f92..927709a 100644
--- a/random.cpp
+++ b/random.cpp
@@ -18,9 +18,7 @@
GWP_ASAN_TLS_INITIAL_EXEC uint32_t RandomState = 0xff82eb50;
namespace gwp_asan {
-void initPRNG() {
- RandomState = time(nullptr) + getThreadID();
-}
+void initPRNG() { RandomState = time(nullptr) + getThreadID(); }
uint32_t getRandomUnsigned32() {
RandomState ^= RandomState << 13;
diff --git a/utilities.h b/utilities.h
index 71d525f..8aeefe1 100644
--- a/utilities.h
+++ b/utilities.h
@@ -6,6 +6,9 @@
//
//===----------------------------------------------------------------------===//
+#ifndef GWP_ASAN_UTILITIES_H_
+#define GWP_ASAN_UTILITIES_H_
+
#include "gwp_asan/definitions.h"
#include <stddef.h>
@@ -29,3 +32,5 @@
size_t RealAllocationSize,
AlignmentStrategy Align = AlignmentStrategy::DEFAULT);
} // namespace gwp_asan
+
+#endif // GWP_ASAN_UTILITIES_H_