Skip to content

Commit d2396d8

Browse files
committed
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
1 parent d3a4033 commit d2396d8

File tree

1 file changed

+31
-25
lines changed

1 file changed

+31
-25
lines changed

clang/include/clang/AST/CommentCommands.td

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ class VerbatimLineCommand<string name> : Command<name> {
6363
let IsVerbatimLineCommand = 1;
6464
}
6565

66+
class PropertyCommand<string name> : Command<name> {
67+
let NumArgs = 0;
68+
let IsInlineCommand = 1;
69+
}
70+
6671
class DeclarationVerbatimLineCommand<string name> :
6772
VerbatimLineCommand<name> {
6873
let IsDeclarationCommand = 1;
@@ -275,31 +280,6 @@ def Until : VerbatimLineCommand<"until">;
275280

276281
def NoOp : VerbatimLineCommand<"noop">;
277282

278-
// These have actually no arguments, but we can treat them as line commands.
279-
def CallGraph : VerbatimLineCommand<"callgraph">;
280-
def HideCallGraph : VerbatimLineCommand<"hidecallgraph">;
281-
def CallerGraph : VerbatimLineCommand<"callergraph">;
282-
def HideCallerGraph : VerbatimLineCommand<"hidecallergraph">;
283-
def ShowInitializer : VerbatimLineCommand<"showinitializer">;
284-
def HideInitializer : VerbatimLineCommand<"hideinitializer">;
285-
def ShowRefBy : VerbatimLineCommand<"showrefby">;
286-
def HideRefBy : VerbatimLineCommand<"hiderefby">;
287-
def ShowRefs : VerbatimLineCommand<"showrefs">;
288-
def HideRefs : VerbatimLineCommand<"hiderefs">;
289-
290-
// These also have no argument.
291-
def Private : VerbatimLineCommand<"private">;
292-
def Protected : VerbatimLineCommand<"protected">;
293-
def Public : VerbatimLineCommand<"public">;
294-
def Pure : VerbatimLineCommand<"pure">;
295-
def Static : VerbatimLineCommand<"static">;
296-
297-
// These also have no argument.
298-
def NoSubgrouping : VerbatimLineCommand<"nosubgrouping">;
299-
def PrivateSection : VerbatimLineCommand<"privatesection">;
300-
def ProtectedSection : VerbatimLineCommand<"protectedsection">;
301-
def PublicSection : VerbatimLineCommand<"publicsection">;
302-
303283
// We might also build proper support for if/ifnot/else/elseif/endif.
304284
def If : VerbatimLineCommand<"if">;
305285
def IfNot : VerbatimLineCommand<"ifnot">;
@@ -311,6 +291,32 @@ def Endif : VerbatimLineCommand<"endif">;
311291
def Cond : VerbatimLineCommand<"cond">;
312292
def EndCond : VerbatimLineCommand<"endcond">;
313293

294+
//===----------------------------------------------------------------------===//
295+
// PropertyCommand
296+
//===----------------------------------------------------------------------===//
297+
298+
def CallGraph : PropertyCommand<"callgraph">;
299+
def HideCallGraph : PropertyCommand<"hidecallgraph">;
300+
def CallerGraph : PropertyCommand<"callergraph">;
301+
def HideCallerGraph : PropertyCommand<"hidecallergraph">;
302+
def ShowInitializer : PropertyCommand<"showinitializer">;
303+
def HideInitializer : PropertyCommand<"hideinitializer">;
304+
def ShowRefBy : PropertyCommand<"showrefby">;
305+
def HideRefBy : PropertyCommand<"hiderefby">;
306+
def ShowRefs : PropertyCommand<"showrefs">;
307+
def HideRefs : PropertyCommand<"hiderefs">;
308+
309+
def Private : PropertyCommand<"private">;
310+
def Protected : PropertyCommand<"protected">;
311+
def Public : PropertyCommand<"public">;
312+
def Pure : PropertyCommand<"pure">;
313+
def Static : PropertyCommand<"static">;
314+
315+
def NoSubgrouping : PropertyCommand<"nosubgrouping">;
316+
def PrivateSection : PropertyCommand<"privatesection">;
317+
def ProtectedSection : PropertyCommand<"protectedsection">;
318+
def PublicSection : PropertyCommand<"publicsection">;
319+
314320
//===----------------------------------------------------------------------===//
315321
// DeclarationVerbatimLineCommand
316322
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)