[pseudo] Squash some warnings. NFC

Explicitly sizing Kind enum suggests that too-large values are allowed,
and that putting it in a bitfield is dangerous.

GCC doesn't like condition ? integer : enum.
This commit is contained in:
Sam McCall 2022-05-19 08:18:34 +02:00
parent dfd3a385d6
commit cd387e43bf
2 changed files with 2 additions and 2 deletions

View File

@ -43,7 +43,7 @@ namespace pseudo {
// doesn't have parent pointers. // doesn't have parent pointers.
class alignas(class ForestNode *) ForestNode { class alignas(class ForestNode *) ForestNode {
public: public:
enum Kind : uint8_t { enum Kind {
// A Terminal node is a single terminal symbol bound to a token. // A Terminal node is a single terminal symbol bound to a token.
Terminal, Terminal,
// A Sequence node is a nonterminal symbol parsed from a grammar rule, // A Sequence node is a nonterminal symbol parsed from a grammar rule,

View File

@ -97,7 +97,7 @@ LRTable::StateID LRTable::getGoToState(StateID State,
} }
llvm::ArrayRef<LRTable::Action> LRTable::find(StateID Src, SymbolID ID) const { llvm::ArrayRef<LRTable::Action> LRTable::find(StateID Src, SymbolID ID) const {
size_t Idx = isToken(ID) ? symbolToToken(ID) : ID; size_t Idx = isToken(ID) ? static_cast<size_t>(symbolToToken(ID)) : ID;
assert(isToken(ID) ? Idx + 1 < TerminalOffset.size() assert(isToken(ID) ? Idx + 1 < TerminalOffset.size()
: Idx + 1 < NontermOffset.size()); : Idx + 1 < NontermOffset.size());
std::pair<size_t, size_t> TargetStateRange = std::pair<size_t, size_t> TargetStateRange =