Author: Shivam Gupta Date: 2023-01-23T23:48:48+05:30 New Revision: 94b9187a7d37e4269af35f8f7ec8e0f78fd6a06e
URL: https://github.com/llvm/llvm-project/commit/94b9187a7d37e4269af35f8f7ec8e0f78fd6a06e DIFF: https://github.com/llvm/llvm-project/commit/94b9187a7d37e4269af35f8f7ec8e0f78fd6a06e.diff LOG: [Clang] Fix a Wbitfield-enum-conversion warning in DirectoryLookup.h 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 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D142304 Added: Modified: clang/include/clang/Lex/DirectoryLookup.h Removed: ################################################################################ diff --git a/clang/include/clang/Lex/DirectoryLookup.h b/clang/include/clang/Lex/DirectoryLookup.h index 99f7c507c53e0..d668a830db38f 100644 --- a/clang/include/clang/Lex/DirectoryLookup.h +++ b/clang/include/clang/Lex/DirectoryLookup.h @@ -50,7 +50,7 @@ class DirectoryLookup { /// 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