[compiler-rt] 71e8f79 - [ubsan] Make TypeCheckKinds const. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 11:02:26 PDT 2022


Author: Fangrui Song
Date: 2022-08-03T11:02:22-07:00
New Revision: 71e8f796013cbe52658041473e3a6b233c56bce5

URL: https://github.com/llvm/llvm-project/commit/71e8f796013cbe52658041473e3a6b233c56bce5
DIFF: https://github.com/llvm/llvm-project/commit/71e8f796013cbe52658041473e3a6b233c56bce5.diff

LOG: [ubsan] Make TypeCheckKinds const. NFC

Move it from .data to .data.rel.ro

Added: 
    

Modified: 
    compiler-rt/lib/ubsan/ubsan_handlers.cpp
    compiler-rt/lib/ubsan/ubsan_handlers_cxx.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/ubsan/ubsan_handlers.cpp b/compiler-rt/lib/ubsan/ubsan_handlers.cpp
index e201e6bba2207..410292a0d5387 100644
--- a/compiler-rt/lib/ubsan/ubsan_handlers.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_handlers.cpp
@@ -76,7 +76,7 @@ enum TypeCheckKind {
   TCK_DynamicOperation
 };
 
-const char *TypeCheckKinds[] = {
+extern const char *const TypeCheckKinds[] = {
     "load of", "store to", "reference binding to", "member access within",
     "member call on", "constructor call on", "downcast of", "downcast of",
     "upcast of", "cast to virtual base of", "_Nonnull binding to",

diff  --git a/compiler-rt/lib/ubsan/ubsan_handlers_cxx.cpp b/compiler-rt/lib/ubsan/ubsan_handlers_cxx.cpp
index 2a6d558de0342..0317a3d1428c8 100644
--- a/compiler-rt/lib/ubsan/ubsan_handlers_cxx.cpp
+++ b/compiler-rt/lib/ubsan/ubsan_handlers_cxx.cpp
@@ -26,7 +26,7 @@ using namespace __sanitizer;
 using namespace __ubsan;
 
 namespace __ubsan {
-  extern const char *TypeCheckKinds[];
+  extern const char *const TypeCheckKinds[];
 }
 
 // Returns true if UBSan has printed an error report.


        


More information about the llvm-commits mailing list