[PATCH] D126536: [pseudo] Add grammar annotations support.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 27 06:40:14 PDT 2022


hokein added inline comments.


================
Comment at: clang-tools-extra/pseudo/include/clang-pseudo/Grammar.h:87
+// Defines the built-in attribute keys.
+enum class AttributeKey : uint8_t {
+  // A guard controls whether a reduction of a rule will be conducted by the GLR
----------------
new names are welcome. Attribute is the name I came up with (I think it is clearer than the original `Hook`), 


================
Comment at: clang-tools-extra/pseudo/include/clang-pseudo/Grammar.h:94
+// It is the index into a table of attribute values.
+// NOTE: value among attributes must be unique even within different keys!
+using AttributeID = uint16_t;
----------------
I'm not quite happy with using the value as the ID, I think we can encode the Key into the ID as well (ID := Key | Value). 

Similar to the generated enum name, currently we just use the name of Value (`Override`), it will be more confusing when we add more keys/values, one idea is to add key as well (`GuardOverride` etc?).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D126536/new/

https://reviews.llvm.org/D126536



More information about the cfe-commits mailing list