[all-commits] [llvm/llvm-project] 94b918: [Clang] Fix a Wbitfield-enum-conversion warning in...
Shivam Gupta via All-commits
all-commits at lists.llvm.org
Mon Jan 23 10:18:41 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 94b9187a7d37e4269af35f8f7ec8e0f78fd6a06e
https://github.com/llvm/llvm-project/commit/94b9187a7d37e4269af35f8f7ec8e0f78fd6a06e
Author: Shivam Gupta <shivam98.tkg at gmail.com>
Date: 2023-01-23 (Mon, 23 Jan 2023)
Changed paths:
M clang/include/clang/Lex/DirectoryLookup.h
Log Message:
-----------
[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
More information about the All-commits
mailing list