[compiler-rt] 612f238 - [scudo][standalone] Work with -Werror=class-memaccess
Kostya Kortchinsky via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 11 07:29:37 PDT 2020
Author: Kostya Kortchinsky
Date: 2020-04-11T07:29:12-07:00
New Revision: 612f23857f36669a12ccdc1a6e93781080907203
URL: https://github.com/llvm/llvm-project/commit/612f23857f36669a12ccdc1a6e93781080907203
DIFF: https://github.com/llvm/llvm-project/commit/612f23857f36669a12ccdc1a6e93781080907203.diff
LOG: [scudo][standalone] Work with -Werror=class-memaccess
Summary:
Fuchsia's gcc uses this, which in turn prevents us to compile successfully
due to a few `memset`'ing some non-trivial classes in some `init`.
Change those `memset` to members initialization.
Reviewers: pcc, hctim
Subscribers: #sanitizers, llvm-commits
Tags: #sanitizers
Differential Revision: https://reviews.llvm.org/D77902
Added:
Modified:
compiler-rt/lib/scudo/standalone/mutex.h
compiler-rt/lib/scudo/standalone/quarantine.h
compiler-rt/lib/scudo/standalone/stats.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/mutex.h b/compiler-rt/lib/scudo/standalone/mutex.h
index b26b2df06627..d6e6a5b33aae 100644
--- a/compiler-rt/lib/scudo/standalone/mutex.h
+++ b/compiler-rt/lib/scudo/standalone/mutex.h
@@ -22,7 +22,7 @@ namespace scudo {
class HybridMutex {
public:
- void init() { memset(this, 0, sizeof(*this)); }
+ void init() { M = {}; }
bool tryLock();
NOINLINE void lock() {
if (LIKELY(tryLock()))
diff --git a/compiler-rt/lib/scudo/standalone/quarantine.h b/compiler-rt/lib/scudo/standalone/quarantine.h
index 406a0e23804d..27aa4bfec91a 100644
--- a/compiler-rt/lib/scudo/standalone/quarantine.h
+++ b/compiler-rt/lib/scudo/standalone/quarantine.h
@@ -187,7 +187,12 @@ template <typename Callback, typename Node> class GlobalQuarantine {
Cache.initLinkerInitialized();
}
void init(uptr Size, uptr CacheSize) {
- memset(this, 0, sizeof(*this));
+ CacheMutex.init();
+ Cache.init();
+ RecycleMutex.init();
+ MinSize = {};
+ MaxSize = {};
+ MaxCacheSize = {};
initLinkerInitialized(Size, CacheSize);
}
diff --git a/compiler-rt/lib/scudo/standalone/stats.h b/compiler-rt/lib/scudo/standalone/stats.h
index 38481e98e48d..d76b904949ea 100644
--- a/compiler-rt/lib/scudo/standalone/stats.h
+++ b/compiler-rt/lib/scudo/standalone/stats.h
@@ -58,7 +58,9 @@ class GlobalStats : public LocalStats {
public:
void initLinkerInitialized() {}
void init() {
- memset(this, 0, sizeof(*this));
+ LocalStats::init();
+ Mutex.init();
+ StatsList = {};
initLinkerInitialized();
}
More information about the llvm-commits
mailing list