Skip to content

Determine whether a given sanitizer is available based on the presenc… #14919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 3, 2018

Conversation

cheshire
Copy link

@cheshire cheshire commented Mar 1, 2018

…e of the library.

rdar://37192887

Basically, if the library is there, the sanitizer is available. IF not, then it's not available.

@cheshire
Copy link
Author

cheshire commented Mar 1, 2018

@swift-ci please test

Diags.diagnose(SourceLoc(), diag::error_unsupported_option_argument,
A->getOption().getPrefixedName(), A->getValue(i));
} else if (sanitizerRuntimeLibExists(toFileName(*kind), isShared)
&& (*kind != SanitizerKind::Thread || Triple.isArch64Bit())) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we keep the helper function "isTSanSupported"? Even if it's just a test for .isArch64bit. This condition is very hard to read.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kubamracek keeping the function does not make sense, as we now check existence of all sanitizers. I've tried to rewrite the condition to make it more readable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we then just be a bit more verbose here? Something like

bool sanitizerSupported = true;
if (*kind == Thread) {
  if (!Triple.is64bit() sanitizerSupported = false; // TSan requires 64-bit architecture
}
...

@kubamracek
Copy link
Contributor

Besides the comment, this LGTM. Thanks!

@swift-ci
Copy link
Contributor

swift-ci commented Mar 1, 2018

Build failed
Swift Test Linux Platform
Git Sha - ba022bb

@cheshire
Copy link
Author

cheshire commented Mar 2, 2018

@swift-ci please smoke test

@kubamracek
Copy link
Contributor

LGTM. Thanks!

@cheshire cheshire merged commit a65da88 into swiftlang:master Mar 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants