forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 344
Commit 6a87309
Set the underlying type of enum BoundsSafetyNewChecks to unsigned.
llvm::has_single_bit and llvm::countr_zero both require that the
argument type is unsigned but the default underlying type for enums
is int, which causes build errors with MSVC.
This fixes the windows build with MSVC.
```
FAILED: tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/BoundsSafetyArgs.cpp.obj
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DCLANG_BUILD_STATIC -DEXPERIMENTAL_KEY_INSTRUCTIONS -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__SHORT_FILE__=\"BoundsSafetyArgs.cpp\" -IC:\Users\hiroshi\cas\llvm-project\build\tools\clang\lib\Driver -IC:\Users\hiroshi\cas\llvm-project\clang\lib\Driver -IC:\Users\hiroshi\cas\llvm-project\clang\include -IC:\Users\hiroshi\cas\llvm-project\build\tools\clang\include -IC:\Users\hiroshi\cas\llvm-project\build\include -IC:\Users\hiroshi\cas\llvm-project\llvm\include /DWIN32 /D_WINDOWS /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2 /DNDEBUG -std:c++17 -MD /EHs-c- /GR- /showIncludes /Fotools\clang\lib\Driver\CMakeFiles\obj.clangDriver.dir\BoundsSafetyArgs.cpp.obj /Fdtools\clang\lib\Driver\CMakeFiles\obj.clangDriver.dir\ /FS -c C:\Users\hiroshi\cas\llvm-project\clang\lib\Driver\BoundsSafetyArgs.cpp
C:\Users\hiroshi\cas\llvm-project\clang\lib\Driver\BoundsSafetyArgs.cpp(196): error C2672: 'llvm::has_single_bit': no matching overloaded function found
C:\Users\hiroshi\cas\llvm-project\llvm\include\llvm/ADT/bit.h(147): note: could be 'bool llvm::has_single_bit(T) noexcept'
C:\Users\hiroshi\cas\llvm-project\clang\lib\Driver\BoundsSafetyArgs.cpp(196): note: 'bool llvm::has_single_bit(T) noexcept': could not deduce template argument for '<unnamed-symbol>'
C:\Users\hiroshi\cas\llvm-project\llvm\include\llvm/ADT/bit.h(146): note: 'std::enable_if_t<false,void>' : Failed to specialize alias template
```
```
FAILED: tools/clang/lib/Driver/CMakeFiles/obj.clangDriver.dir/BoundsSafetyArgs.cpp.obj
C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -DCLANG_BUILD_STATIC -DEXPERIMENTAL_KEY_INSTRUCTIONS -DGTEST_HAS_RTTI=0 -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -D__SHORT_FILE__=\"BoundsSafetyArgs.cpp\" -IC:\Users\hiroshi\cas\llvm-project\build\tools\clang\lib\Driver -IC:\Users\hiroshi\cas\llvm-project\clang\lib\Driver -IC:\Users\hiroshi\cas\llvm-project\clang\include -IC:\Users\hiroshi\cas\llvm-project\build\tools\clang\include -IC:\Users\hiroshi\cas\llvm-project\build\include -IC:\Users\hiroshi\cas\llvm-project\llvm\include /DWIN32 /D_WINDOWS /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2 /DNDEBUG -std:c++17 -MD /EHs-c- /GR- /showIncludes /Fotools\clang\lib\Driver\CMakeFiles\obj.clangDriver.dir\BoundsSafetyArgs.cpp.obj /Fdtools\clang\lib\Driver\CMakeFiles\obj.clangDriver.dir\ /FS -c C:\Users\hiroshi\cas\llvm-project\clang\lib\Driver\BoundsSafetyArgs.cpp
C:\Users\hiroshi\cas\llvm-project\llvm\include\llvm/ADT/bit.h(158): error C2338: static_assert failed: 'Only unsigned integral types are allowed.'
C:\Users\hiroshi\cas\llvm-project\llvm\include\llvm/ADT/bit.h(158): note: the template instantiation context (the oldest one first) is
```
(cherry picked from commit 7524778)1 parent 17b000d commit 6a87309Copy full SHA for 6a87309
File tree
Expand file treeCollapse file tree
1 file changed
+1
-1
lines changedFilter options
- clang/include/clang/Basic
Expand file treeCollapse file tree
1 file changed
+1
-1
lines changedclang/include/clang/Basic/LangOptions.h
Copy file name to clipboardExpand all lines: clang/include/clang/Basic/LangOptions.h+1-1Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
461 | 461 |
| |
462 | 462 |
| |
463 | 463 |
| |
464 |
| - | |
| 464 | + | |
465 | 465 |
| |
466 | 466 |
| |
467 | 467 |
| |
|
0 commit comments