[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-10 Thread LLVM Continuous Integration via cfe-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `openmp-s390x-linux` 
running on `systemz-1` while building `clang` at step 6 "test-openmp".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/88/builds/14920


Here is the relevant piece of the build log for the reference

```
Step 6 (test-openmp) failure: test (failure)
 TEST 'libomp :: tasking/issue-94260-2.c' FAILED 

Exit Code: -11

Command Output (stdout):
--
# RUN: at line 1
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang 
-fopenmp   -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test 
-L 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
  -fno-omit-frame-pointer -mbackchain -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt
 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c
 -o 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
 -lm -latomic && 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# executed command: 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/./bin/clang 
-fopenmp -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test 
-L 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/src
 -fno-omit-frame-pointer -mbackchain -I 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/ompt
 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.src/openmp/runtime/test/tasking/issue-94260-2.c
 -o 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
 -lm -latomic
# executed command: 
/home/uweigand/sandbox/buildbot/openmp-s390x-linux/llvm.build/runtimes/runtimes-bins/openmp/runtime/test/tasking/Output/issue-94260-2.c.tmp
# note: command had no output on stdout or stderr
# error: command failed with exit status: -11

--




```



https://github.com/llvm/llvm-project/pull/152809
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-10 Thread Daniel Paoliello via cfe-commits

https://github.com/dpaoliello closed 
https://github.com/llvm/llvm-project/pull/152809
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-09 Thread via cfe-commits

https://github.com/yronglin approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/152809
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-09 Thread Yanzuo Liu via cfe-commits

https://github.com/zwuis approved this pull request.


https://github.com/llvm/llvm-project/pull/152809
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-09 Thread Daniel Paoliello via cfe-commits

dpaoliello wrote:

> Can we simply change `unsigned` to `int` in Line ? What do you think?

Yep, that works.

https://github.com/llvm/llvm-project/pull/152809
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-09 Thread Daniel Paoliello via cfe-commits

https://github.com/dpaoliello updated 
https://github.com/llvm/llvm-project/pull/152809

>From 5377e6907af9cbfb339a49d0a37f590cdc8f3d17 Mon Sep 17 00:00:00 2001
From: Daniel Paoliello 
Date: Fri, 8 Aug 2025 15:37:17 -0700
Subject: [PATCH] Fix MSVC warning in CompilerInvocation.cpp

---
 clang/lib/Frontend/CompilerInvocation.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index ccc3154d20968..2ea3ed759ff42 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4441,7 +4441,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, 
ArgList &Args,
 
 StringRef Ver = A->getValue();
 std::pair VerParts = Ver.split('.');
-unsigned Major, Minor = 0;
+int Major, Minor = 0;
 
 // Check the version number is valid: either 3.x (0 <= x <= 9) or
 // y or y.0 (4 <= y <= current version).
@@ -4454,7 +4454,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, 
ArgList &Args,
  : VerParts.first.size() == Ver.size() || VerParts.second == "0")) 
{
   // Got a valid version number.
 #define ABI_VER_MAJOR_MINOR(Major_, Minor_)
\
-  if (std::tie(Major, Minor) <= std::tuple(Major_, Minor_))
\
+  if (std::tuple(Major, Minor) <= std::tuple(Major_, Minor_))  
\
 Opts.setClangABICompat(LangOptions::ClangABI::Ver##Major_##_##Minor_); 
\
   else
 #define ABI_VER_MAJOR(Major_)  
\

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


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-09 Thread via cfe-commits

https://github.com/yronglin edited 
https://github.com/llvm/llvm-project/pull/152809
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-09 Thread via cfe-commits

https://github.com/yronglin commented:

Can we simply change unsigned to int in Line ? What do you think?
```cpp
int Major, Minor = 0;
```

https://github.com/llvm/llvm-project/pull/152809
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-08 Thread Yanzuo Liu via cfe-commits

https://github.com/zwuis approved this pull request.

Thanks!

https://github.com/llvm/llvm-project/pull/152809
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-08 Thread via cfe-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Daniel Paoliello (dpaoliello)


Changes

Building Clang using MSVC was resulting in the following warning:

```
tuple(791): warning C4018: '<': signed/unsigned mismatch
```

I traced this to CompilerInvocation.cpp where it was creating a `std::tuple` to 
compare version numbers.

This change adds an explicit type for the `tuple` created from the version 
macros to match the type of the variables, and uses the `tuple` constructor 
instead of `tie` since the integers are smaller than a reference to the 
integers.

---
Full diff: https://github.com/llvm/llvm-project/pull/152809.diff


1 Files Affected:

- (modified) clang/lib/Frontend/CompilerInvocation.cpp (+1-1) 


``diff
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index ccc3154d20968..d9260e12cec3f 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4454,7 +4454,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, 
ArgList &Args,
  : VerParts.first.size() == Ver.size() || VerParts.second == "0")) 
{
   // Got a valid version number.
 #define ABI_VER_MAJOR_MINOR(Major_, Minor_)
\
-  if (std::tie(Major, Minor) <= std::tuple(Major_, Minor_))
\
+  if (std::tuple(Major, Minor) <= std::tuple(Major_, 
Minor_)) \
 Opts.setClangABICompat(LangOptions::ClangABI::Ver##Major_##_##Minor_); 
\
   else
 #define ABI_VER_MAJOR(Major_)  
\

``




https://github.com/llvm/llvm-project/pull/152809
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-08 Thread via cfe-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- 
clang/lib/Frontend/CompilerInvocation.cpp
``





View the diff from clang-format here.


``diff
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index d9260e12c..14dfc01af 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4454,7 +4454,8 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, 
ArgList &Args,
  : VerParts.first.size() == Ver.size() || VerParts.second == "0")) 
{
   // Got a valid version number.
 #define ABI_VER_MAJOR_MINOR(Major_, Minor_)
\
-  if (std::tuple(Major, Minor) <= std::tuple(Major_, 
Minor_)) \
+  if (std::tuple(Major, Minor) <=  
\
+  std::tuple(Major_, Minor_))  
\
 Opts.setClangABICompat(LangOptions::ClangABI::Ver##Major_##_##Minor_); 
\
   else
 #define ABI_VER_MAJOR(Major_)  
\

``




https://github.com/llvm/llvm-project/pull/152809
___
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-08 Thread Daniel Paoliello via cfe-commits

https://github.com/dpaoliello updated 
https://github.com/llvm/llvm-project/pull/152809

>From 75c3807d187492cb481bd08c8c1eada8552b54b6 Mon Sep 17 00:00:00 2001
From: Daniel Paoliello 
Date: Fri, 8 Aug 2025 15:37:17 -0700
Subject: [PATCH] Fix MSVC warning in CompilerInvocation.cpp

---
 clang/lib/Frontend/CompilerInvocation.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index ccc3154d20968..14dfc01afc0bb 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4454,7 +4454,8 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, 
ArgList &Args,
  : VerParts.first.size() == Ver.size() || VerParts.second == "0")) 
{
   // Got a valid version number.
 #define ABI_VER_MAJOR_MINOR(Major_, Minor_)
\
-  if (std::tie(Major, Minor) <= std::tuple(Major_, Minor_))
\
+  if (std::tuple(Major, Minor) <=  
\
+  std::tuple(Major_, Minor_))  
\
 Opts.setClangABICompat(LangOptions::ClangABI::Ver##Major_##_##Minor_); 
\
   else
 #define ABI_VER_MAJOR(Major_)  
\

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


[clang] Fix MSVC warning in CompilerInvocation.cpp (PR #152809)

2025-08-08 Thread Daniel Paoliello via cfe-commits

https://github.com/dpaoliello created 
https://github.com/llvm/llvm-project/pull/152809

Building Clang using MSVC was resulting in the following warning:

```
tuple(791): warning C4018: '<': signed/unsigned mismatch
```

I traced this to CompilerInvocation.cpp where it was creating a `std::tuple` to 
compare version numbers.

This change adds an explicit type for the `tuple` created from the version 
macros to match the type of the variables, and uses the `tuple` constructor 
instead of `tie` since the integers are smaller than a reference to the 
integers.

>From 9e23dfbbd651fc2b28c56272db002ddd8eb774b5 Mon Sep 17 00:00:00 2001
From: Daniel Paoliello 
Date: Fri, 8 Aug 2025 15:37:17 -0700
Subject: [PATCH] Fix MSVC warning in CompilerInvocation.cpp

---
 clang/lib/Frontend/CompilerInvocation.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clang/lib/Frontend/CompilerInvocation.cpp 
b/clang/lib/Frontend/CompilerInvocation.cpp
index ccc3154d20968..d9260e12cec3f 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -4454,7 +4454,7 @@ bool CompilerInvocation::ParseLangArgs(LangOptions &Opts, 
ArgList &Args,
  : VerParts.first.size() == Ver.size() || VerParts.second == "0")) 
{
   // Got a valid version number.
 #define ABI_VER_MAJOR_MINOR(Major_, Minor_)
\
-  if (std::tie(Major, Minor) <= std::tuple(Major_, Minor_))
\
+  if (std::tuple(Major, Minor) <= std::tuple(Major_, 
Minor_)) \
 Opts.setClangABICompat(LangOptions::ClangABI::Ver##Major_##_##Minor_); 
\
   else
 #define ABI_VER_MAJOR(Major_)  
\

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