[compiler-rt] [NFC][TSan] Use in-class member initializers for ReportDesc and ReportMop (PR #228780)
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 3 15:34:53 PDT 2026
https://github.com/vitalybuka created https://github.com/llvm/llvm-project/pull/228780
Replace out-of-line default constructors for ReportDesc and ReportMop in
tsan_report.cpp with in-class member initializers in tsan_report.h.
Assisted-by: Gemini
>From aa951dc11a041956ed4c7afef3fbea156ae2590a Mon Sep 17 00:00:00 2001
From: Vitaly Buka <vitalybuka at google.com>
Date: Sat, 3 Oct 2026 15:34:40 -0700
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
=?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Created using spr 1.3.7
---
compiler-rt/lib/tsan/rtl/tsan_report.cpp | 16 ----------------
compiler-rt/lib/tsan/rtl/tsan_report.h | 10 ++++------
2 files changed, 4 insertions(+), 22 deletions(-)
diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_report.cpp
index 17fd3064fb85a14..82ca89705f8d1b8 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_report.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_report.cpp
@@ -29,22 +29,6 @@ class Decorator: public __sanitizer::SanitizerCommonDecorator {
const char *Mutex() { return Magenta(); }
};
-ReportDesc::ReportDesc()
- : tag(kExternalTagNone)
- , stacks()
- , mops()
- , locs()
- , mutexes()
- , threads()
- , unique_tids()
- , sleep()
- , count() {
-}
-
-ReportMop::ReportMop()
- : mset() {
-}
-
ReportDesc::~ReportDesc() {
// FIXME(dvyukov): it must be leaking a lot of memory.
}
diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.h b/compiler-rt/lib/tsan/rtl/tsan_report.h
index 53bb21964dbba96..e444f4204d36c76 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_report.h
+++ b/compiler-rt/lib/tsan/rtl/tsan_report.h
@@ -60,8 +60,6 @@ struct ReportMop {
Vector<ReportMopMutex> mset;
StackTrace stack_trace;
ReportStack *stack;
-
- ReportMop();
};
enum ReportLocationType {
@@ -113,7 +111,7 @@ struct AddedLocationAddr {
class ReportDesc {
public:
ReportType typ;
- uptr tag;
+ uptr tag = kExternalTagNone;
Vector<ReportStack*> stacks;
Vector<ReportMop*> mops;
Vector<ReportLocation*> locs;
@@ -121,11 +119,11 @@ class ReportDesc {
Vector<ReportMutex*> mutexes;
Vector<ReportThread*> threads;
Vector<Tid> unique_tids;
- ReportStack *sleep;
- int count;
+ ReportStack* sleep = nullptr;
+ int count = 0;
int signum = 0;
- ReportDesc();
+ ReportDesc() = default;
~ReportDesc();
private:
More information about the llvm-commits
mailing list