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