aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Paoliello <danpao@microsoft.com>2025-08-10 11:19:12 -0700
committerGitHub <noreply@github.com>2025-08-10 11:19:12 -0700
commit59f31d4e8df8cc35c816c05f2c653ca29e9a276e (patch)
tree63cf6dc9cd821aee75deab19055504f72f09fd70
parent2b4b721faf852a405b25064c0d3b59a2372efe2b (diff)
downloadllvm-59f31d4e8df8cc35c816c05f2c653ca29e9a276e.zip
llvm-59f31d4e8df8cc35c816c05f2c653ca29e9a276e.tar.gz
llvm-59f31d4e8df8cc35c816c05f2c653ca29e9a276e.tar.bz2
Fix MSVC warning in CompilerInvocation.cpp (#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.
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index ccc3154..2ea3ed7 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<StringRef, StringRef> 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_) \