Skip to content
Commit 94b9187a authored by Shivam Gupta's avatar Shivam Gupta
Browse files

[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
parent a15b0e86
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment