Skip to content

Commit b82e48d

Browse files
committed
Format
1 parent 1aed608 commit b82e48d

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

clang/lib/Basic/Sanitizers.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,12 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "clang/Basic/Sanitizers.h"
14+
#include "llvm/ADT/APFloat.h"
1415
#include "llvm/ADT/Hashing.h"
1516
#include "llvm/ADT/SmallVector.h"
1617
#include "llvm/ADT/StringSwitch.h"
1718
#include "llvm/Support/MathExtras.h"
19+
#include "llvm/Support/raw_ostream.h"
1820
#include <algorithm>
1921
#include <optional>
2022

@@ -94,7 +96,11 @@ void clang::serializeSanitizerMaskCutoffs(
9496
const SanitizerMaskCutoffs &Cutoffs, SmallVectorImpl<std::string> &Values) {
9597
#define SANITIZER(NAME, ID) \
9698
if (auto C = Cutoffs[SanitizerKind::SO_##ID]) { \
97-
Values.push_back(std::string(NAME "=") + std::to_string(*C)); \
99+
llvm::APFloat F(*C); \
100+
std::string Str; \
101+
llvm::raw_string_ostream OS(Str); \
102+
OS << NAME "=" << F; \
103+
Values.emplace_back(std::move(Str)); \
98104
}
99105
#include "clang/Basic/Sanitizers.def"
100106
}

clang/test/Driver/fsanitize.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1173,11 +1173,11 @@
11731173

11741174
// Enable undefined, then cancel out integer using a cutoff of 0.0, then re-enable signed-integer-overflow
11751175
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fno-sanitize-top-hot=undefined=0.5,integer=0.0,signed-integer-overflow=0.7 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TOP-HOT4
1176-
// CHECK-TOP-HOT4: "-fno-sanitize-top-hot={{((signed-integer-overflow|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute|function|vptr)=(0.5|0.7)(0*),?){16}"}}
1176+
// CHECK-TOP-HOT4: "-fno-sanitize-top-hot={{((signed-integer-overflow|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute|function|vptr)=(0.5|0.49|0.7|0.69)([0-9]*),?){16}"}}
11771177

11781178
// Check that -fno-sanitize-top-hot=undefined=0.4 does not widen the set of -fsanitize=integer checks.
11791179
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=integer -fno-sanitize-top-hot=undefined=0.4 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TOP-HOT5
1180-
// CHECK-TOP-HOT5: "-fno-sanitize-top-hot={{((integer-divide-by-zero|shift-base|shift-exponent|signed-integer-overflow)=0.4(0*),?){4}"}}
1180+
// CHECK-TOP-HOT5: "-fno-sanitize-top-hot={{((integer-divide-by-zero|shift-base|shift-exponent|signed-integer-overflow)=(0.4|0.39)([0-9]*),?){4}"}}
11811181

11821182
// No-op: it's allowed for the user to specify a cutoff of 0.0, though the argument is not passed along by the driver.
11831183
// RUN: %clang --target=x86_64-linux-gnu -fsanitize=undefined -fno-sanitize-top-hot=undefined=0.0 %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-TOP-HOT6

0 commit comments

Comments
 (0)