Author: Shivam Gupta Date: 2023-01-23T20:18:08+05:30 New Revision: 68b890831615fc4350a47cf7ec404156128d03ac
URL: https://github.com/llvm/llvm-project/commit/68b890831615fc4350a47cf7ec404156128d03ac DIFF: https://github.com/llvm/llvm-project/commit/68b890831615fc4350a47cf7ec404156128d03ac.diff LOG: [Clang[NFC] Fix bitmask for NullabilityPayload in Types.h Found by PVS-Studio - https://pvs-studio.com/en/blog/posts/cpp/1003/, N37. The code you is using the bit mask NullabilityKindMask which is 0x3 (00000011 in binary) to clear the bits in the NullabilityPayload variable. Since NullabilityPayload is a 64-bit variable and NullabilityKindMask is only a 8-bit variable(0x3), it will only affect the last 8 bits of the variable. The higher 56 bits will remain unchanged. Differential Revision: https://reviews.llvm.org/D142334 Added: Modified: clang/include/clang/APINotes/Types.h Removed: ################################################################################ diff --git a/clang/include/clang/APINotes/Types.h b/clang/include/clang/APINotes/Types.h index af5f05bc0d365..61f3592ea145b 100644 --- a/clang/include/clang/APINotes/Types.h +++ b/clang/include/clang/APINotes/Types.h @@ -482,7 +482,7 @@ inline bool operator!=(const ParamInfo &LHS, const ParamInfo &RHS) { /// API notes for a function or method. class FunctionInfo : public CommonEntityInfo { private: - static constexpr const unsigned NullabilityKindMask = 0x3; + static constexpr const uint64_t NullabilityKindMask = 0x3; static constexpr const unsigned NullabilityKindSize = 2; static constexpr const unsigned ReturnInfoIndex = 0; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits