[clang] [compiler-rt] [llvm] Add numerical sanitizer (PR #85916)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 20 03:39:59 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r 9fd1c4121f7c797ff7222161cb40cd68ecf0fbc8...f932900890ba96ae01f8c4d762aca5023d0b7fce compiler-rt/test/nsan/lit.cfg.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- lit.cfg.py 2024-03-20 09:59:30.000000 +0000
+++ lit.cfg.py 2024-03-20 10:39:52.135628 +0000
@@ -1,45 +1,53 @@
# -*- Python -*-
import os
# Setup config name.
-config.name = 'NSan' + config.name_suffix
+config.name = "NSan" + config.name_suffix
# Setup source root.
config.test_source_root = os.path.dirname(__file__)
# Test suffixes.
-config.suffixes = ['.c', '.cc', '.test']
+config.suffixes = [".c", ".cc", ".test"]
# C & CXX flags.
-c_flags = ([config.target_cflags])
+c_flags = [config.target_cflags]
# Android doesn't want -lrt.
if not config.android:
- c_flags += ["-lrt"]
+ c_flags += ["-lrt"]
-cxx_flags = (c_flags + config.cxx_mode_flags + ["-std=c++17"])
+cxx_flags = c_flags + config.cxx_mode_flags + ["-std=c++17"]
-nsan_flags = ["-fsanitize=numerical", "-g",
- "-mno-omit-leaf-frame-pointer",
- "-fno-omit-frame-pointer"]
+nsan_flags = [
+ "-fsanitize=numerical",
+ "-g",
+ "-mno-omit-leaf-frame-pointer",
+ "-fno-omit-frame-pointer",
+]
+
def build_invocation(compile_flags):
- return " " + " ".join([config.clang] + compile_flags) + " "
+ return " " + " ".join([config.clang] + compile_flags) + " "
+
# Add substitutions.
config.substitutions.append(("%clang ", build_invocation(c_flags)))
config.substitutions.append(("%clang_nsan ", build_invocation(c_flags + nsan_flags)))
-config.substitutions.append(("%clangxx_nsan ", build_invocation(cxx_flags + nsan_flags)))
+config.substitutions.append(
+ ("%clangxx_nsan ", build_invocation(cxx_flags + nsan_flags))
+)
# Platform-specific default NSAN for lit tests.
-default_nsan_options = ''
+default_nsan_options = ""
-config.environment['NSAN_OPTIONS'] = default_nsan_options
-default_nsan_options += ':'
-config.substitutions.append(('%env_nsan_options=',
- 'env NSAN_OPTIONS=' + default_nsan_options))
+config.environment["NSAN_OPTIONS"] = default_nsan_options
+default_nsan_options += ":"
+config.substitutions.append(
+ ("%env_nsan_options=", "env NSAN_OPTIONS=" + default_nsan_options)
+)
# NSan tests are currently supported on Linux only.
-if config.host_os not in ['Linux']:
- config.unsupported = True
+if config.host_os not in ["Linux"]:
+ config.unsupported = True
``````````
</details>
https://github.com/llvm/llvm-project/pull/85916
More information about the cfe-commits
mailing list