tsan: move AccessType to tsan_defs.h
authorDmitry Vyukov <dvyukov@google.com>
Wed, 4 Aug 2021 15:00:24 +0000 (17:00 +0200)
committerDmitry Vyukov <dvyukov@google.com>
Wed, 4 Aug 2021 16:03:56 +0000 (18:03 +0200)
It will be needed in more functions like ReportRace
(the plan is to pass it through MemoryAccess to ReportRace)
and this move will allow to split the huge tsan_rtl.h into parts
(e.g. move FastState/Shadow definitions to a separate header).

Depends on D107465.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D107466

compiler-rt/lib/tsan/rtl/tsan_defs.h
compiler-rt/lib/tsan/rtl/tsan_rtl.h

index 6212c82..66fb16f 100644 (file)
@@ -180,6 +180,17 @@ struct ReportStack;
 class ReportDesc;
 class RegionAlloc;
 
+typedef uptr AccessType;
+
+enum : AccessType {
+  kAccessWrite = 0,
+  kAccessRead = 1 << 0,
+  kAccessAtomic = 1 << 1,
+  kAccessVptr = 1 << 2,  // read or write of an object virtual table pointer
+  kAccessFree = 1 << 3,  // synthetic memory access during memory freeing
+  kAccessExternalPC = 1 << 4,  // access PC can have kExternalPCBit set
+};
+
 // Descriptor of user's memory block.
 struct MBlock {
   u64  siz : 48;
index 89758e2..62f7ea3 100644 (file)
@@ -692,17 +692,6 @@ int Finalize(ThreadState *thr);
 void OnUserAlloc(ThreadState *thr, uptr pc, uptr p, uptr sz, bool write);
 void OnUserFree(ThreadState *thr, uptr pc, uptr p, bool write);
 
-typedef uptr AccessType;
-
-enum : AccessType {
-  kAccessWrite = 0,
-  kAccessRead = 1 << 0,
-  kAccessAtomic = 1 << 1,
-  kAccessVptr = 1 << 2,  // read or write of an object virtual table pointer
-  kAccessFree = 1 << 3,  // synthetic memory access during memory freeing
-  kAccessExternalPC = 1 << 4,  // access PC can have kExternalPCBit set
-};
-
 void MemoryAccess(ThreadState *thr, uptr pc, uptr addr,
     int kAccessSizeLog, bool kAccessIsWrite, bool kIsAtomic);
 void MemoryAccessImpl(ThreadState *thr, uptr addr,