summaryrefslogtreecommitdiff
path: root/lib/tsan/rtl/tsan_rtl.h
diff options
context:
space:
mode:
authorKuba Mracek <mracek@apple.com>2017-05-03 16:51:01 +0000
committerKuba Mracek <mracek@apple.com>2017-05-03 16:51:01 +0000
commit4e8f70074eb0b1b8612f770d269791afaac38f74 (patch)
tree145f99b95c637f2424f8340a2352ce2d92a251e1 /lib/tsan/rtl/tsan_rtl.h
parentf5be24d91f5c9975ce71c5343b7c5731ce560d42 (diff)
downloadcompiler-rt-4e8f70074eb0b1b8612f770d269791afaac38f74.tar.gz
[tsan] Detect races on modifying accesses in Swift code
This patch allows the Swift compiler to emit calls to `__tsan_external_write` before starting any modifying access, which will cause TSan to detect races on arrays, dictionaries and other classes defined in non-instrumented modules. Races on collections from the Swift standard library and user-defined structs and a frequent cause of subtle bugs and it's important that TSan detects those on top of existing LLVM IR instrumentation, which already detects races in direct memory accesses. Differential Revision: https://reviews.llvm.org/D31630 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@302050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/tsan/rtl/tsan_rtl.h')
-rw-r--r--lib/tsan/rtl/tsan_rtl.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/tsan/rtl/tsan_rtl.h b/lib/tsan/rtl/tsan_rtl.h
index 8bf1c191a..e92a0f357 100644
--- a/lib/tsan/rtl/tsan_rtl.h
+++ b/lib/tsan/rtl/tsan_rtl.h
@@ -564,19 +564,13 @@ struct ScopedIgnoreInterceptors {
}
};
-enum ExternalTag : uptr {
- kExternalTagNone = 0,
- kExternalTagFirstUserAvailable = 1,
- kExternalTagMax = 1024,
- // Don't set kExternalTagMax over 65,536, since MBlock only stores tags
- // as 16-bit values, see tsan_defs.h.
-};
const char *GetObjectTypeFromTag(uptr tag);
+const char *GetReportHeaderFromTag(uptr tag);
uptr TagFromShadowStackFrame(uptr pc);
class ScopedReport {
public:
- explicit ScopedReport(ReportType typ);
+ explicit ScopedReport(ReportType typ, uptr tag = kExternalTagNone);
~ScopedReport();
void AddMemoryAccess(uptr addr, uptr external_tag, Shadow s, StackTrace stack,