[clang] 09c5041 - Fix MSVC "'|': unsafe operation: no value of type '_Ty' promoted to type 'int' can equal the given constant" warning. NFC.

Simon Pilgrim via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 18 01:44:02 PDT 2023


Author: Simon Pilgrim
Date: 2023-08-18T09:43:46+01:00
New Revision: 09c5041911024c220a820369e17f76fe7fe2adee

URL: https://github.com/llvm/llvm-project/commit/09c5041911024c220a820369e17f76fe7fe2adee
DIFF: https://github.com/llvm/llvm-project/commit/09c5041911024c220a820369e17f76fe7fe2adee.diff

LOG: Fix MSVC "'|': unsafe operation: no value of type '_Ty' promoted to type 'int' can equal the given constant" warning. NFC.

Added: 
    

Modified: 
    clang/lib/APINotes/APINotesWriter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/APINotes/APINotesWriter.cpp b/clang/lib/APINotes/APINotesWriter.cpp
index aad4c886bdd66d..3f2454c47df3b9 100644
--- a/clang/lib/APINotes/APINotesWriter.cpp
+++ b/clang/lib/APINotes/APINotesWriter.cpp
@@ -528,10 +528,10 @@ class ObjCContextInfoTableInfo
 
     uint8_t payload = 0;
     if (auto swiftImportAsNonGeneric = OCI.getSwiftImportAsNonGeneric())
-      payload |= (0x01 << 1) | swiftImportAsNonGeneric.value();
+      payload |= (0x01 << 1) | (uint8_t)swiftImportAsNonGeneric.value();
     payload <<= 2;
     if (auto swiftObjCMembers = OCI.getSwiftObjCMembers())
-      payload |= (0x01 << 1) | swiftObjCMembers.value();
+      payload |= (0x01 << 1) | (uint8_t)swiftObjCMembers.value();
     payload <<= 3;
     if (auto nullable = OCI.getDefaultNullability())
       payload |= (0x01 << 2) | static_cast<uint8_t>(*nullable);


        


More information about the cfe-commits mailing list