[clang] d2396d8 - Comment parsing: Treat properties as zero-argument inline commands

Aaron Puchert via cfe-commits cfe-commits at lists.llvm.org
Fri May 13 04:49:32 PDT 2022


Author: Aaron Puchert
Date: 2022-05-13T13:48:46+02:00
New Revision: d2396d896ee12ad20bc740174edfce2120d742b2

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

LOG: Comment parsing: Treat properties as zero-argument inline commands

That is more accurate, and using a separate class in TableGen seems
appropriate since these are not parts of the text but properties of the
declaration itself.

Reviewed By: gribozavr2

Differential Revision: https://reviews.llvm.org/D125473

Added: 
    

Modified: 
    clang/include/clang/AST/CommentCommands.td

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/CommentCommands.td b/clang/include/clang/AST/CommentCommands.td
index a3b9eb313fcf..e839031752cd 100644
--- a/clang/include/clang/AST/CommentCommands.td
+++ b/clang/include/clang/AST/CommentCommands.td
@@ -63,6 +63,11 @@ class VerbatimLineCommand<string name> : Command<name> {
   let IsVerbatimLineCommand = 1;
 }
 
+class PropertyCommand<string name> : Command<name> {
+  let NumArgs = 0;
+  let IsInlineCommand = 1;
+}
+
 class DeclarationVerbatimLineCommand<string name> :
       VerbatimLineCommand<name> {
   let IsDeclarationCommand = 1;
@@ -275,31 +280,6 @@ def Until    : VerbatimLineCommand<"until">;
 
 def NoOp : VerbatimLineCommand<"noop">;
 
-// These have actually no arguments, but we can treat them as line commands.
-def CallGraph       : VerbatimLineCommand<"callgraph">;
-def HideCallGraph   : VerbatimLineCommand<"hidecallgraph">;
-def CallerGraph     : VerbatimLineCommand<"callergraph">;
-def HideCallerGraph : VerbatimLineCommand<"hidecallergraph">;
-def ShowInitializer : VerbatimLineCommand<"showinitializer">;
-def HideInitializer : VerbatimLineCommand<"hideinitializer">;
-def ShowRefBy       : VerbatimLineCommand<"showrefby">;
-def HideRefBy       : VerbatimLineCommand<"hiderefby">;
-def ShowRefs        : VerbatimLineCommand<"showrefs">;
-def HideRefs        : VerbatimLineCommand<"hiderefs">;
-
-// These also have no argument.
-def Private   : VerbatimLineCommand<"private">;
-def Protected : VerbatimLineCommand<"protected">;
-def Public    : VerbatimLineCommand<"public">;
-def Pure      : VerbatimLineCommand<"pure">;
-def Static    : VerbatimLineCommand<"static">;
-
-// These also have no argument.
-def NoSubgrouping    : VerbatimLineCommand<"nosubgrouping">;
-def PrivateSection   : VerbatimLineCommand<"privatesection">;
-def ProtectedSection : VerbatimLineCommand<"protectedsection">;
-def PublicSection    : VerbatimLineCommand<"publicsection">;
-
 // We might also build proper support for if/ifnot/else/elseif/endif.
 def If     : VerbatimLineCommand<"if">;
 def IfNot  : VerbatimLineCommand<"ifnot">;
@@ -311,6 +291,32 @@ def Endif  : VerbatimLineCommand<"endif">;
 def Cond    : VerbatimLineCommand<"cond">;
 def EndCond : VerbatimLineCommand<"endcond">;
 
+//===----------------------------------------------------------------------===//
+// PropertyCommand
+//===----------------------------------------------------------------------===//
+
+def CallGraph       : PropertyCommand<"callgraph">;
+def HideCallGraph   : PropertyCommand<"hidecallgraph">;
+def CallerGraph     : PropertyCommand<"callergraph">;
+def HideCallerGraph : PropertyCommand<"hidecallergraph">;
+def ShowInitializer : PropertyCommand<"showinitializer">;
+def HideInitializer : PropertyCommand<"hideinitializer">;
+def ShowRefBy       : PropertyCommand<"showrefby">;
+def HideRefBy       : PropertyCommand<"hiderefby">;
+def ShowRefs        : PropertyCommand<"showrefs">;
+def HideRefs        : PropertyCommand<"hiderefs">;
+
+def Private   : PropertyCommand<"private">;
+def Protected : PropertyCommand<"protected">;
+def Public    : PropertyCommand<"public">;
+def Pure      : PropertyCommand<"pure">;
+def Static    : PropertyCommand<"static">;
+
+def NoSubgrouping    : PropertyCommand<"nosubgrouping">;
+def PrivateSection   : PropertyCommand<"privatesection">;
+def ProtectedSection : PropertyCommand<"protectedsection">;
+def PublicSection    : PropertyCommand<"publicsection">;
+
 //===----------------------------------------------------------------------===//
 // DeclarationVerbatimLineCommand
 //===----------------------------------------------------------------------===//


        


More information about the cfe-commits mailing list