swiftlang / swift-syntax

A set of Swift libraries for parsing, inspecting, generating, and transforming Swift source code.
Apache License 2.0
3.18k stars 403 forks source link

Heap allocate our atomics #2671

Closed ahoppen closed 3 months ago

ahoppen commented 3 months ago

We used C atomics but these were allocated as Swift variables. Even thought they were atomic, concurrent accesses to them could violate Swift’s exclusivity laws, raising thread sanitizer errors.

Allocate the C atomic using malloc to fix this problem.

rdar://129170128

ahoppen commented 3 months ago

@swift-ci Please test

rintaro commented 3 months ago

SWIFT_SYNTAX_BUILD_USING_CMAKE mode still uses the dummy AtomicBool above. and SwiftSyntax doesn't have the dependency to _SwiftSyntaxCShims in CMake

ahoppen commented 3 months ago

@swift-ci Please test

ahoppen commented 3 months ago

@swift-ci Please test Windows

ahoppen commented 3 months ago

@swift-ci Please test

ahoppen commented 3 months ago

@swift-ci Please test Windows