[clang-tools-extra] cd387e4 - [pseudo] Squash some warnings. NFC

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Wed May 18 23:20:28 PDT 2022


Author: Sam McCall
Date: 2022-05-19T08:20:12+02:00
New Revision: cd387e43bf89438a83352d47e3d33bc34b697761

URL: https://github.com/llvm/llvm-project/commit/cd387e43bf89438a83352d47e3d33bc34b697761
DIFF: https://github.com/llvm/llvm-project/commit/cd387e43bf89438a83352d47e3d33bc34b697761.diff

LOG: [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.

Added: 
    

Modified: 
    clang-tools-extra/pseudo/include/clang-pseudo/Forest.h
    clang-tools-extra/pseudo/lib/LRTable.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/pseudo/include/clang-pseudo/Forest.h b/clang-tools-extra/pseudo/include/clang-pseudo/Forest.h
index 39b35597ed5e3..c699c4c217dff 100644
--- a/clang-tools-extra/pseudo/include/clang-pseudo/Forest.h
+++ b/clang-tools-extra/pseudo/include/clang-pseudo/Forest.h
@@ -43,7 +43,7 @@ namespace pseudo {
 // doesn't have parent pointers.
 class alignas(class ForestNode *) ForestNode {
 public:
-  enum Kind : uint8_t {
+  enum Kind {
     // A Terminal node is a single terminal symbol bound to a token.
     Terminal,
     // A Sequence node is a nonterminal symbol parsed from a grammar rule,

diff  --git a/clang-tools-extra/pseudo/lib/LRTable.cpp b/clang-tools-extra/pseudo/lib/LRTable.cpp
index 34e7fce4f55dc..745ad44bafa6c 100644
--- a/clang-tools-extra/pseudo/lib/LRTable.cpp
+++ b/clang-tools-extra/pseudo/lib/LRTable.cpp
@@ -97,7 +97,7 @@ LRTable::StateID LRTable::getGoToState(StateID State,
 }
 
 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()
                      : Idx + 1 < NontermOffset.size());
   std::pair<size_t, size_t> TargetStateRange =


        


More information about the cfe-commits mailing list