[compiler-rt] ae9d040 - [GWP-ASan] Cleanup (NFC)
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 19 18:13:34 PDT 2020
Author: Kostya Kortchinsky
Date: 2020-10-19T18:13:11-07:00
New Revision: ae9d0400283229032fb3795b7b50920bf9be38dc
URL: https://github.com/llvm/llvm-project/commit/ae9d0400283229032fb3795b7b50920bf9be38dc
DIFF: https://github.com/llvm/llvm-project/commit/ae9d0400283229032fb3795b7b50920bf9be38dc.diff
LOG: [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
Added:
Modified:
compiler-rt/lib/gwp_asan/crash_handler.cpp
compiler-rt/lib/gwp_asan/crash_handler.h
compiler-rt/lib/gwp_asan/definitions.h
compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
compiler-rt/lib/gwp_asan/optional/segv_handler.h
compiler-rt/lib/gwp_asan/optional/segv_handler_posix.cpp
compiler-rt/lib/gwp_asan/platform_specific/common_posix.cpp
compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp
compiler-rt/lib/gwp_asan/random.cpp
compiler-rt/lib/gwp_asan/utilities.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/gwp_asan/crash_handler.cpp b/compiler-rt/lib/gwp_asan/crash_handler.cpp
index 3c640256706f..b9baacecfecb 100644
--- a/compiler-rt/lib/gwp_asan/crash_handler.cpp
+++ b/compiler-rt/lib/gwp_asan/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/compiler-rt/lib/gwp_asan/crash_handler.h b/compiler-rt/lib/gwp_asan/crash_handler.h
index 631c31929732..4a95069dac58 100644
--- a/compiler-rt/lib/gwp_asan/crash_handler.h
+++ b/compiler-rt/lib/gwp_asan/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/compiler-rt/lib/gwp_asan/definitions.h b/compiler-rt/lib/gwp_asan/definitions.h
index 563c408b6315..bec029038934 100644
--- a/compiler-rt/lib/gwp_asan/definitions.h
+++ b/compiler-rt/lib/gwp_asan/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/compiler-rt/lib/gwp_asan/guarded_pool_allocator.h b/compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
index ae00506c5692..12049e1ab9d1 100644
--- a/compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
+++ b/compiler-rt/lib/gwp_asan/guarded_pool_allocator.h
@@ -37,7 +37,7 @@ class GuardedPoolAllocator {
// 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/compiler-rt/lib/gwp_asan/optional/segv_handler.h b/compiler-rt/lib/gwp_asan/optional/segv_handler.h
index 0fed4f2e012e..e1d96a6cd81f 100644
--- a/compiler-rt/lib/gwp_asan/optional/segv_handler.h
+++ b/compiler-rt/lib/gwp_asan/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 @@ void dumpReport(uintptr_t ErrorPtr, const gwp_asan::AllocatorState *State,
} // namespace crash_handler
} // namespace gwp_asan
-#endif // GWP_ASAN_OPTIONAL_CRASH_HANDLER_H_
+#endif // GWP_ASAN_OPTIONAL_SEGV_HANDLER_H_
diff --git a/compiler-rt/lib/gwp_asan/optional/segv_handler_posix.cpp b/compiler-rt/lib/gwp_asan/optional/segv_handler_posix.cpp
index 9a80436efb31..8d9f39a7bd00 100644
--- a/compiler-rt/lib/gwp_asan/optional/segv_handler_posix.cpp
+++ b/compiler-rt/lib/gwp_asan/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/compiler-rt/lib/gwp_asan/platform_specific/common_posix.cpp b/compiler-rt/lib/gwp_asan/platform_specific/common_posix.cpp
index e44e6299eeac..813882ad915a 100644
--- a/compiler-rt/lib/gwp_asan/platform_specific/common_posix.cpp
+++ b/compiler-rt/lib/gwp_asan/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/compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp b/compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp
index 0e6059896702..98f74e0f8b95 100644
--- a/compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp
+++ b/compiler-rt/lib/gwp_asan/platform_specific/utilities_posix.cpp
@@ -28,7 +28,7 @@ void Check(bool Condition, const char *Message) {
android_set_abort_message(Message);
abort();
}
-#else // __BIONIC__
+#else // __BIONIC__
void Check(bool Condition, const char *Message) {
if (Condition)
return;
@@ -63,7 +63,7 @@ static size_t alignPowerOfTwo(size_t RealAllocationSize) {
#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/compiler-rt/lib/gwp_asan/random.cpp b/compiler-rt/lib/gwp_asan/random.cpp
index 2180f9204084..927709abc42b 100644
--- a/compiler-rt/lib/gwp_asan/random.cpp
+++ b/compiler-rt/lib/gwp_asan/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/compiler-rt/lib/gwp_asan/utilities.h b/compiler-rt/lib/gwp_asan/utilities.h
index 71d525f9e14c..8aeefe188235 100644
--- a/compiler-rt/lib/gwp_asan/utilities.h
+++ b/compiler-rt/lib/gwp_asan/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 rightAlignedAllocationSize(
size_t RealAllocationSize,
AlignmentStrategy Align = AlignmentStrategy::DEFAULT);
} // namespace gwp_asan
+
+#endif // GWP_ASAN_UTILITIES_H_
More information about the llvm-commits
mailing list