llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Daniel Paoliello (dpaoliello)

<details>
<summary>Changes</summary>

Building Clang using MSVC was resulting in the following warning:

```
tuple(791): warning C4018: '&lt;': 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<unsigned, unsigned>(Major_, 
Minor_)) \
     Opts.setClangABICompat(LangOptions::ClangABI::Ver##Major_##_##Minor_);     
\
   else
 #define ABI_VER_MAJOR(Major_)                                                  
\

``````````

</details>


https://github.com/llvm/llvm-project/pull/152809
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to