[PATCH] D11890: Fixed Visual Studio warnings.

James Touton via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 10 13:42:47 PDT 2015


jtouton added inline comments.

================
Comment at: lib/Transforms/Instrumentation/ThreadSanitizer.cpp:145
@@ -144,3 +144,3 @@
   for (size_t i = 0; i < kNumberOfAccessSizes; ++i) {
-    const size_t ByteSize = 1 << i;
+    const size_t ByteSize = size_t(1 << i);
     const size_t BitSize = ByteSize * 8;
----------------
kcc wrote:
> Wouldn't it be better (more readable to write like this? (Here and below)
>   .. = 1UL << i;
UL on MSVC is always 32-bit, so you'd get the same warning.  Another alternative would be:
```
size_t(1) << i
```
...but I can't imagine a universe where i would be large enough for that to actually matter.


http://reviews.llvm.org/D11890





More information about the llvm-commits mailing list