clang 10.0.0git

Comment.h
Go to the documentation of this file.
1 //===--- Comment.h - Comment AST nodes --------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines comment AST nodes.
10 //
11 //===----------------------------------------------------------------------===//
12
13 #ifndef LLVM_CLANG_AST_COMMENT_H
14 #define LLVM_CLANG_AST_COMMENT_H
15
16 #include "clang/AST/CommentCommandTraits.h"
17 #include "clang/AST/DeclObjC.h"
18 #include "clang/AST/Type.h"
19 #include "clang/Basic/SourceLocation.h"
20 #include "llvm/ADT/ArrayRef.h"
21 #include "llvm/ADT/StringRef.h"
22
23 namespace clang {
24 class Decl;
25 class ParmVarDecl;
26 class TemplateParameterList;
27
28 namespace comments {
29 class FullComment;
30
31 /// Describes the syntax that was used in a documentation command.
32 ///
33 /// Exact values of this enumeration are important because they used to select
34 /// parts of diagnostic messages. Audit diagnostics before changing or adding
35 /// a new value.
36 enum CommandMarkerKind {
37 /// Command started with a backslash character:
38 /// \code
39 /// \foo
40 /// \endcode
41 CMK_Backslash = 0,
42
43 /// Command started with an 'at' character:
44 /// \code
45 /// @foo
46 /// \endcode
47 CMK_At = 1
48 };
49
50 /// Any part of the comment.
51 /// Abstract class.
52 class Comment {
53 protected:
54 /// Preferred location to show caret.
55 SourceLocation Loc;
56
57 /// Source range of this AST node.
58 SourceRange Range;
59
60 class CommentBitfields {
61 friend class Comment;
62
63 /// Type of this AST node.
64 unsigned Kind : 8;
65 };
66 enum { NumCommentBits = 8 };
67
68 class InlineContentCommentBitfields {
69 friend class InlineContentComment;
70
71 unsigned : NumCommentBits;
72
73 /// True if there is a newline after this inline content node.
74 /// (There is no separate AST node for a newline.)
75 unsigned HasTrailingNewline : 1;
76 };
77 enum { NumInlineContentCommentBits = NumCommentBits + 1 };
78
79 class TextCommentBitfields {
80 friend class TextComment;
81
82 unsigned : NumInlineContentCommentBits;
83
84 /// True if \c IsWhitespace field contains a valid value.
85 mutable unsigned IsWhitespaceValid : 1;
86
87 /// True if this comment AST node contains only whitespace.
88 mutable unsigned IsWhitespace : 1;
89 };
90 enum { NumTextCommentBits = NumInlineContentCommentBits + 2 };
91
92 class InlineCommandCommentBitfields {
93 friend class InlineCommandComment;
94
95 unsigned : NumInlineContentCommentBits;
96
97 unsigned RenderKind : 3;
98
99 unsigned CommandID : CommandInfo::NumCommandIDBits;
100 };
101 enum { NumInlineCommandCommentBits = NumInlineContentCommentBits + 3 +
102 CommandInfo::NumCommandIDBits };
103
104 class HTMLTagCommentBitfields {
105 friend class HTMLTagComment;
106
107 unsigned : NumInlineContentCommentBits;
108
109 /// True if we found that this tag is malformed in some way.
110 unsigned IsMalformed : 1;
111 };
112 enum { NumHTMLTagCommentBits = NumInlineContentCommentBits + 1 };
113
114 class HTMLStartTagCommentBitfields {
115 friend class HTMLStartTagComment;
116
117 unsigned : NumHTMLTagCommentBits;
118
119 /// True if this tag is self-closing (e. g., <br />). This is based on tag
120 /// spelling in comment (plain <br> would not set this flag).
121 unsigned IsSelfClosing : 1;
122 };
123 enum { NumHTMLStartTagCommentBits = NumHTMLTagCommentBits + 1 };
124
125 class ParagraphCommentBitfields {
126 friend class ParagraphComment;
127
128 unsigned : NumCommentBits;
129
130 /// True if \c IsWhitespace field contains a valid value.
131 mutable unsigned IsWhitespaceValid : 1;
132
133 /// True if this comment AST node contains only whitespace.
134 mutable unsigned IsWhitespace : 1;
135 };
136 enum { NumParagraphCommentBits = NumCommentBits + 2 };
137
138 class BlockCommandCommentBitfields {
139 friend class BlockCommandComment;
140
141 unsigned : NumCommentBits;
142
143 unsigned CommandID : CommandInfo::NumCommandIDBits;
144
145 /// Describes the syntax that was used in a documentation command.
146 /// Contains values from CommandMarkerKind enum.
147 unsigned CommandMarker : 1;
148 };
149 enum { NumBlockCommandCommentBits = NumCommentBits +
150 CommandInfo::NumCommandIDBits + 1 };
151
152 class ParamCommandCommentBitfields {
153 friend class ParamCommandComment;
154
155 unsigned : NumBlockCommandCommentBits;
156
157 /// Parameter passing direction, see ParamCommandComment::PassDirection.
158 unsigned Direction : 2;
159
160 /// True if direction was specified explicitly in the comment.
161 unsigned IsDirectionExplicit : 1;
162 };
163 enum { NumParamCommandCommentBits = NumBlockCommandCommentBits + 3 };
164
165 union {
166 CommentBitfields CommentBits;
167 InlineContentCommentBitfields InlineContentCommentBits;
168 TextCommentBitfields TextCommentBits;
169 InlineCommandCommentBitfields InlineCommandCommentBits;
170 HTMLTagCommentBitfields HTMLTagCommentBits;
171 HTMLStartTagCommentBitfields HTMLStartTagCommentBits;
172 ParagraphCommentBitfields ParagraphCommentBits;
173 BlockCommandCommentBitfields BlockCommandCommentBits;
174 ParamCommandCommentBitfields ParamCommandCommentBits;
175 };
176
177 void setSourceRange(SourceRange SR) {
178 Range = SR;
179 }
180
181 void setLocation(SourceLocation L) {
182 Loc = L;
183 }
184
185 public:
186 enum CommentKind {
187 NoCommentKind = 0,
188 #define COMMENT(CLASS, PARENT) CLASS##Kind,
189 #define COMMENT_RANGE(BASE, FIRST, LAST) \
190 First##BASE##Constant=FIRST##Kind, Last##BASE##Constant=LAST##Kind,
191 #define LAST_COMMENT_RANGE(BASE, FIRST, LAST) \
192 First##BASE##Constant=FIRST##Kind, Last##BASE##Constant=LAST##Kind
193 #define ABSTRACT_COMMENT(COMMENT)
194 #include "clang/AST/CommentNodes.inc"
195 };
196
197 Comment(CommentKind K,
198 SourceLocation LocBegin,
199 SourceLocation LocEnd) :
200 Loc(LocBegin), Range(SourceRange(LocBegin, LocEnd)) {
201 CommentBits.Kind = K;
202 }
203
204 CommentKind getCommentKind() const {
205 return static_cast<CommentKind>(CommentBits.Kind);
206 }
207
208 const char *getCommentKindName() const;
209
210 void dump() const;
211 void dumpColor() const;
212 void dump(const ASTContext &Context) const;
213 void dump(raw_ostream &OS, const CommandTraits *Traits,
214 const SourceManager *SM) const;
215
216 SourceRange getSourceRange() const LLVM_READONLY { return Range; }
217
218 SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
219
220 SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
221
222 SourceLocation getLocation() const LLVM_READONLY { return Loc; }
223
224 typedef Comment * const *child_iterator;
225
226 child_iterator child_begin() const;
227 child_iterator child_end() const;
228
229 // TODO: const child iterator
230
231 unsigned child_count() const {
232 return child_end() - child_begin();
233 }
234 };
235
236 /// Inline content (contained within a block).
237 /// Abstract class.
238 class InlineContentComment : public Comment {
239 protected:
240 InlineContentComment(CommentKind K,
241 SourceLocation LocBegin,
242 SourceLocation LocEnd) :
243 Comment(K, LocBegin, LocEnd) {
244 InlineContentCommentBits.HasTrailingNewline = 0;
245 }
246
247 public:
248 static bool classof(const Comment *C) {
249 return C->getCommentKind() >= FirstInlineContentCommentConstant &&
250 C->getCommentKind() <= LastInlineContentCommentConstant;
251 }
252
253 void addTrailingNewline() {
254 InlineContentCommentBits.HasTrailingNewline = 1;
255 }
256
257 bool hasTrailingNewline() const {
258 return InlineContentCommentBits.HasTrailingNewline;
259 }
260 };
261
262 /// Plain text.
263 class TextComment : public InlineContentComment {
264 StringRef Text;
265
266 public:
267 TextComment(SourceLocation LocBegin,
268 SourceLocation LocEnd,
269 StringRef Text) :
270 InlineContentComment(TextCommentKind, LocBegin, LocEnd),
271 Text(Text) {
272 TextCommentBits.IsWhitespaceValid = false;
273 }
274
275 static bool classof(const Comment *C) {
276 return C->getCommentKind() == TextCommentKind;
277 }
278
279 child_iterator child_begin() const { return nullptr; }
280
281 child_iterator child_end() const { return nullptr; }
282
283 StringRef getText() const LLVM_READONLY { return Text; }
284
285 bool isWhitespace() const {
286 if (TextCommentBits.IsWhitespaceValid)
287 return TextCommentBits.IsWhitespace;
288
289 TextCommentBits.IsWhitespace = isWhitespaceNoCache();
290 TextCommentBits.IsWhitespaceValid = true;
291 return TextCommentBits.IsWhitespace;
292 }
293
294 private:
295 bool isWhitespaceNoCache() const;
296 };
297
298 /// A command with word-like arguments that is considered inline content.
299 class InlineCommandComment : public InlineContentComment {
300 public:
301 struct Argument {
302 SourceRange Range;
303 StringRef Text;
304
305 Argument(SourceRange Range, StringRef Text) : Range(Range), Text(Text) { }
306 };
307
308 /// The most appropriate rendering mode for this command, chosen on command
309 /// semantics in Doxygen.
310 enum RenderKind {
311 RenderNormal,
312 RenderBold,
313 RenderMonospaced,
314 RenderEmphasized,
315 RenderAnchor
316 };
317
318 protected:
319 /// Command arguments.
320 ArrayRef<Argument> Args;
321
322 public:
323 InlineCommandComment(SourceLocation LocBegin,
324 SourceLocation LocEnd,
325 unsigned CommandID,
326 RenderKind RK,
327 ArrayRef<Argument> Args) :
328 InlineContentComment(InlineCommandCommentKind, LocBegin, LocEnd),
329 Args(Args) {
330 InlineCommandCommentBits.RenderKind = RK;
331 InlineCommandCommentBits.CommandID = CommandID;
332 }
333
334 static bool classof(const Comment *C) {
335 return C->getCommentKind() == InlineCommandCommentKind;
336 }
337
338 child_iterator child_begin() const { return nullptr; }
339
340 child_iterator child_end() const { return nullptr; }
341
342 unsigned getCommandID() const {
343 return InlineCommandCommentBits.CommandID;
344 }
345
346 StringRef getCommandName(const CommandTraits &Traits) const {
347 return Traits.getCommandInfo(getCommandID())->Name;
348 }
349
350 SourceRange getCommandNameRange() const {
351 return SourceRange(getBeginLoc().getLocWithOffset(-1), getEndLoc());
352 }
353
354 RenderKind getRenderKind() const {
355 return static_cast<RenderKind>(InlineCommandCommentBits.RenderKind);
356 }
357
358 unsigned getNumArgs() const {
359 return Args.size();
360 }
361
362 StringRef getArgText(unsigned Idx) const {
363 return Args[Idx].Text;
364 }
365
366 SourceRange getArgRange(unsigned Idx) const {
367 return Args[Idx].Range;
368 }
369 };
370
371 /// Abstract class for opening and closing HTML tags. HTML tags are always
372 /// treated as inline content (regardless HTML semantics).
373 class HTMLTagComment : public InlineContentComment {
374 protected:
375 StringRef TagName;
376 SourceRange TagNameRange;
377
378 HTMLTagComment(CommentKind K,
379 SourceLocation LocBegin,
380 SourceLocation LocEnd,
381 StringRef TagName,
382 SourceLocation TagNameBegin,
383 SourceLocation TagNameEnd) :
384 InlineContentComment(K, LocBegin, LocEnd),
385 TagName(TagName),
386 TagNameRange(TagNameBegin, TagNameEnd) {
387 setLocation(TagNameBegin);
388 HTMLTagCommentBits.IsMalformed = 0;
389 }
390
391 public:
392 static bool classof(const Comment *C) {
393 return C->getCommentKind() >= FirstHTMLTagCommentConstant &&
394 C->getCommentKind() <= LastHTMLTagCommentConstant;
395 }
396
397 StringRef getTagName() const LLVM_READONLY { return TagName; }
398
399 SourceRange getTagNameSourceRange() const LLVM_READONLY {
400 SourceLocation L = getLocation();
401 return SourceRange(L.getLocWithOffset(1),
402 L.getLocWithOffset(1 + TagName.size()));
403 }
404
405 bool isMalformed() const {
406 return HTMLTagCommentBits.IsMalformed;
407 }
408
409 void setIsMalformed() {
410 HTMLTagCommentBits.IsMalformed = 1;
411 }
412 };
413
414 /// An opening HTML tag with attributes.
415 class HTMLStartTagComment : public HTMLTagComment {
416 public:
417 class Attribute {
418 public:
419 SourceLocation NameLocBegin;
420 StringRef Name;
421
422 SourceLocation EqualsLoc;
423
424 SourceRange ValueRange;
425 StringRef Value;
426
427 Attribute() { }
428
429 Attribute(SourceLocation NameLocBegin, StringRef Name) :
430 NameLocBegin(NameLocBegin), Name(Name),
431 EqualsLoc(SourceLocation()),
432 ValueRange(SourceRange()), Value(StringRef())
433 { }
434
435 Attribute(SourceLocation NameLocBegin, StringRef Name,
436 SourceLocation EqualsLoc,
437 SourceRange ValueRange, StringRef Value) :
438 NameLocBegin(NameLocBegin), Name(Name),
439 EqualsLoc(EqualsLoc),
440 ValueRange(ValueRange), Value(Value)
441 { }
442
443 SourceLocation getNameLocEnd() const {
444 return NameLocBegin.getLocWithOffset(Name.size());
445 }
446
447 SourceRange getNameRange() const {
448 return SourceRange(NameLocBegin, getNameLocEnd());
449 }
450 };
451
452 private:
453 ArrayRef<Attribute> Attributes;
454
455 public:
456 HTMLStartTagComment(SourceLocation LocBegin,
457 StringRef TagName) :
458 HTMLTagComment(HTMLStartTagCommentKind,
459 LocBegin, LocBegin.getLocWithOffset(1 + TagName.size()),
460 TagName,
461 LocBegin.getLocWithOffset(1),
462 LocBegin.getLocWithOffset(1 + TagName.size())) {
463 HTMLStartTagCommentBits.IsSelfClosing = false;
464 }
465
466 static bool classof(const Comment *C) {
467 return C->getCommentKind() == HTMLStartTagCommentKind;
468 }
469
470 child_iterator child_begin() const { return nullptr; }
471
472 child_iterator child_end() const { return nullptr; }
473
474 unsigned getNumAttrs() const {
475 return Attributes.size();
476 }
477
478 const Attribute &getAttr(unsigned Idx) const {
479 return Attributes[Idx];
480 }
481
482 void setAttrs(ArrayRef<Attribute> Attrs) {
483 Attributes = Attrs;
484 if (!Attrs.empty()) {
485 const Attribute &Attr = Attrs.back();
486 SourceLocation L = Attr.ValueRange.getEnd();
487 if (L.isValid())
488 Range.setEnd(L);
489 else {
490 Range.setEnd(Attr.getNameLocEnd());
491 }
492 }
493 }
494
495 void setGreaterLoc(SourceLocation GreaterLoc) {
496 Range.setEnd(GreaterLoc);
497 }
498
499 bool isSelfClosing() const {
500 return HTMLStartTagCommentBits.IsSelfClosing;
501 }
502
503 void setSelfClosing() {
504 HTMLStartTagCommentBits.IsSelfClosing = true;
505 }
506 };
507
508 /// A closing HTML tag.
509 class HTMLEndTagComment : public HTMLTagComment {
510 public:
511 HTMLEndTagComment(SourceLocation LocBegin,
512 SourceLocation LocEnd,
513 StringRef TagName) :
514 HTMLTagComment(HTMLEndTagCommentKind,
515 LocBegin, LocEnd,
516 TagName,
517 LocBegin.getLocWithOffset(2),
518 LocBegin.getLocWithOffset(2 + TagName.size()))
519 { }
520
521 static bool classof(const Comment *C) {
522 return C->getCommentKind() == HTMLEndTagCommentKind;
523 }
524
525 child_iterator child_begin() const { return nullptr; }
526
527 child_iterator child_end() const { return nullptr; }
528 };
529
530 /// Block content (contains inline content).
531 /// Abstract class.
532 class BlockContentComment : public Comment {
533 protected:
534 BlockContentComment(CommentKind K,
535 SourceLocation LocBegin,
536 SourceLocation LocEnd) :
537 Comment(K, LocBegin, LocEnd)
538 { }
539
540 public:
541 static bool classof(const Comment *C) {
542 return C->getCommentKind() >= FirstBlockContentCommentConstant &&
543 C->getCommentKind() <= LastBlockContentCommentConstant;
544 }
545 };
546
547 /// A single paragraph that contains inline content.
548 class ParagraphComment : public BlockContentComment {
549 ArrayRef<InlineContentComment *> Content;
550
551 public:
552 ParagraphComment(ArrayRef<InlineContentComment *> Content) :
553 BlockContentComment(ParagraphCommentKind,
554 SourceLocation(),
555 SourceLocation()),
556 Content(Content) {
557 if (Content.empty()) {
558 ParagraphCommentBits.IsWhitespace = true;
559 ParagraphCommentBits.IsWhitespaceValid = true;
560 return;
561 }
562
563 ParagraphCommentBits.IsWhitespaceValid = false;
564
565 setSourceRange(SourceRange(Content.front()->getBeginLoc(),
566 Content.back()->getEndLoc()));
567 setLocation(Content.front()->getBeginLoc());
568 }
569
570 static bool classof(const Comment *C) {
571 return C->getCommentKind() == ParagraphCommentKind;
572 }
573
574 child_iterator child_begin() const {
575 return reinterpret_cast<child_iterator>(Content.begin());
576 }
577
578 child_iterator child_end() const {
579 return reinterpret_cast<child_iterator>(Content.end());
580 }
581
582 bool isWhitespace() const {
583 if (ParagraphCommentBits.IsWhitespaceValid)
584 return ParagraphCommentBits.IsWhitespace;
585
586 ParagraphCommentBits.IsWhitespace = isWhitespaceNoCache();
587 ParagraphCommentBits.IsWhitespaceValid = true;
588 return ParagraphCommentBits.IsWhitespace;
589 }
590
591 private:
592 bool isWhitespaceNoCache() const;
593 };
594
595 /// A command that has zero or more word-like arguments (number of word-like
596 /// arguments depends on command name) and a paragraph as an argument
597 /// (e. g., \\brief).
598 class BlockCommandComment : public BlockContentComment {
599 public:
600 struct Argument {
601 SourceRange Range;
602 StringRef Text;
603
604 Argument() { }
605 Argument(SourceRange Range, StringRef Text) : Range(Range), Text(Text) { }
606 };
607
608 protected:
609 /// Word-like arguments.
610 ArrayRef<Argument> Args;
611
612 /// Paragraph argument.
613 ParagraphComment *Paragraph;
614
615 BlockCommandComment(CommentKind K,
616 SourceLocation LocBegin,
617 SourceLocation LocEnd,
618 unsigned CommandID,
619 CommandMarkerKind CommandMarker) :
620 BlockContentComment(K, LocBegin, LocEnd),
621 Paragraph(nullptr) {
622 setLocation(getCommandNameBeginLoc());
623 BlockCommandCommentBits.CommandID = CommandID;
624 BlockCommandCommentBits.CommandMarker = CommandMarker;
625 }
626
627 public:
628 BlockCommandComment(SourceLocation LocBegin,
629 SourceLocation LocEnd,
630 unsigned CommandID,
631 CommandMarkerKind CommandMarker) :
632 BlockContentComment(BlockCommandCommentKind, LocBegin, LocEnd),
633 Paragraph(nullptr) {
634 setLocation(getCommandNameBeginLoc());
635 BlockCommandCommentBits.CommandID = CommandID;
636 BlockCommandCommentBits.CommandMarker = CommandMarker;
637 }
638
639 static bool classof(const Comment *C) {
640 return C->getCommentKind() >= FirstBlockCommandCommentConstant &&
641 C->getCommentKind() <= LastBlockCommandCommentConstant;
642 }
643
644 child_iterator child_begin() const {
645 return reinterpret_cast<child_iterator>(&Paragraph);
646 }
647
648 child_iterator child_end() const {
649 return reinterpret_cast<child_iterator>(&Paragraph + 1);
650 }
651
652 unsigned getCommandID() const {
653 return BlockCommandCommentBits.CommandID;
654 }
655
656 StringRef getCommandName(const CommandTraits &Traits) const {
657 return Traits.getCommandInfo(getCommandID())->Name;
658 }
659
660 SourceLocation getCommandNameBeginLoc() const {
661 return getBeginLoc().getLocWithOffset(1);
662 }
663
664 SourceRange getCommandNameRange(const CommandTraits &Traits) const {
665 StringRef Name = getCommandName(Traits);
666 return SourceRange(getCommandNameBeginLoc(),
667 getBeginLoc().getLocWithOffset(1 + Name.size()));
668 }
669
670 unsigned getNumArgs() const {
671 return Args.size();
672 }
673
674 StringRef getArgText(unsigned Idx) const {
675 return Args[Idx].Text;
676 }
677
678 SourceRange getArgRange(unsigned Idx) const {
679 return Args[Idx].Range;
680 }
681
682 void setArgs(ArrayRef<Argument> A) {
683 Args = A;
684 if (Args.size() > 0) {
685 SourceLocation NewLocEnd = Args.back().Range.getEnd();
686 if (NewLocEnd.isValid())
687 setSourceRange(SourceRange(getBeginLoc(), NewLocEnd));
688 }
689 }
690
691 ParagraphComment *getParagraph() const LLVM_READONLY {
692 return Paragraph;
693 }
694
695 bool hasNonWhitespaceParagraph() const {
696 return Paragraph && !Paragraph->isWhitespace();
697 }
698
699 void setParagraph(ParagraphComment *PC) {
700 Paragraph = PC;
701 SourceLocation NewLocEnd = PC->getEndLoc();
702 if (NewLocEnd.isValid())
703 setSourceRange(SourceRange(getBeginLoc(), NewLocEnd));
704 }
705
706 CommandMarkerKind getCommandMarker() const LLVM_READONLY {
707 return static_cast<CommandMarkerKind>(
708 BlockCommandCommentBits.CommandMarker);
709 }
710 };
711
712 /// Doxygen \\param command.
713 class ParamCommandComment : public BlockCommandComment {
714 private:
715 /// Parameter index in the function declaration.
716 unsigned ParamIndex;
717
718 public:
719 enum : unsigned {
720 InvalidParamIndex = ~0U,
721 VarArgParamIndex = ~0U/*InvalidParamIndex*/ - 1U
722 };
723
724 ParamCommandComment(SourceLocation LocBegin,
725 SourceLocation LocEnd,
726 unsigned CommandID,
727 CommandMarkerKind CommandMarker) :
728 BlockCommandComment(ParamCommandCommentKind, LocBegin, LocEnd,
729 CommandID, CommandMarker),
730 ParamIndex(InvalidParamIndex) {
731 ParamCommandCommentBits.Direction = In;
732 ParamCommandCommentBits.IsDirectionExplicit = false;
733 }
734
735 static bool classof(const Comment *C) {
736 return C->getCommentKind() == ParamCommandCommentKind;
737 }
738
739 enum PassDirection {
740 In,
741 Out,
742 InOut
743 };
744
745 static const char *getDirectionAsString(PassDirection D);
746
747 PassDirection getDirection() const LLVM_READONLY {
748 return static_cast<PassDirection>(ParamCommandCommentBits.Direction);
749 }
750
751 bool isDirectionExplicit() const LLVM_READONLY {
752 return ParamCommandCommentBits.IsDirectionExplicit;
753 }
754
755 void setDirection(PassDirection Direction, bool Explicit) {
756 ParamCommandCommentBits.Direction = Direction;
757 ParamCommandCommentBits.IsDirectionExplicit = Explicit;
758 }
759
760 bool hasParamName() const {
761 return getNumArgs() > 0;
762 }
763
764 StringRef getParamName(const FullComment *FC) const;
765
766 StringRef getParamNameAsWritten() const {
767 return Args[0].Text;
768 }
769
770 SourceRange getParamNameRange() const {
771 return Args[0].Range;
772 }
773
774 bool isParamIndexValid() const LLVM_READONLY {
775 return ParamIndex != InvalidParamIndex;
776 }
777
778 bool isVarArgParam() const LLVM_READONLY {
779 return ParamIndex == VarArgParamIndex;
780 }
781
782 void setIsVarArgParam() {
783 ParamIndex = VarArgParamIndex;
784 assert(isParamIndexValid());
785 }
786
787 unsigned getParamIndex() const LLVM_READONLY {
788 assert(isParamIndexValid());
789 assert(!isVarArgParam());
790 return ParamIndex;
791 }
792
793 void setParamIndex(unsigned Index) {
794 ParamIndex = Index;
795 assert(isParamIndexValid());
796 assert(!isVarArgParam());
797 }
798 };
799
800 /// Doxygen \\tparam command, describes a template parameter.
801 class TParamCommandComment : public BlockCommandComment {
802 private:
803 /// If this template parameter name was resolved (found in template parameter
804 /// list), then this stores a list of position indexes in all template
805 /// parameter lists.
806 ///
807 /// For example:
808 /// \verbatim
809 /// template<typename C, template<typename T> class TT>
810 /// void test(TT<int> aaa);
811 /// \endverbatim
812 /// For C: Position = { 0 }
813 /// For TT: Position = { 1 }
814 /// For T: Position = { 1, 0 }
815 ArrayRef<unsigned> Position;
816
817 public:
818 TParamCommandComment(SourceLocation LocBegin,
819 SourceLocation LocEnd,
820 unsigned CommandID,
821 CommandMarkerKind CommandMarker) :
822 BlockCommandComment(TParamCommandCommentKind, LocBegin, LocEnd, CommandID,
823 CommandMarker)
824 { }
825
826 static bool classof(const Comment *C) {
827 return C->getCommentKind() == TParamCommandCommentKind;
828 }
829
830 bool hasParamName() const {
831 return getNumArgs() > 0;
832 }
833
834 StringRef getParamName(const FullComment *FC) const;
835
836 StringRef getParamNameAsWritten() const {
837 return Args[0].Text;
838 }
839
840 SourceRange getParamNameRange() const {
841 return Args[0].Range;
842 }
843
844 bool isPositionValid() const LLVM_READONLY {
845 return !Position.empty();
846 }
847
848 unsigned getDepth() const {
849 assert(isPositionValid());
850 return Position.size();
851 }
852
853 unsigned getIndex(unsigned Depth) const {
854 assert(isPositionValid());
855 return Position[Depth];
856 }
857
858 void setPosition(ArrayRef<unsigned> NewPosition) {
859 Position = NewPosition;
860 assert(isPositionValid());
861 }
862 };
863
864 /// A line of text contained in a verbatim block.
865 class VerbatimBlockLineComment : public Comment {
866 StringRef Text;
867
868 public:
869 VerbatimBlockLineComment(SourceLocation LocBegin,
870 StringRef Text) :
871 Comment(VerbatimBlockLineCommentKind,
872 LocBegin,
873 LocBegin.getLocWithOffset(Text.size())),
874 Text(Text)
875 { }
876
877 static bool classof(const Comment *C) {
878 return C->getCommentKind() == VerbatimBlockLineCommentKind;
879 }
880
881 child_iterator child_begin() const { return nullptr; }
882
883 child_iterator child_end() const { return nullptr; }
884
885 StringRef getText() const LLVM_READONLY {
886 return Text;
887 }
888 };
889
890 /// A verbatim block command (e. g., preformatted code). Verbatim block has an
891 /// opening and a closing command and contains multiple lines of text
892 /// (VerbatimBlockLineComment nodes).
893 class VerbatimBlockComment : public BlockCommandComment {
894 protected:
895 StringRef CloseName;
896 SourceLocation CloseNameLocBegin;
897 ArrayRef<VerbatimBlockLineComment *> Lines;
898
899 public:
900 VerbatimBlockComment(SourceLocation LocBegin,
901 SourceLocation LocEnd,
902 unsigned CommandID) :
903 BlockCommandComment(VerbatimBlockCommentKind,
904 LocBegin, LocEnd, CommandID,
905 CMK_At) // FIXME: improve source fidelity.
906 { }
907
908 static bool classof(const Comment *C) {
909 return C->getCommentKind() == VerbatimBlockCommentKind;
910 }
911
912 child_iterator child_begin() const {
913 return reinterpret_cast<child_iterator>(Lines.begin());
914 }
915
916 child_iterator child_end() const {
917 return reinterpret_cast<child_iterator>(Lines.end());
918 }
919
920 void setCloseName(StringRef Name, SourceLocation LocBegin) {
921 CloseName = Name;
922 CloseNameLocBegin = LocBegin;
923 }
924
925 void setLines(ArrayRef<VerbatimBlockLineComment *> L) {
926 Lines = L;
927 }
928
929 StringRef getCloseName() const {
930 return CloseName;
931 }
932
933 unsigned getNumLines() const {
934 return Lines.size();
935 }
936
937 StringRef getText(unsigned LineIdx) const {
938 return Lines[LineIdx]->getText();
939 }
940 };
941
942 /// A verbatim line command. Verbatim line has an opening command, a single
943 /// line of text (up to the newline after the opening command) and has no
944 /// closing command.
945 class VerbatimLineComment : public BlockCommandComment {
946 protected:
947 StringRef Text;
948 SourceLocation TextBegin;
949
950 public:
951 VerbatimLineComment(SourceLocation LocBegin,
952 SourceLocation LocEnd,
953 unsigned CommandID,
954 SourceLocation TextBegin,
955 StringRef Text) :
956 BlockCommandComment(VerbatimLineCommentKind,
957 LocBegin, LocEnd,
958 CommandID,
959 CMK_At), // FIXME: improve source fidelity.
960 Text(Text),
961 TextBegin(TextBegin)
962 { }
963
964 static bool classof(const Comment *C) {
965 return C->getCommentKind() == VerbatimLineCommentKind;
966 }
967
968 child_iterator child_begin() const { return nullptr; }
969
970 child_iterator child_end() const { return nullptr; }
971
972 StringRef getText() const {
973 return Text;
974 }
975
976 SourceRange getTextRange() const {
977 return SourceRange(TextBegin, getEndLoc());
978 }
979 };
980
981 /// Information about the declaration, useful to clients of FullComment.
982 struct DeclInfo {
983 /// Declaration the comment is actually attached to (in the source).
984 /// Should not be NULL.
985 const Decl *CommentDecl;
986
987 /// CurrentDecl is the declaration with which the FullComment is associated.
988 ///
989 /// It can be different from \c CommentDecl. It happens when we decide
990 /// that the comment originally attached to \c CommentDecl is fine for
991 /// \c CurrentDecl too (for example, for a redeclaration or an overrider of
992 /// \c CommentDecl).
993 ///
994 /// The information in the DeclInfo corresponds to CurrentDecl.
995 const Decl *CurrentDecl;
996
997 /// Parameters that can be referenced by \\param if \c CommentDecl is something
998 /// that we consider a "function".
999 ArrayRef<const ParmVarDecl *> ParamVars;
1000
1001 /// Function return type if \c CommentDecl is something that we consider
1002 /// a "function".
1003 QualType ReturnType;
1004
1005 /// Template parameters that can be referenced by \\tparam if \c CommentDecl is
1006 /// a template (\c IsTemplateDecl or \c IsTemplatePartialSpecialization is
1007 /// true).
1008 const TemplateParameterList *TemplateParameters;
1009
1010 /// A simplified description of \c CommentDecl kind that should be good enough
1011 /// for documentation rendering purposes.
1012 enum DeclKind {
1013 /// Everything else not explicitly mentioned below.
1014 OtherKind,
1015
1016 /// Something that we consider a "function":
1017 /// \li function,
1018 /// \li function template,
1019 /// \li function template specialization,
1020 /// \li member function,
1021 /// \li member function template,
1022 /// \li member function template specialization,
1023 /// \li ObjC method,
1024 /// \li a typedef for a function pointer, member function pointer,
1025 /// ObjC block.
1026 FunctionKind,
1027
1028 /// Something that we consider a "class":
1029 /// \li class/struct,
1030 /// \li class template,
1031 /// \li class template (partial) specialization.
1032 ClassKind,
1033
1034 /// Something that we consider a "variable":
1035 /// \li namespace scope variables;
1036 /// \li static and non-static class data members;
1037 /// \li enumerators.
1038 VariableKind,
1039
1040 /// A C++ namespace.
1041 NamespaceKind,
1042
1043 /// A C++ typedef-name (a 'typedef' decl specifier or alias-declaration),
1044 /// see \c TypedefNameDecl.
1045 TypedefKind,
1046
1047 /// An enumeration or scoped enumeration.
1048 EnumKind
1049 };
1050
1051 /// What kind of template specialization \c CommentDecl is.
1052 enum TemplateDeclKind {
1053 NotTemplate,
1054 Template,
1055 TemplateSpecialization,
1056 TemplatePartialSpecialization
1057 };
1058
1059 /// If false, only \c CommentDecl is valid.
1060 unsigned IsFilled : 1;
1061
1062 /// Simplified kind of \c CommentDecl, see \c DeclKind enum.
1063 unsigned Kind : 3;
1064
1065 /// Is \c CommentDecl a template declaration.
1066 unsigned TemplateKind : 2;
1067
1068 /// Is \c CommentDecl an ObjCMethodDecl.
1069 unsigned IsObjCMethod : 1;
1070
1071 /// Is \c CommentDecl a non-static member function of C++ class or
1072 /// instance method of ObjC class.
1073 /// Can be true only if \c IsFunctionDecl is true.
1074 unsigned IsInstanceMethod : 1;
1075
1076 /// Is \c CommentDecl a static member function of C++ class or
1077 /// class method of ObjC class.
1078 /// Can be true only if \c IsFunctionDecl is true.
1079 unsigned IsClassMethod : 1;
1080
1081 void fill();
1082
1083 DeclKind getKind() const LLVM_READONLY {
1084 return static_cast<DeclKind>(Kind);
1085 }
1086
1087 TemplateDeclKind getTemplateKind() const LLVM_READONLY {
1088 return static_cast<TemplateDeclKind>(TemplateKind);
1089 }
1090 };
1091
1092 /// A full comment attached to a declaration, contains block content.
1093 class FullComment : public Comment {
1094 ArrayRef<BlockContentComment *> Blocks;
1095 DeclInfo *ThisDeclInfo;
1096
1097 public:
1098 FullComment(ArrayRef<BlockContentComment *> Blocks, DeclInfo *D) :
1099 Comment(FullCommentKind, SourceLocation(), SourceLocation()),
1100 Blocks(Blocks), ThisDeclInfo(D) {
1101 if (Blocks.empty())
1102 return;
1103
1104 setSourceRange(
1105 SourceRange(Blocks.front()->getBeginLoc(), Blocks.back()->getEndLoc()));
1106 setLocation(Blocks.front()->getBeginLoc());
1107 }
1108
1109 static bool classof(const Comment *C) {
1110 return C->getCommentKind() == FullCommentKind;
1111 }
1112
1113 child_iterator child_begin() const {
1114 return reinterpret_cast<child_iterator>(Blocks.begin());
1115 }
1116
1117 child_iterator child_end() const {
1118 return reinterpret_cast<child_iterator>(Blocks.end());
1119 }
1120
1121 const Decl *getDecl() const LLVM_READONLY {
1122 return ThisDeclInfo->CommentDecl;
1123 }
1124
1125 const DeclInfo *getDeclInfo() const LLVM_READONLY {
1126 if (!ThisDeclInfo->IsFilled)
1127 ThisDeclInfo->fill();
1128 return ThisDeclInfo;
1129 }
1130
1131 ArrayRef<BlockContentComment *> getBlocks() const { return Blocks; }
1132
1133 };
1134 } // end namespace comments
1135 } // end namespace clang
1136
1137 #endif
1138
clang::comments::HTMLStartTagComment::Attribute::Attribute
Attribute(SourceLocation NameLocBegin, StringRef Name)
Definition: Comment.h:429
clang::comments::ParamCommandComment::setDirection
void setDirection(PassDirection Direction, bool Explicit)
Definition: Comment.h:755
clang::comments::ParamCommandComment::hasParamName
bool hasParamName() const
Definition: Comment.h:760
clang::comments::Comment::NoCommentKind
Definition: Comment.h:187
clang::comments::ParamCommandComment::isVarArgParam
bool isVarArgParam() const LLVM_READONLY
Definition: Comment.h:778
clang::comments::DeclInfo::CommentDecl
const Decl * CommentDecl
Declaration the comment is actually attached to (in the source).
Definition: Comment.h:985
clang::SourceLocation::getLocWithOffset
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.
Definition: SourceLocation.h:132
clang::comments::BlockContentComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:541
clang::comments::BlockCommandComment::getArgText
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:674
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:654
clang::comments::BlockCommandComment::BlockCommandComment
BlockCommandComment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
Definition: Comment.h:615
clang::comments::HTMLEndTagComment::child_end
child_iterator child_end() const
Definition: Comment.h:527
clang::comments::BlockCommandComment::getCommandID
unsigned getCommandID() const
Definition: Comment.h:652
clang::comments::BlockCommandComment::hasNonWhitespaceParagraph
bool hasNonWhitespaceParagraph() const
Definition: Comment.h:695
clang::comments::InlineCommandComment::RenderEmphasized
Definition: Comment.h:314
clang::comments::VerbatimBlockComment::setLines
void setLines(ArrayRef< VerbatimBlockLineComment *> L)
Definition: Comment.h:925
clang::comments::DeclInfo::NotTemplate
Definition: Comment.h:1053
clang::comments::TParamCommandComment::isPositionValid
bool isPositionValid() const LLVM_READONLY
Definition: Comment.h:844
clang::comments::HTMLEndTagComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:521
clang::comments::DeclInfo::IsObjCMethod
unsigned IsObjCMethod
Is CommentDecl an ObjCMethodDecl.
Definition: Comment.h:1069
clang::comments::Comment::InlineCommandCommentBits
InlineCommandCommentBitfields InlineCommandCommentBits
Definition: Comment.h:169
Type.h
C Language Family Type Representation.
clang::comments::VerbatimBlockComment::getCloseName
StringRef getCloseName() const
Definition: Comment.h:929
clang::comments::InlineContentComment::hasTrailingNewline
bool hasTrailingNewline() const
Definition: Comment.h:257
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:88
clang::comments::Comment::NumInlineContentCommentBits
Definition: Comment.h:77
clang::comments::Comment::getLocation
SourceLocation getLocation() const LLVM_READONLY
Definition: Comment.h:222
clang::comments::Comment::NumTextCommentBits
Definition: Comment.h:90
clang::comments::TextComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:279
DeclObjC.h
clang::CodeGen::AlignmentSource::Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
clang::comments::HTMLTagComment::TagNameRange
SourceRange TagNameRange
Definition: Comment.h:376
clang::comments::HTMLStartTagComment::HTMLStartTagComment
HTMLStartTagComment(SourceLocation LocBegin, StringRef TagName)
Definition: Comment.h:456
clang::comments::Comment::BlockCommandCommentBits
BlockCommandCommentBitfields BlockCommandCommentBits
Definition: Comment.h:173
clang::comments::Comment::child_begin
child_iterator child_begin() const
Definition: Comment.cpp:82
clang::comments::InlineCommandComment::Argument::Range
SourceRange Range
Definition: Comment.h:302
clang::comments::DeclInfo::DeclKind
DeclKind
A simplified description of CommentDecl kind that should be good enough for documentation rendering p...
Definition: Comment.h:1012
clang::comments::Comment::setLocation
void setLocation(SourceLocation L)
Definition: Comment.h:181
clang::comments::InlineCommandComment::getArgText
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:362
clang::comments::InlineCommandComment::Argument::Text
StringRef Text
Definition: Comment.h:303
clang::comments::Comment::InlineContentCommentBitfields
Definition: Comment.h:68
clang::comments::Comment::NumBlockCommandCommentBits
Definition: Comment.h:149
clang::TemplateParameterList
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:69
clang::comments::DeclInfo::VariableKind
Something that we consider a "variable":
Definition: Comment.h:1038
clang::comments::DeclInfo::FunctionKind
Something that we consider a "function":
Definition: Comment.h:1026
clang::comments::TParamCommandComment::getIndex
unsigned getIndex(unsigned Depth) const
Definition: Comment.h:853
clang::comments::DeclInfo::TemplateDeclKind
TemplateDeclKind
What kind of template specialization CommentDecl is.
Definition: Comment.h:1052
clang::comments::HTMLStartTagComment::Attribute::NameLocBegin
SourceLocation NameLocBegin
Definition: Comment.h:419
clang::comments::HTMLTagComment::getTagNameSourceRange
SourceRange getTagNameSourceRange() const LLVM_READONLY
Definition: Comment.h:399
clang::comments::TParamCommandComment::getDepth
unsigned getDepth() const
Definition: Comment.h:848
clang::comments::VerbatimBlockComment::child_end
child_iterator child_end() const
Definition: Comment.h:916
clang::comments::Comment::TextCommentBits
TextCommentBitfields TextCommentBits
Definition: Comment.h:168
clang::comments::Comment::dumpColor
void dumpColor() const
Definition: ASTDumper.cpp:275
clang::comments::BlockCommandComment::getParagraph
ParagraphComment * getParagraph() const LLVM_READONLY
Definition: Comment.h:691
clang::comments::BlockCommandComment::getCommandName
StringRef getCommandName(const CommandTraits &Traits) const
Definition: Comment.h:656
clang::comments::Comment::ParagraphCommentBitfields
Definition: Comment.h:125
clang::comments::Comment::Comment
Comment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd)
Definition: Comment.h:197
clang::comments::VerbatimLineComment::getText
StringRef getText() const
Definition: Comment.h:972
clang::comments::BlockContentComment::BlockContentComment
BlockContentComment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd)
Definition: Comment.h:534
clang::comments::VerbatimBlockComment::getNumLines
unsigned getNumLines() const
Definition: Comment.h:933
clang::comments::InlineCommandComment::Argument::Argument
Argument(SourceRange Range, StringRef Text)
Definition: Comment.h:305
clang::comments::VerbatimLineComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:964
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:168
clang::comments::FullComment::child_end
child_iterator child_end() const
Definition: Comment.h:1117
clang::comments::InlineCommandComment::getRenderKind
RenderKind getRenderKind() const
Definition: Comment.h:354
clang::comments::ParagraphComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:570
clang::comments::DeclInfo::Template
Definition: Comment.h:1054
clang::comments::InlineCommandComment::RenderBold
Definition: Comment.h:312
clang::comments::VerbatimLineComment::getTextRange
SourceRange getTextRange() const
Definition: Comment.h:976
clang::comments::VerbatimBlockLineComment::getText
StringRef getText() const LLVM_READONLY
Definition: Comment.h:885
clang::comments::Comment::HTMLTagCommentBits
HTMLTagCommentBitfields HTMLTagCommentBits
Definition: Comment.h:170
clang::comments::DeclInfo::CurrentDecl
const Decl * CurrentDecl
CurrentDecl is the declaration with which the FullComment is associated.
Definition: Comment.h:995
clang::comments::InlineCommandComment::getArgRange
SourceRange getArgRange(unsigned Idx) const
Definition: Comment.h:366
clang::comments::DeclInfo::IsFilled
unsigned IsFilled
If false, only CommentDecl is valid.
Definition: Comment.h:1060
clang::comments::ParamCommandComment::PassDirection
PassDirection
Definition: Comment.h:739
clang::comments::TParamCommandComment::getParamNameRange
SourceRange getParamNameRange() const
Definition: Comment.h:840
clang::comments::Comment::NumInlineCommandCommentBits
Definition: Comment.h:101
clang::comments::InlineCommandComment
A command with word-like arguments that is considered inline content.
Definition: Comment.h:299
clang::comments::HTMLTagComment::TagName
StringRef TagName
Definition: Comment.h:375
clang::comments::VerbatimBlockLineComment
A line of text contained in a verbatim block.
Definition: Comment.h:865
clang::comments::BlockCommandComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:644
clang::comments::TextComment
Plain text.
Definition: Comment.h:263
clang::comments::VerbatimLineComment
A verbatim line command.
Definition: Comment.h:945
clang::comments::HTMLStartTagComment::setSelfClosing
void setSelfClosing()
Definition: Comment.h:503
clang::comments::DeclInfo::ClassKind
Something that we consider a "class":
Definition: Comment.h:1032
clang::comments::BlockCommandComment::Args
ArrayRef< Argument > Args
Word-like arguments.
Definition: Comment.h:610
CommentCommandTraits.h
clang::comments::Comment::BlockCommandCommentBitfields
Definition: Comment.h:138
clang::comments::Comment
Any part of the comment.
Definition: Comment.h:52
clang::comments::InlineCommandComment::getCommandNameRange
SourceRange getCommandNameRange() const
Definition: Comment.h:350
clang::comments::VerbatimBlockComment::CloseName
StringRef CloseName
Definition: Comment.h:895
clang::comments::FullComment::FullComment
FullComment(ArrayRef< BlockContentComment *> Blocks, DeclInfo *D)
Definition: Comment.h:1098
clang::comments::ParamCommandComment::getParamIndex
unsigned getParamIndex() const LLVM_READONLY
Definition: Comment.h:787
clang::comments::HTMLStartTagComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:470
clang::comments::VerbatimBlockLineComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:881
clang::comments::InlineContentComment
Inline content (contained within a block).
Definition: Comment.h:238
clang::comments::ParamCommandComment::In
Definition: Comment.h:740
llvm::ArrayRef
Definition: LLVM.h:31
clang::comments::InlineCommandComment::RenderKind
RenderKind
The most appropriate rendering mode for this command, chosen on command semantics in Doxygen...
Definition: Comment.h:310
clang::comments::HTMLTagComment::setIsMalformed
void setIsMalformed()
Definition: Comment.h:409
clang::comments::HTMLStartTagComment::isSelfClosing
bool isSelfClosing() const
Definition: Comment.h:499
clang::comments::TextComment::child_end
child_iterator child_end() const
Definition: Comment.h:281
clang::comments::HTMLStartTagComment::Attribute::Attribute
Attribute(SourceLocation NameLocBegin, StringRef Name, SourceLocation EqualsLoc, SourceRange ValueRange, StringRef Value)
Definition: Comment.h:435
clang::comments::CommandInfo::Name
const char * Name
Definition: CommentCommandTraits.h:37
clang::comments::VerbatimBlockComment
A verbatim block command (e.
Definition: Comment.h:893
clang::comments::TextComment::getText
StringRef getText() const LLVM_READONLY
Definition: Comment.h:283
clang::comments::DeclInfo::TemplateKind
unsigned TemplateKind
Is CommentDecl a template declaration.
Definition: Comment.h:1066
clang::comments::VerbatimBlockLineComment::child_end
child_iterator child_end() const
Definition: Comment.h:883
clang::comments::InlineCommandComment::getCommandID
unsigned getCommandID() const
Definition: Comment.h:342
clang::comments::Comment::child_end
child_iterator child_end() const
Definition: Comment.cpp:96
clang::comments::HTMLStartTagComment::Attribute::getNameRange
SourceRange getNameRange() const
Definition: Comment.h:447
clang::comments::HTMLStartTagComment::setAttrs
void setAttrs(ArrayRef< Attribute > Attrs)
Definition: Comment.h:482
clang::comments::Comment::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Comment.h:220
clang::comments::VerbatimLineComment::TextBegin
SourceLocation TextBegin
Definition: Comment.h:948
clang::comments::VerbatimBlockComment::CloseNameLocBegin
SourceLocation CloseNameLocBegin
Definition: Comment.h:896
clang::comments::TParamCommandComment::setPosition
void setPosition(ArrayRef< unsigned > NewPosition)
Definition: Comment.h:858
clang::comments::InlineCommandComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:338
clang::comments::DeclInfo::ReturnType
QualType ReturnType
Function return type if CommentDecl is something that we consider a "function".
Definition: Comment.h:1003
clang::comments::InlineCommandComment::child_end
child_iterator child_end() const
Definition: Comment.h:340
clang::comments::CMK_At
Command started with an &#39;at&#39; character:
Definition: Comment.h:47
clang::comments::Comment::child_count
unsigned child_count() const
Definition: Comment.h:231
clang::comments::FullComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:1113
clang::comments::DeclInfo::fill
void fill()
Definition: Comment.cpp:204
clang::comments::BlockCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:639
clang::comments::Comment::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Comment.h:218
clang::comments::InlineCommandComment::InlineCommandComment
InlineCommandComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, RenderKind RK, ArrayRef< Argument > Args)
Definition: Comment.h:323
clang::comments::FullComment::getDecl
const Decl * getDecl() const LLVM_READONLY
Definition: Comment.h:1121
clang::comments::CommandMarkerKind
CommandMarkerKind
Describes the syntax that was used in a documentation command.
Definition: Comment.h:36
clang::comments::InlineContentComment::InlineContentComment
InlineContentComment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd)
Definition: Comment.h:240
clang::comments::Comment::dump
void dump() const
Definition: ASTDumper.cpp:257
clang::comments::BlockCommandComment
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:598
clang::comments::HTMLTagComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:392
clang::comments::BlockCommandComment::BlockCommandComment
BlockCommandComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
Definition: Comment.h:628
clang::comments::InlineCommandComment::Argument
Definition: Comment.h:301
clang::comments::BlockCommandComment::getCommandMarker
CommandMarkerKind getCommandMarker() const LLVM_READONLY
Definition: Comment.h:706
Depth
int Depth
Definition: ASTDiff.cpp:190
clang::comments::Comment::CommentBits
CommentBitfields CommentBits
Definition: Comment.h:166
clang::comments::DeclInfo::TemplateParameters
const TemplateParameterList * TemplateParameters
Template parameters that can be referenced by \tparam if CommentDecl is a template (IsTemplateDecl or...
Definition: Comment.h:1008
clang::comments::HTMLStartTagComment::Attribute::getNameLocEnd
SourceLocation getNameLocEnd() const
Definition: Comment.h:443
clang::comments::InlineCommandComment::Args
ArrayRef< Argument > Args
Command arguments.
Definition: Comment.h:320
clang::comments::Comment::Range
SourceRange Range
Source range of this AST node.
Definition: Comment.h:58
clang::comments::CommandInfo::NumCommandIDBits
Definition: CommentCommandTraits.h:43
clang::comments::Comment::getCommentKind
CommentKind getCommentKind() const
Definition: Comment.h:204
clang::comments::ParamCommandComment::isDirectionExplicit
bool isDirectionExplicit() const LLVM_READONLY
Definition: Comment.h:751
clang::comments::Comment::TextCommentBitfields
Definition: Comment.h:79
clang::comments::ParamCommandComment::getParamNameRange
SourceRange getParamNameRange() const
Definition: Comment.h:770
clang::comments::HTMLStartTagComment::getNumAttrs
unsigned getNumAttrs() const
Definition: Comment.h:474
clang::SourceRange::getEnd
SourceLocation getEnd() const
Definition: SourceLocation.h:217
clang::comments::Comment::NumParagraphCommentBits
Definition: Comment.h:136
clang::comments::HTMLStartTagComment
An opening HTML tag with attributes.
Definition: Comment.h:415
clang::comments::ParagraphComment::ParagraphComment
ParagraphComment(ArrayRef< InlineContentComment *> Content)
Definition: Comment.h:552
clang::comments::InlineCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:334
clang::comments::BlockCommandComment::getNumArgs
unsigned getNumArgs() const
Definition: Comment.h:670
SM
const SourceManager & SM
Definition: Format.cpp:1685
clang::comments::HTMLStartTagComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:466
clang::comments::BlockCommandComment::Paragraph
ParagraphComment * Paragraph
Paragraph argument.
Definition: Comment.h:613
clang::comments::InlineCommandComment::getNumArgs
unsigned getNumArgs() const
Definition: Comment.h:358
clang::comments::HTMLStartTagComment::Attribute
Definition: Comment.h:417
clang::comments::CommandTraits
This class provides information about commands that can be used in comments.
Definition: CommentCommandTraits.h:127
clang::comments::DeclInfo::TemplateSpecialization
Definition: Comment.h:1055
clang::comments::Comment::InlineCommandCommentBitfields
Definition: Comment.h:92
clang::comments::BlockCommandComment::Argument::Argument
Argument()
Definition: Comment.h:604
clang::comments::VerbatimBlockComment::setCloseName
void setCloseName(StringRef Name, SourceLocation LocBegin)
Definition: Comment.h:920
clang::comments::Comment::HTMLStartTagCommentBitfields
Definition: Comment.h:114
clang::comments::Comment::CommentBitfields
Definition: Comment.h:60
Kind
Kind
Definition: ChrootChecker.cpp:29
clang::comments::TParamCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:826
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::comments::HTMLStartTagComment::Attribute::Attribute
Attribute()
Definition: Comment.h:427
clang::comments::VerbatimBlockComment::Lines
ArrayRef< VerbatimBlockLineComment * > Lines
Definition: Comment.h:897
clang::comments::VerbatimBlockComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:908
clang::comments::TextComment::isWhitespace
bool isWhitespace() const
Definition: Comment.h:285
clang::comments::HTMLStartTagComment::Attribute::ValueRange
SourceRange ValueRange
Definition: Comment.h:424
clang::comments::Comment::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Definition: Comment.h:216
clang::comments::ParamCommandComment::isParamIndexValid
bool isParamIndexValid() const LLVM_READONLY
Definition: Comment.h:774
clang::comments::Comment::ParagraphCommentBits
ParagraphCommentBitfields ParagraphCommentBits
Definition: Comment.h:172
clang::comments::CommandTraits::getCommandInfo
const CommandInfo * getCommandInfo(StringRef Name) const
Definition: CommentCommandTraits.h:145
clang::comments::DeclInfo::getTemplateKind
TemplateDeclKind getTemplateKind() const LLVM_READONLY
Definition: Comment.h:1087
clang::comments::BlockCommandComment::Argument::Argument
Argument(SourceRange Range, StringRef Text)
Definition: Comment.h:605
clang::comments::Comment::HTMLTagCommentBitfields
Definition: Comment.h:104
clang::comments::BlockContentComment
Block content (contains inline content).
Definition: Comment.h:532
clang::comments::BlockCommandComment::Argument
Definition: Comment.h:600
clang::comments::Comment::child_iterator
Comment *const * child_iterator
Definition: Comment.h:224
clang::comments::TParamCommandComment::getParamNameAsWritten
StringRef getParamNameAsWritten() const
Definition: Comment.h:836
clang::comments::HTMLTagComment::isMalformed
bool isMalformed() const
Definition: Comment.h:405
clang::comments::DeclInfo::Kind
unsigned Kind
Simplified kind of CommentDecl, see DeclKind enum.
Definition: Comment.h:1063
clang::comments::BlockCommandComment::getCommandNameRange
SourceRange getCommandNameRange(const CommandTraits &Traits) const
Definition: Comment.h:664
clang::comments::ParamCommandComment::getDirection
PassDirection getDirection() const LLVM_READONLY
Definition: Comment.h:747
clang::comments::ParagraphComment::isWhitespace
bool isWhitespace() const
Definition: Comment.h:582
clang::comments::Comment::ParamCommandCommentBitfields
Definition: Comment.h:152
clang::comments::ParamCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:735
clang::comments::HTMLStartTagComment::Attribute::EqualsLoc
SourceLocation EqualsLoc
Definition: Comment.h:422
clang::comments::HTMLEndTagComment
A closing HTML tag.
Definition: Comment.h:509
clang::comments::DeclInfo::OtherKind
Everything else not explicitly mentioned below.
Definition: Comment.h:1014
clang::comments::HTMLEndTagComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:525
clang::comments::BlockCommandComment::Argument::Text
StringRef Text
Definition: Comment.h:602
clang::comments::TParamCommandComment
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:801
clang::comments::VerbatimBlockLineComment::VerbatimBlockLineComment
VerbatimBlockLineComment(SourceLocation LocBegin, StringRef Text)
Definition: Comment.h:869
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:21
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:106
clang::comments::BlockCommandComment::getCommandNameBeginLoc
SourceLocation getCommandNameBeginLoc() const
Definition: Comment.h:660
clang::comments::ParamCommandComment::ParamCommandComment
ParamCommandComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
Definition: Comment.h:724
clang::comments::VerbatimLineComment::VerbatimLineComment
VerbatimLineComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, SourceLocation TextBegin, StringRef Text)
Definition: Comment.h:951
clang::comments::CMK_Backslash
Command started with a backslash character:
Definition: Comment.h:41
clang::comments::HTMLEndTagComment::HTMLEndTagComment
HTMLEndTagComment(SourceLocation LocBegin, SourceLocation LocEnd, StringRef TagName)
Definition: Comment.h:511
clang::comments::DeclInfo
Information about the declaration, useful to clients of FullComment.
Definition: Comment.h:982
clang::comments::Comment::Loc
SourceLocation Loc
Preferred location to show caret.
Definition: Comment.h:55
clang::comments::ParagraphComment
A single paragraph that contains inline content.
Definition: Comment.h:548
clang::comments::DeclInfo::getKind
DeclKind getKind() const LLVM_READONLY
Definition: Comment.h:1083
clang::comments::InlineCommandComment::RenderNormal
Definition: Comment.h:311
clang::comments::DeclInfo::IsInstanceMethod
unsigned IsInstanceMethod
Is CommentDecl a non-static member function of C++ class or instance method of ObjC class...
Definition: Comment.h:1074
clang::comments::TextComment::TextComment
TextComment(SourceLocation LocBegin, SourceLocation LocEnd, StringRef Text)
Definition: Comment.h:267
clang::comments::VerbatimBlockComment::getText
StringRef getText(unsigned LineIdx) const
Definition: Comment.h:937
clang::comments::HTMLTagComment::getTagName
StringRef getTagName() const LLVM_READONLY
Definition: Comment.h:397
clang::comments::ParamCommandComment::setParamIndex
void setParamIndex(unsigned Index)
Definition: Comment.h:793
clang::comments::Comment::NumHTMLStartTagCommentBits
Definition: Comment.h:123
clang::comments::DeclInfo::TypedefKind
A C++ typedef-name (a &#39;typedef&#39; decl specifier or alias-declaration), see TypedefNameDecl.
Definition: Comment.h:1045
clang::comments::Comment::InlineContentCommentBits
InlineContentCommentBitfields InlineContentCommentBits
Definition: Comment.h:167
clang::comments::HTMLStartTagComment::child_end
child_iterator child_end() const
Definition: Comment.h:472
clang::comments::HTMLTagComment::HTMLTagComment
HTMLTagComment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd, StringRef TagName, SourceLocation TagNameBegin, SourceLocation TagNameEnd)
Definition: Comment.h:378
clang::comments::ParamCommandComment::setIsVarArgParam
void setIsVarArgParam()
Definition: Comment.h:782
clang::comments::Comment::CommentKind
CommentKind
Definition: Comment.h:186
clang::comments::BlockCommandComment::setParagraph
void setParagraph(ParagraphComment *PC)
Definition: Comment.h:699
clang::comments::HTMLStartTagComment::Attribute::Value
StringRef Value
Definition: Comment.h:425
clang::comments::InlineContentComment::addTrailingNewline
void addTrailingNewline()
Definition: Comment.h:253
clang::comments::InlineContentComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:248
clang::comments::Comment::NumParamCommandCommentBits
Definition: Comment.h:163
clang::comments::VerbatimBlockLineComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:877
SourceLocation.h
Defines the clang::SourceLocation class and associated facilities.
clang::SourceRange::setEnd
void setEnd(SourceLocation e)
Definition: SourceLocation.h:220
clang::comments::HTMLTagComment
Abstract class for opening and closing HTML tags.
Definition: Comment.h:373
clang::comments::Comment::getCommentKindName
const char * getCommentKindName() const
Definition: Comment.cpp:35
clang::comments::BlockCommandComment::child_end
child_iterator child_end() const
Definition: Comment.h:648
clang::comments::VerbatimBlockComment::VerbatimBlockComment
VerbatimBlockComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID)
Definition: Comment.h:900
clang::comments::FullComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:1109
clang::comments::HTMLStartTagComment::getAttr
const Attribute & getAttr(unsigned Idx) const
Definition: Comment.h:478
clang::comments::InlineCommandComment::getCommandName
StringRef getCommandName(const CommandTraits &Traits) const
Definition: Comment.h:346
clang::comments::TParamCommandComment::hasParamName
bool hasParamName() const
Definition: Comment.h:830
clang::comments::Comment::NumHTMLTagCommentBits
Definition: Comment.h:112
clang::comments::BlockCommandComment::Argument::Range
SourceRange Range
Definition: Comment.h:601
clang::comments::ParamCommandComment::Out
Definition: Comment.h:741
clang::comments::ParamCommandComment::getParamNameAsWritten
StringRef getParamNameAsWritten() const
Definition: Comment.h:766
clang::comments::ParagraphComment::child_end
child_iterator child_end() const
Definition: Comment.h:578
clang::comments::HTMLStartTagComment::Attribute::Name
StringRef Name
Definition: Comment.h:420
clang::comments::BlockCommandComment::setArgs
void setArgs(ArrayRef< Argument > A)
Definition: Comment.h:682
clang::comments::Comment::setSourceRange
void setSourceRange(SourceRange SR)
Definition: Comment.h:177
clang::comments::DeclInfo::IsClassMethod
unsigned IsClassMethod
Is CommentDecl a static member function of C++ class or class method of ObjC class.
Definition: Comment.h:1079
clang::comments::ParamCommandComment
Doxygen \param command.
Definition: Comment.h:713
clang::comments::VerbatimLineComment::child_end
child_iterator child_end() const
Definition: Comment.h:970
clang::comments::FullComment::getDeclInfo
const DeclInfo * getDeclInfo() const LLVM_READONLY
Definition: Comment.h:1125
Text
StringRef Text
Definition: Format.cpp:1826
clang::comments::DeclInfo::ParamVars
ArrayRef< const ParmVarDecl * > ParamVars
Parameters that can be referenced by \param if CommentDecl is something that we consider a "function"...
Definition: Comment.h:999
clang::comments::VerbatimBlockComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:912
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:207
clang::comments::FullComment::getBlocks
ArrayRef< BlockContentComment * > getBlocks() const
Definition: Comment.h:1131
clang::comments::HTMLStartTagComment::setGreaterLoc
void setGreaterLoc(SourceLocation GreaterLoc)
Definition: Comment.h:495
clang::comments::InlineCommandComment::RenderMonospaced
Definition: Comment.h:313
clang::comments::BlockCommandComment::getArgRange
SourceRange getArgRange(unsigned Idx) const
Definition: Comment.h:678
clang::comments::TParamCommandComment::TParamCommandComment
TParamCommandComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
Definition: Comment.h:818
clang::comments::TextComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:275
clang::comments::ParagraphComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:574
clang::comments::Comment::ParamCommandCommentBits
ParamCommandCommentBitfields ParamCommandCommentBits
Definition: Comment.h:174
clang::comments::VerbatimLineComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:968
clang::SourceRange::getBegin
SourceLocation getBegin() const
Definition: SourceLocation.h:216
clang::comments::Comment::NumCommentBits
Definition: Comment.h:66
clang::comments::VerbatimLineComment::Text
StringRef Text
Definition: Comment.h:947
clang::SourceManager
This class handles loading and caching of source files into memory.
Definition: SourceManager.h:596
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:45
clang::comments::FullComment
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1093
clang::comments::DeclInfo::NamespaceKind
A C++ namespace.
Definition: Comment.h:1041
clang::comments::Comment::HTMLStartTagCommentBits
HTMLStartTagCommentBitfields HTMLStartTagCommentBits
Definition: Comment.h:171