clang 8.0.0

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