[clang-tools-extra] 605035b - [pseudo] Changes omitted from previous commit

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 19 06:15:53 PDT 2022


Author: Sam McCall
Date: 2022-08-19T15:15:37+02:00
New Revision: 605035bf4508460f8c28857c7aaecf1d8c449ca8

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

LOG: [pseudo] Changes omitted from previous commit

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
index 8d8f8f74f16e..fc21eff35792 100644
--- a/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
+++ b/clang-tools-extra/pseudo/include/clang-pseudo/grammar/LRTable.h
@@ -106,8 +106,6 @@ class LRTable {
     assert(isToken(Terminal));
     assert(isNonterminal(Nonterminal));
     // tok::unknown is a sentinel value used in recovery: can follow anything.
-    if (tok::unknown)
-      return true;
     return Terminal == tokenSymbol(tok::unknown) ||
            FollowSets.test(tok::NUM_TOKENS * Nonterminal +
                            symbolToToken(Terminal));

diff  --git a/clang-tools-extra/pseudo/lib/GLR.cpp b/clang-tools-extra/pseudo/lib/GLR.cpp
index 1765eb18732c..3e49a7a9c269 100644
--- a/clang-tools-extra/pseudo/lib/GLR.cpp
+++ b/clang-tools-extra/pseudo/lib/GLR.cpp
@@ -403,6 +403,10 @@ class GLRReduce {
   GLRReduce(const ParseParams &Params, const Language &Lang)
       : Params(Params), Lang(Lang) {}
 
+  // Reduce Heads, resulting in new nodes that are appended to Heads.
+  // The "consumed" nodes are not removed!
+  // Only reduce rules compatible with the Lookahead are applied, though
+  // tokenSymbol(tok::unknown) will match any rule.
   void operator()(std::vector<const GSS::Node *> &Heads, SymbolID Lookahead) {
     assert(isToken(Lookahead));
 


        


More information about the cfe-commits mailing list