xgupta created this revision. xgupta added reviewers: aaron.ballman, fahadnayyar. Herald added a project: All. xgupta requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
When compiling clang/Lex/DirectoryLookup.h with option -Wbitfield-enum-conversion, we get the following warning: DirectoryLookup.h:77:17: warning: bit-field 'DirCharacteristic' is not wide enough to store all enumerators of 'CharacteristicKind' [-Wbitfield-enum-conversion] : u(Map), DirCharacteristic(DT), LookupType(LT_HeaderMap), DirCharacteristic is a bitfield with 2 bits (4 values) /// DirCharacteristic - The type of directory this is: this is an instance of /// SrcMgr::CharacteristicKind. unsigned DirCharacteristic : 2; Whereas SrcMgr::CharacterKind is an enum with 5 values: enum CharacteristicKind { C_User, C_System, C_ExternCSystem, C_User_ModuleMap, C_System_ModuleMap }; Solution is to increase DirCharacteristic bitfield from 2 to 3. Patch by Dimitri van Heesch Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D142304 Files: clang/include/clang/Lex/DirectoryLookup.h Index: clang/include/clang/Lex/DirectoryLookup.h =================================================================== --- clang/include/clang/Lex/DirectoryLookup.h +++ clang/include/clang/Lex/DirectoryLookup.h @@ -50,7 +50,7 @@ /// DirCharacteristic - The type of directory this is: this is an instance of /// SrcMgr::CharacteristicKind. - unsigned DirCharacteristic : 2; + unsigned DirCharacteristic : 3; /// LookupType - This indicates whether this DirectoryLookup object is a /// normal directory, a framework, or a headermap.
Index: clang/include/clang/Lex/DirectoryLookup.h =================================================================== --- clang/include/clang/Lex/DirectoryLookup.h +++ clang/include/clang/Lex/DirectoryLookup.h @@ -50,7 +50,7 @@ /// DirCharacteristic - The type of directory this is: this is an instance of /// SrcMgr::CharacteristicKind. - unsigned DirCharacteristic : 2; + unsigned DirCharacteristic : 3; /// LookupType - This indicates whether this DirectoryLookup object is a /// normal directory, a framework, or a headermap.
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits