From a0324e911374441151903ed0d828e0fc1994c167 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Mon, 4 Nov 2019 15:07:37 +0000 Subject: [PATCH] SanitizerMask::bitPosToMask - fix operator precedence warnings. NFCI. Fix static analyzer operator precedence warnings with suitable bracketing. Pull out the mask generation code so clang-format doesn't make such a mess of it. --- clang/include/clang/Basic/Sanitizers.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/clang/include/clang/Basic/Sanitizers.h b/clang/include/clang/Basic/Sanitizers.h index 5961abf2aa19..c6b0446cea4f 100644 --- a/clang/include/clang/Basic/Sanitizers.h +++ b/clang/include/clang/Basic/Sanitizers.h @@ -52,10 +52,11 @@ public: /// Create a mask with a bit enabled at position Pos. static constexpr SanitizerMask bitPosToMask(const unsigned Pos) { - return SanitizerMask((Pos < kNumBitElem) ? 1ULL << Pos % kNumBitElem : 0, - (Pos >= kNumBitElem && Pos < kNumBitElem * 2) - ? 1ULL << Pos % kNumBitElem - : 0); + uint64_t mask1 = (Pos < kNumBitElem) ? 1ULL << (Pos % kNumBitElem) : 0; + uint64_t mask2 = (Pos >= kNumBitElem && Pos < (kNumBitElem * 2)) + ? 1ULL << (Pos % kNumBitElem) + : 0; + return SanitizerMask(mask1, mask2); } unsigned countPopulation() const {