https://github.com/aganea updated 
https://github.com/llvm/llvm-project/pull/187938

>From 767229c544f2989d7db72eb300a3d20997ca7e1c Mon Sep 17 00:00:00 2001
From: Alexandre Ganea <[email protected]>
Date: Sun, 22 Mar 2026 11:45:20 -0400
Subject: [PATCH 1/2] [clang] On Windows, silence warning in
 `WhitespaceManager` when building with MSVC

This fixes:
```
[4544/7029] Building CXX object 
tools\clang\lib\Format\CMakeFiles\obj.clangFormat.dir\WhitespaceManager.cpp.obj
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveColons'::`2'::<lambda_1>
 &,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveShortCaseStatements'::`2'::<lambda_1>
 &,3>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveDeclarations'::`2'::<lambda_1>
 &,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveAssignments'::`2'::<lambda_1>
 &,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveMacros'::`2'::<lambda_1>
 &,1>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignChainedConditionals'::`7'::<lambda_3>
 &,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveColons'::`2'::<lambda_1>,0>'::`4'::<lambda_2>::operator()':
 not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveAssignments'::`2'::<lambda_1>,0>'::`4'::<lambda_2>::operator()':
 not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignChainedConditionals'::`5'::<lambda_1>
 &,0>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveDeclarations'::`2'::<lambda_1>,0>'::`4'::<lambda_2>::operator()':
 not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignChainedConditionals'::`5'::<lambda_1>,0>'::`4'::<lambda_2>::operator()':
 not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignConsecutiveShortCaseStatements'::`2'::<lambda_1>
 &,2>'::`4'::<lambda_2>::operator()': not all control paths return a value
C:\git\llvm-project\clang\lib\Format\WhitespaceManager.cpp(640) : warning 
C4715: 
'`clang::format::AlignTokens<`clang::format::WhitespaceManager::alignChainedConditionals'::`7'::<lambda_3>,0>'::`4'::<lambda_2>::operator()':
 not all control paths return a value
```
---
 clang/lib/Format/WhitespaceManager.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/lib/Format/WhitespaceManager.cpp 
b/clang/lib/Format/WhitespaceManager.cpp
index d1cf8b2280534..f27f131e586d8 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -14,6 +14,7 @@
 #include "WhitespaceManager.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/Support/ErrorHandling.h"
 #include <algorithm>
 #include <limits>
 #include <optional>
@@ -636,6 +637,8 @@ static unsigned AlignTokens(const FormatStyle &Style, F 
&&Matches,
       case AlignStrategy::Macro:
       case AlignStrategy::Normal:
         return {true, false};
+      default:
+        llvm_unreachable("Unhandled AlignStrategy");
       }
     }();
 

>From 7aff028be9f711e31d8568db06f96424d2c59154 Mon Sep 17 00:00:00 2001
From: Alexandre Ganea <[email protected]>
Date: Sun, 22 Mar 2026 19:47:42 -0400
Subject: [PATCH 2/2] Address review comments

---
 clang/lib/Format/WhitespaceManager.cpp | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/clang/lib/Format/WhitespaceManager.cpp 
b/clang/lib/Format/WhitespaceManager.cpp
index f27f131e586d8..93f354a9f7256 100644
--- a/clang/lib/Format/WhitespaceManager.cpp
+++ b/clang/lib/Format/WhitespaceManager.cpp
@@ -14,7 +14,6 @@
 #include "WhitespaceManager.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/ErrorHandling.h"
 #include <algorithm>
 #include <limits>
 #include <optional>
@@ -634,11 +633,8 @@ static unsigned AlignTokens(const FormatStyle &Style, F 
&&Matches,
           Tok = Tok->getNextNonComment();
         return {Tok && Tok->isOneOf(tok::kw_case, tok::kw_default), false};
       }
-      case AlignStrategy::Macro:
-      case AlignStrategy::Normal:
+      default: // AlignStrategy::Macro and AlignStrategy::Normal:
         return {true, false};
-      default:
-        llvm_unreachable("Unhandled AlignStrategy");
       }
     }();
 

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to