[compiler-rt] 93a31cd - [nsan] Make #include more conventional

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 9 16:47:10 PDT 2024


Author: Fangrui Song
Date: 2024-08-09T16:47:05-07:00
New Revision: 93a31cdf7a9ff6cbbdba018a55acd9612ba43dab

URL: https://github.com/llvm/llvm-project/commit/93a31cdf7a9ff6cbbdba018a55acd9612ba43dab
DIFF: https://github.com/llvm/llvm-project/commit/93a31cdf7a9ff6cbbdba018a55acd9612ba43dab.diff

LOG: [nsan] Make #include more conventional

Added: 
    

Modified: 
    compiler-rt/lib/nsan/nsan.cpp
    compiler-rt/lib/nsan/nsan.h
    compiler-rt/lib/nsan/nsan_interceptors.cpp
    compiler-rt/lib/nsan/nsan_malloc_linux.cpp
    compiler-rt/lib/nsan/nsan_preinit.cpp
    compiler-rt/lib/nsan/nsan_stats.cpp
    compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/nsan/nsan.cpp b/compiler-rt/lib/nsan/nsan.cpp
index 197003dc5cfee9..214c237f1e5051 100644
--- a/compiler-rt/lib/nsan/nsan.cpp
+++ b/compiler-rt/lib/nsan/nsan.cpp
@@ -30,6 +30,11 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "nsan.h"
+#include "nsan_flags.h"
+#include "nsan_stats.h"
+#include "nsan_suppressions.h"
+
 #include <assert.h>
 #include <math.h>
 #include <stdint.h>
@@ -43,11 +48,6 @@
 #include "sanitizer_common/sanitizer_stacktrace.h"
 #include "sanitizer_common/sanitizer_symbolizer.h"
 
-#include "nsan/nsan.h"
-#include "nsan/nsan_flags.h"
-#include "nsan/nsan_stats.h"
-#include "nsan/nsan_suppressions.h"
-
 using namespace __sanitizer;
 using namespace __nsan;
 

diff  --git a/compiler-rt/lib/nsan/nsan.h b/compiler-rt/lib/nsan/nsan.h
index 8277e3d7780477..6432ac9475af4a 100644
--- a/compiler-rt/lib/nsan/nsan.h
+++ b/compiler-rt/lib/nsan/nsan.h
@@ -86,8 +86,8 @@ inline const u8 *GetShadowTypeAddrFor(const u8 *Ptr) {
 template <typename FT> struct FTInfo {};
 template <> struct FTInfo<float> {
   using orig_type = float;
-  using orig_bits_type = __sanitizer::u32;
-  using mantissa_bits_type = __sanitizer::u32;
+  using orig_bits_type = u32;
+  using mantissa_bits_type = u32;
   using shadow_type = double;
   static const char *kCppTypeName;
   static constexpr unsigned kMantissaBits = 23;
@@ -104,8 +104,8 @@ template <> struct FTInfo<float> {
 };
 template <> struct FTInfo<double> {
   using orig_type = double;
-  using orig_bits_type = __sanitizer::u64;
-  using mantissa_bits_type = __sanitizer::u64;
+  using orig_bits_type = u64;
+  using mantissa_bits_type = u64;
   using shadow_type = __float128;
   static const char *kCppTypeName;
   static constexpr unsigned kMantissaBits = 52;
@@ -126,7 +126,7 @@ template <> struct FTInfo<double> {
 };
 template <> struct FTInfo<long double> {
   using orig_type = long double;
-  using mantissa_bits_type = __sanitizer::u64;
+  using mantissa_bits_type = u64;
   using shadow_type = __float128;
   static const char *kCppTypeName;
   static constexpr unsigned kMantissaBits = 63;

diff  --git a/compiler-rt/lib/nsan/nsan_interceptors.cpp b/compiler-rt/lib/nsan/nsan_interceptors.cpp
index 852524bd373328..95b411bed2600f 100644
--- a/compiler-rt/lib/nsan/nsan_interceptors.cpp
+++ b/compiler-rt/lib/nsan/nsan_interceptors.cpp
@@ -16,7 +16,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "interception/interception.h"
-#include "nsan/nsan.h"
+#include "nsan.h"
 #include "sanitizer_common/sanitizer_common.h"
 
 #include <wchar.h>

diff  --git a/compiler-rt/lib/nsan/nsan_malloc_linux.cpp b/compiler-rt/lib/nsan/nsan_malloc_linux.cpp
index d66ee65b36747a..02f52e7be07fac 100644
--- a/compiler-rt/lib/nsan/nsan_malloc_linux.cpp
+++ b/compiler-rt/lib/nsan/nsan_malloc_linux.cpp
@@ -11,7 +11,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "interception/interception.h"
-#include "nsan/nsan.h"
+#include "nsan.h"
 #include "sanitizer_common/sanitizer_allocator_dlsym.h"
 #include "sanitizer_common/sanitizer_common.h"
 #include "sanitizer_common/sanitizer_platform.h"

diff  --git a/compiler-rt/lib/nsan/nsan_preinit.cpp b/compiler-rt/lib/nsan/nsan_preinit.cpp
index 5d869bbdf96680..8649ba7ce04f72 100644
--- a/compiler-rt/lib/nsan/nsan_preinit.cpp
+++ b/compiler-rt/lib/nsan/nsan_preinit.cpp
@@ -10,7 +10,7 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "nsan/nsan.h"
+#include "nsan.h"
 #include "sanitizer_common/sanitizer_internal_defs.h"
 
 #if SANITIZER_CAN_USE_PREINIT_ARRAY

diff  --git a/compiler-rt/lib/nsan/nsan_stats.cpp b/compiler-rt/lib/nsan/nsan_stats.cpp
index d188df1b1f70b6..49041a76dfb2d5 100644
--- a/compiler-rt/lib/nsan/nsan_stats.cpp
+++ b/compiler-rt/lib/nsan/nsan_stats.cpp
@@ -11,7 +11,7 @@
 // NumericalStabilitySanitizer statistics.
 //===----------------------------------------------------------------------===//
 
-#include "nsan/nsan_stats.h"
+#include "nsan_stats.h"
 
 #include "sanitizer_common/sanitizer_common.h"
 #include "sanitizer_common/sanitizer_placement_new.h"

diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index 294e330c4d5611..3af47c2e2ff7a7 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -457,6 +457,9 @@ using namespace __sanitizer;
 namespace __msan {
 using namespace __sanitizer;
 }
+namespace __nsan {
+using namespace __sanitizer;
+}
 namespace __hwasan {
 using namespace __sanitizer;
 }


        


More information about the llvm-commits mailing list