[compiler-rt] [NFC][TSan] Use in-class member initializers for ReportDesc and ReportMop (PR #228780)

via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 3 15:35:39 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>

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


---
Full diff: https://github.com/llvm/llvm-project/pull/228780.diff


2 Files Affected:

- (modified) compiler-rt/lib/tsan/rtl/tsan_report.cpp (-16) 
- (modified) compiler-rt/lib/tsan/rtl/tsan_report.h (+4-6) 


``````````diff
diff --git a/compiler-rt/lib/tsan/rtl/tsan_report.cpp b/compiler-rt/lib/tsan/rtl/tsan_report.cpp
index 17fd3064fb85a..82ca89705f8d1 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 53bb21964dbba..e444f4204d36c 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:

``````````

</details>


https://github.com/llvm/llvm-project/pull/228780


More information about the llvm-commits mailing list