[clang-tools-extra] r319608 - [clangd] Avoid enum in bitfields, can't satisfy old GCC and new MSVC
Sam McCall via cfe-commits
cfe-commits at lists.llvm.org
Fri Dec 1 20:15:55 PST 2017
Author: sammccall
Date: Fri Dec 1 20:15:55 2017
New Revision: 319608
URL: http://llvm.org/viewvc/llvm-project?rev=319608&view=rev
Log:
[clangd] Avoid enum in bitfields, can't satisfy old GCC and new MSVC
Modified:
clang-tools-extra/trunk/clangd/FuzzyMatch.h
Modified: clang-tools-extra/trunk/clangd/FuzzyMatch.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/FuzzyMatch.h?rev=319608&r1=319607&r2=319608&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/FuzzyMatch.h (original)
+++ clang-tools-extra/trunk/clangd/FuzzyMatch.h Fri Dec 1 20:15:55 2017
@@ -45,7 +45,11 @@ private:
constexpr static int MaxPat = 63, MaxWord = 127;
enum CharRole : unsigned char; // For segmentation.
enum CharType : unsigned char; // For segmentation.
- enum Action : unsigned char { Miss = 0, Match = 1 };
+ // Action should be an enum, but this causes bitfield problems:
+ // - for MSVC the enum type must be explicitly unsigned for correctness
+ // - GCC 4.8 complains not all values fit if the type is unsigned
+ using Action = bool;
+ constexpr static Action Miss = false, Match = true;
bool init(llvm::StringRef Word);
void buildGraph();
More information about the cfe-commits
mailing list