Skip to content

Commit

Permalink
Add support for Clang's Thread Sanitizer (Tsan) (#7453)
Browse files Browse the repository at this point in the history
* Support for Tsan

* Restyled by gn

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
mrjerryjohns and restyled-commits authored Jun 8, 2021
1 parent b0e4870 commit 8a417ea
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ config("runtime_default") {
#

declare_args() {
# Enable Thread sanitizer
is_tsan = false

# Enable address sanitizer
is_asan = false

Expand All @@ -270,6 +273,12 @@ config("sanitize_address") {
ldflags = cflags
}

config("sanitize_thread") {
cflags = [ "-fsanitize=thread" ]

ldflags = cflags
}

config("sanitize_memory") {
cflags = [
"-fsanitize=memory",
Expand Down Expand Up @@ -300,6 +309,10 @@ config("sanitize_recover_all") {
config("sanitize_default") {
configs = []

if (is_tsan) {
configs += [ ":sanitize_thread" ]
}

if (is_asan) {
configs += [ ":sanitize_address" ]
}
Expand Down

0 comments on commit 8a417ea

Please sign in to comment.