https://github.com/aganea created 
https://github.com/llvm/llvm-project/pull/187937

This fixes:
```
[2124/7029] Building CXX object 
tools\clang\lib\AST\CMakeFiles\obj.clangAST.dir\TemplateBase.cpp.obj
C:\git\llvm-project\clang\lib\AST\TemplateBase.cpp(753): warning C4312: 
'reinterpret_cast': conversion from 'clang::SourceLocation::UIntTy' to 
'clang::TemplateArgumentLocInfo::LocOrPointer' of greater size
```

>From db51913d964ccae42bad079efa09cf25fc6694f2 Mon Sep 17 00:00:00 2001
From: Alexandre Ganea <[email protected]>
Date: Sun, 22 Mar 2026 11:42:55 -0400
Subject: [PATCH] [clang] On Windows, silence warning when building with MSVC

This fixes:
```
[2124/7029] Building CXX object 
tools\clang\lib\AST\CMakeFiles\obj.clangAST.dir\TemplateBase.cpp.obj
C:\git\llvm-project\clang\lib\AST\TemplateBase.cpp(753): warning C4312: 
'reinterpret_cast': conversion from 'clang::SourceLocation::UIntTy' to 
'clang::TemplateArgumentLocInfo::LocOrPointer' of greater size
```
---
 clang/lib/AST/TemplateBase.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp
index f76c2e336dc86..a5e0dde45364c 100644
--- a/clang/lib/AST/TemplateBase.cpp
+++ b/clang/lib/AST/TemplateBase.cpp
@@ -750,8 +750,8 @@ clang::TemplateArgumentLocInfo::TemplateArgumentLocInfo(
 clang::TemplateArgumentLocInfo::TemplateArgumentLocInfo(
     ASTContext &Ctx, SourceLocation TrivialLoc) {
   if constexpr (EmbedLocInPointer)
-    Pointer = reinterpret_cast<LocOrPointer>((TrivialLoc.getRawEncoding() + 1u)
-                                             << LowBitsRequired);
+    Pointer = reinterpret_cast<LocOrPointer>(static_cast<uintptr_t>(
+        (TrivialLoc.getRawEncoding() + 1u) << LowBitsRequired));
   else
     Pointer = new (Ctx) SourceLocation(TrivialLoc);
 }

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

Reply via email to