clang  14.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 
17 #include "clang/AST/DeclObjC.h"
18 #include "clang/AST/Type.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.
37  /// Command started with a backslash character:
38  /// \code
39  /// \foo
40  /// \endcode
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.
56 
57  /// Source range of this AST node.
59 
61  friend class Comment;
62 
63  /// Type of this AST node.
64  unsigned Kind : 8;
65  };
66  enum { NumCommentBits = 8 };
67 
69  friend class InlineContentComment;
70 
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  };
78 
80  friend class TextComment;
81 
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  };
91 
93  friend class InlineCommandComment;
94 
96 
97  unsigned RenderKind : 3;
98 
99  unsigned CommandID : CommandInfo::NumCommandIDBits;
100  };
103 
105  friend class HTMLTagComment;
106 
108 
109  /// True if we found that this tag is malformed in some way.
110  unsigned IsMalformed : 1;
111  };
113 
115  friend class HTMLStartTagComment;
116 
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  };
124 
126  friend class ParagraphComment;
127 
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  };
137 
139  friend class BlockCommandComment;
140 
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  };
151 
153  friend class ParamCommandComment;
154 
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  };
164 
165  union {
175  };
176 
178  Range = SR;
179  }
180 
182  Loc = L;
183  }
184 
185 public:
186  enum CommentKind {
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 
198  SourceLocation LocBegin,
199  SourceLocation LocEnd) :
200  Loc(LocBegin), Range(SourceRange(LocBegin, LocEnd)) {
201  CommentBits.Kind = K;
202  }
203 
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(raw_ostream &OS, const ASTContext &Context) const;
213 
214  SourceRange getSourceRange() const LLVM_READONLY { return Range; }
215 
216  SourceLocation getBeginLoc() const LLVM_READONLY { return Range.getBegin(); }
217 
218  SourceLocation getEndLoc() const LLVM_READONLY { return Range.getEnd(); }
219 
220  SourceLocation getLocation() const LLVM_READONLY { return Loc; }
221 
222  typedef Comment * const *child_iterator;
223 
224  child_iterator child_begin() const;
225  child_iterator child_end() const;
226 
227  // TODO: const child iterator
228 
229  unsigned child_count() const {
230  return child_end() - child_begin();
231  }
232 };
233 
234 /// Inline content (contained within a block).
235 /// Abstract class.
237 protected:
239  SourceLocation LocBegin,
240  SourceLocation LocEnd) :
241  Comment(K, LocBegin, LocEnd) {
242  InlineContentCommentBits.HasTrailingNewline = 0;
243  }
244 
245 public:
246  static bool classof(const Comment *C) {
247  return C->getCommentKind() >= FirstInlineContentCommentConstant &&
248  C->getCommentKind() <= LastInlineContentCommentConstant;
249  }
250 
252  InlineContentCommentBits.HasTrailingNewline = 1;
253  }
254 
255  bool hasTrailingNewline() const {
256  return InlineContentCommentBits.HasTrailingNewline;
257  }
258 };
259 
260 /// Plain text.
262  StringRef Text;
263 
264 public:
266  SourceLocation LocEnd,
267  StringRef Text) :
268  InlineContentComment(TextCommentKind, LocBegin, LocEnd),
269  Text(Text) {
270  TextCommentBits.IsWhitespaceValid = false;
271  }
272 
273  static bool classof(const Comment *C) {
274  return C->getCommentKind() == TextCommentKind;
275  }
276 
277  child_iterator child_begin() const { return nullptr; }
278 
279  child_iterator child_end() const { return nullptr; }
280 
281  StringRef getText() const LLVM_READONLY { return Text; }
282 
283  bool isWhitespace() const {
284  if (TextCommentBits.IsWhitespaceValid)
285  return TextCommentBits.IsWhitespace;
286 
287  TextCommentBits.IsWhitespace = isWhitespaceNoCache();
288  TextCommentBits.IsWhitespaceValid = true;
289  return TextCommentBits.IsWhitespace;
290  }
291 
292 private:
293  bool isWhitespaceNoCache() const;
294 };
295 
296 /// A command with word-like arguments that is considered inline content.
298 public:
299  struct Argument {
301  StringRef Text;
302 
304  };
305 
306  /// The most appropriate rendering mode for this command, chosen on command
307  /// semantics in Doxygen.
308  enum RenderKind {
314  };
315 
316 protected:
317  /// Command arguments.
319 
320 public:
322  SourceLocation LocEnd,
323  unsigned CommandID,
324  RenderKind RK,
326  InlineContentComment(InlineCommandCommentKind, LocBegin, LocEnd),
327  Args(Args) {
328  InlineCommandCommentBits.RenderKind = RK;
329  InlineCommandCommentBits.CommandID = CommandID;
330  }
331 
332  static bool classof(const Comment *C) {
333  return C->getCommentKind() == InlineCommandCommentKind;
334  }
335 
336  child_iterator child_begin() const { return nullptr; }
337 
338  child_iterator child_end() const { return nullptr; }
339 
340  unsigned getCommandID() const {
341  return InlineCommandCommentBits.CommandID;
342  }
343 
344  StringRef getCommandName(const CommandTraits &Traits) const {
345  return Traits.getCommandInfo(getCommandID())->Name;
346  }
347 
349  return SourceRange(getBeginLoc().getLocWithOffset(-1), getEndLoc());
350  }
351 
353  return static_cast<RenderKind>(InlineCommandCommentBits.RenderKind);
354  }
355 
356  unsigned getNumArgs() const {
357  return Args.size();
358  }
359 
360  StringRef getArgText(unsigned Idx) const {
361  return Args[Idx].Text;
362  }
363 
364  SourceRange getArgRange(unsigned Idx) const {
365  return Args[Idx].Range;
366  }
367 };
368 
369 /// Abstract class for opening and closing HTML tags. HTML tags are always
370 /// treated as inline content (regardless HTML semantics).
372 protected:
373  StringRef TagName;
375 
377  SourceLocation LocBegin,
378  SourceLocation LocEnd,
379  StringRef TagName,
380  SourceLocation TagNameBegin,
381  SourceLocation TagNameEnd) :
382  InlineContentComment(K, LocBegin, LocEnd),
383  TagName(TagName),
384  TagNameRange(TagNameBegin, TagNameEnd) {
385  setLocation(TagNameBegin);
386  HTMLTagCommentBits.IsMalformed = 0;
387  }
388 
389 public:
390  static bool classof(const Comment *C) {
391  return C->getCommentKind() >= FirstHTMLTagCommentConstant &&
392  C->getCommentKind() <= LastHTMLTagCommentConstant;
393  }
394 
395  StringRef getTagName() const LLVM_READONLY { return TagName; }
396 
397  SourceRange getTagNameSourceRange() const LLVM_READONLY {
399  return SourceRange(L.getLocWithOffset(1),
400  L.getLocWithOffset(1 + TagName.size()));
401  }
402 
403  bool isMalformed() const {
404  return HTMLTagCommentBits.IsMalformed;
405  }
406 
407  void setIsMalformed() {
408  HTMLTagCommentBits.IsMalformed = 1;
409  }
410 };
411 
412 /// An opening HTML tag with attributes.
414 public:
415  class Attribute {
416  public:
418  StringRef Name;
419 
421 
423  StringRef Value;
424 
425  Attribute() { }
426 
430  ValueRange(SourceRange()), Value(StringRef())
431  { }
432 
435  SourceRange ValueRange, StringRef Value) :
439  { }
440 
442  return NameLocBegin.getLocWithOffset(Name.size());
443  }
444 
447  }
448  };
449 
450 private:
451  ArrayRef<Attribute> Attributes;
452 
453 public:
455  StringRef TagName) :
456  HTMLTagComment(HTMLStartTagCommentKind,
457  LocBegin, LocBegin.getLocWithOffset(1 + TagName.size()),
458  TagName,
459  LocBegin.getLocWithOffset(1),
460  LocBegin.getLocWithOffset(1 + TagName.size())) {
461  HTMLStartTagCommentBits.IsSelfClosing = false;
462  }
463 
464  static bool classof(const Comment *C) {
465  return C->getCommentKind() == HTMLStartTagCommentKind;
466  }
467 
468  child_iterator child_begin() const { return nullptr; }
469 
470  child_iterator child_end() const { return nullptr; }
471 
472  unsigned getNumAttrs() const {
473  return Attributes.size();
474  }
475 
476  const Attribute &getAttr(unsigned Idx) const {
477  return Attributes[Idx];
478  }
479 
481  Attributes = Attrs;
482  if (!Attrs.empty()) {
483  const Attribute &Attr = Attrs.back();
484  SourceLocation L = Attr.ValueRange.getEnd();
485  if (L.isValid())
486  Range.setEnd(L);
487  else {
488  Range.setEnd(Attr.getNameLocEnd());
489  }
490  }
491  }
492 
493  void setGreaterLoc(SourceLocation GreaterLoc) {
494  Range.setEnd(GreaterLoc);
495  }
496 
497  bool isSelfClosing() const {
498  return HTMLStartTagCommentBits.IsSelfClosing;
499  }
500 
501  void setSelfClosing() {
502  HTMLStartTagCommentBits.IsSelfClosing = true;
503  }
504 };
505 
506 /// A closing HTML tag.
508 public:
510  SourceLocation LocEnd,
511  StringRef TagName) :
512  HTMLTagComment(HTMLEndTagCommentKind,
513  LocBegin, LocEnd,
514  TagName,
515  LocBegin.getLocWithOffset(2),
516  LocBegin.getLocWithOffset(2 + TagName.size()))
517  { }
518 
519  static bool classof(const Comment *C) {
520  return C->getCommentKind() == HTMLEndTagCommentKind;
521  }
522 
523  child_iterator child_begin() const { return nullptr; }
524 
525  child_iterator child_end() const { return nullptr; }
526 };
527 
528 /// Block content (contains inline content).
529 /// Abstract class.
530 class BlockContentComment : public Comment {
531 protected:
533  SourceLocation LocBegin,
534  SourceLocation LocEnd) :
535  Comment(K, LocBegin, LocEnd)
536  { }
537 
538 public:
539  static bool classof(const Comment *C) {
540  return C->getCommentKind() >= FirstBlockContentCommentConstant &&
541  C->getCommentKind() <= LastBlockContentCommentConstant;
542  }
543 };
544 
545 /// A single paragraph that contains inline content.
548 
549 public:
551  BlockContentComment(ParagraphCommentKind,
552  SourceLocation(),
553  SourceLocation()),
554  Content(Content) {
555  if (Content.empty()) {
556  ParagraphCommentBits.IsWhitespace = true;
557  ParagraphCommentBits.IsWhitespaceValid = true;
558  return;
559  }
560 
561  ParagraphCommentBits.IsWhitespaceValid = false;
562 
563  setSourceRange(SourceRange(Content.front()->getBeginLoc(),
564  Content.back()->getEndLoc()));
565  setLocation(Content.front()->getBeginLoc());
566  }
567 
568  static bool classof(const Comment *C) {
569  return C->getCommentKind() == ParagraphCommentKind;
570  }
571 
573  return reinterpret_cast<child_iterator>(Content.begin());
574  }
575 
577  return reinterpret_cast<child_iterator>(Content.end());
578  }
579 
580  bool isWhitespace() const {
581  if (ParagraphCommentBits.IsWhitespaceValid)
582  return ParagraphCommentBits.IsWhitespace;
583 
584  ParagraphCommentBits.IsWhitespace = isWhitespaceNoCache();
585  ParagraphCommentBits.IsWhitespaceValid = true;
586  return ParagraphCommentBits.IsWhitespace;
587  }
588 
589 private:
590  bool isWhitespaceNoCache() const;
591 };
592 
593 /// A command that has zero or more word-like arguments (number of word-like
594 /// arguments depends on command name) and a paragraph as an argument
595 /// (e. g., \\brief).
597 public:
598  struct Argument {
600  StringRef Text;
601 
602  Argument() { }
604  };
605 
606 protected:
607  /// Word-like arguments.
609 
610  /// Paragraph argument.
612 
614  SourceLocation LocBegin,
615  SourceLocation LocEnd,
616  unsigned CommandID,
617  CommandMarkerKind CommandMarker) :
618  BlockContentComment(K, LocBegin, LocEnd),
619  Paragraph(nullptr) {
621  BlockCommandCommentBits.CommandID = CommandID;
622  BlockCommandCommentBits.CommandMarker = CommandMarker;
623  }
624 
625 public:
627  SourceLocation LocEnd,
628  unsigned CommandID,
629  CommandMarkerKind CommandMarker) :
630  BlockContentComment(BlockCommandCommentKind, LocBegin, LocEnd),
631  Paragraph(nullptr) {
633  BlockCommandCommentBits.CommandID = CommandID;
634  BlockCommandCommentBits.CommandMarker = CommandMarker;
635  }
636 
637  static bool classof(const Comment *C) {
638  return C->getCommentKind() >= FirstBlockCommandCommentConstant &&
639  C->getCommentKind() <= LastBlockCommandCommentConstant;
640  }
641 
643  return reinterpret_cast<child_iterator>(&Paragraph);
644  }
645 
647  return reinterpret_cast<child_iterator>(&Paragraph + 1);
648  }
649 
650  unsigned getCommandID() const {
651  return BlockCommandCommentBits.CommandID;
652  }
653 
654  StringRef getCommandName(const CommandTraits &Traits) const {
655  return Traits.getCommandInfo(getCommandID())->Name;
656  }
657 
659  return getBeginLoc().getLocWithOffset(1);
660  }
661 
663  StringRef Name = getCommandName(Traits);
665  getBeginLoc().getLocWithOffset(1 + Name.size()));
666  }
667 
668  unsigned getNumArgs() const {
669  return Args.size();
670  }
671 
672  StringRef getArgText(unsigned Idx) const {
673  return Args[Idx].Text;
674  }
675 
676  SourceRange getArgRange(unsigned Idx) const {
677  return Args[Idx].Range;
678  }
679 
681  Args = A;
682  if (Args.size() > 0) {
683  SourceLocation NewLocEnd = Args.back().Range.getEnd();
684  if (NewLocEnd.isValid())
685  setSourceRange(SourceRange(getBeginLoc(), NewLocEnd));
686  }
687  }
688 
689  ParagraphComment *getParagraph() const LLVM_READONLY {
690  return Paragraph;
691  }
692 
694  return Paragraph && !Paragraph->isWhitespace();
695  }
696 
698  Paragraph = PC;
699  SourceLocation NewLocEnd = PC->getEndLoc();
700  if (NewLocEnd.isValid())
701  setSourceRange(SourceRange(getBeginLoc(), NewLocEnd));
702  }
703 
704  CommandMarkerKind getCommandMarker() const LLVM_READONLY {
705  return static_cast<CommandMarkerKind>(
706  BlockCommandCommentBits.CommandMarker);
707  }
708 };
709 
710 /// Doxygen \\param command.
712 private:
713  /// Parameter index in the function declaration.
714  unsigned ParamIndex;
715 
716 public:
717  enum : unsigned {
719  VarArgParamIndex = ~0U/*InvalidParamIndex*/ - 1U
720  };
721 
723  SourceLocation LocEnd,
724  unsigned CommandID,
725  CommandMarkerKind CommandMarker) :
726  BlockCommandComment(ParamCommandCommentKind, LocBegin, LocEnd,
727  CommandID, CommandMarker),
728  ParamIndex(InvalidParamIndex) {
729  ParamCommandCommentBits.Direction = In;
730  ParamCommandCommentBits.IsDirectionExplicit = false;
731  }
732 
733  static bool classof(const Comment *C) {
734  return C->getCommentKind() == ParamCommandCommentKind;
735  }
736 
738  In,
741  };
742 
743  static const char *getDirectionAsString(PassDirection D);
744 
745  PassDirection getDirection() const LLVM_READONLY {
746  return static_cast<PassDirection>(ParamCommandCommentBits.Direction);
747  }
748 
749  bool isDirectionExplicit() const LLVM_READONLY {
750  return ParamCommandCommentBits.IsDirectionExplicit;
751  }
752 
753  void setDirection(PassDirection Direction, bool Explicit) {
754  ParamCommandCommentBits.Direction = Direction;
755  ParamCommandCommentBits.IsDirectionExplicit = Explicit;
756  }
757 
758  bool hasParamName() const {
759  return getNumArgs() > 0;
760  }
761 
762  StringRef getParamName(const FullComment *FC) const;
763 
764  StringRef getParamNameAsWritten() const {
765  return Args[0].Text;
766  }
767 
769  return Args[0].Range;
770  }
771 
772  bool isParamIndexValid() const LLVM_READONLY {
773  return ParamIndex != InvalidParamIndex;
774  }
775 
776  bool isVarArgParam() const LLVM_READONLY {
777  return ParamIndex == VarArgParamIndex;
778  }
779 
781  ParamIndex = VarArgParamIndex;
782  assert(isParamIndexValid());
783  }
784 
785  unsigned getParamIndex() const LLVM_READONLY {
786  assert(isParamIndexValid());
787  assert(!isVarArgParam());
788  return ParamIndex;
789  }
790 
791  void setParamIndex(unsigned Index) {
792  ParamIndex = Index;
793  assert(isParamIndexValid());
794  assert(!isVarArgParam());
795  }
796 };
797 
798 /// Doxygen \\tparam command, describes a template parameter.
800 private:
801  /// If this template parameter name was resolved (found in template parameter
802  /// list), then this stores a list of position indexes in all template
803  /// parameter lists.
804  ///
805  /// For example:
806  /// \verbatim
807  /// template<typename C, template<typename T> class TT>
808  /// void test(TT<int> aaa);
809  /// \endverbatim
810  /// For C: Position = { 0 }
811  /// For TT: Position = { 1 }
812  /// For T: Position = { 1, 0 }
813  ArrayRef<unsigned> Position;
814 
815 public:
817  SourceLocation LocEnd,
818  unsigned CommandID,
819  CommandMarkerKind CommandMarker) :
820  BlockCommandComment(TParamCommandCommentKind, LocBegin, LocEnd, CommandID,
821  CommandMarker)
822  { }
823 
824  static bool classof(const Comment *C) {
825  return C->getCommentKind() == TParamCommandCommentKind;
826  }
827 
828  bool hasParamName() const {
829  return getNumArgs() > 0;
830  }
831 
832  StringRef getParamName(const FullComment *FC) const;
833 
834  StringRef getParamNameAsWritten() const {
835  return Args[0].Text;
836  }
837 
839  return Args[0].Range;
840  }
841 
842  bool isPositionValid() const LLVM_READONLY {
843  return !Position.empty();
844  }
845 
846  unsigned getDepth() const {
847  assert(isPositionValid());
848  return Position.size();
849  }
850 
851  unsigned getIndex(unsigned Depth) const {
852  assert(isPositionValid());
853  return Position[Depth];
854  }
855 
856  void setPosition(ArrayRef<unsigned> NewPosition) {
857  Position = NewPosition;
858  assert(isPositionValid());
859  }
860 };
861 
862 /// A line of text contained in a verbatim block.
864  StringRef Text;
865 
866 public:
868  StringRef Text) :
869  Comment(VerbatimBlockLineCommentKind,
870  LocBegin,
871  LocBegin.getLocWithOffset(Text.size())),
872  Text(Text)
873  { }
874 
875  static bool classof(const Comment *C) {
876  return C->getCommentKind() == VerbatimBlockLineCommentKind;
877  }
878 
879  child_iterator child_begin() const { return nullptr; }
880 
881  child_iterator child_end() const { return nullptr; }
882 
883  StringRef getText() const LLVM_READONLY {
884  return Text;
885  }
886 };
887 
888 /// A verbatim block command (e. g., preformatted code). Verbatim block has an
889 /// opening and a closing command and contains multiple lines of text
890 /// (VerbatimBlockLineComment nodes).
892 protected:
893  StringRef CloseName;
896 
897 public:
899  SourceLocation LocEnd,
900  unsigned CommandID) :
901  BlockCommandComment(VerbatimBlockCommentKind,
902  LocBegin, LocEnd, CommandID,
903  CMK_At) // FIXME: improve source fidelity.
904  { }
905 
906  static bool classof(const Comment *C) {
907  return C->getCommentKind() == VerbatimBlockCommentKind;
908  }
909 
911  return reinterpret_cast<child_iterator>(Lines.begin());
912  }
913 
915  return reinterpret_cast<child_iterator>(Lines.end());
916  }
917 
918  void setCloseName(StringRef Name, SourceLocation LocBegin) {
919  CloseName = Name;
920  CloseNameLocBegin = LocBegin;
921  }
922 
924  Lines = L;
925  }
926 
927  StringRef getCloseName() const {
928  return CloseName;
929  }
930 
931  unsigned getNumLines() const {
932  return Lines.size();
933  }
934 
935  StringRef getText(unsigned LineIdx) const {
936  return Lines[LineIdx]->getText();
937  }
938 };
939 
940 /// A verbatim line command. Verbatim line has an opening command, a single
941 /// line of text (up to the newline after the opening command) and has no
942 /// closing command.
944 protected:
945  StringRef Text;
947 
948 public:
950  SourceLocation LocEnd,
951  unsigned CommandID,
953  StringRef Text) :
954  BlockCommandComment(VerbatimLineCommentKind,
955  LocBegin, LocEnd,
956  CommandID,
957  CMK_At), // FIXME: improve source fidelity.
958  Text(Text),
960  { }
961 
962  static bool classof(const Comment *C) {
963  return C->getCommentKind() == VerbatimLineCommentKind;
964  }
965 
966  child_iterator child_begin() const { return nullptr; }
967 
968  child_iterator child_end() const { return nullptr; }
969 
970  StringRef getText() const {
971  return Text;
972  }
973 
975  return SourceRange(TextBegin, getEndLoc());
976  }
977 };
978 
979 /// Information about the declaration, useful to clients of FullComment.
980 struct DeclInfo {
981  /// Declaration the comment is actually attached to (in the source).
982  /// Should not be NULL.
984 
985  /// CurrentDecl is the declaration with which the FullComment is associated.
986  ///
987  /// It can be different from \c CommentDecl. It happens when we decide
988  /// that the comment originally attached to \c CommentDecl is fine for
989  /// \c CurrentDecl too (for example, for a redeclaration or an overrider of
990  /// \c CommentDecl).
991  ///
992  /// The information in the DeclInfo corresponds to CurrentDecl.
994 
995  /// Parameters that can be referenced by \\param if \c CommentDecl is something
996  /// that we consider a "function".
998 
999  /// Function return type if \c CommentDecl is something that we consider
1000  /// a "function".
1002 
1003  /// Template parameters that can be referenced by \\tparam if \c CommentDecl is
1004  /// a template (\c IsTemplateDecl or \c IsTemplatePartialSpecialization is
1005  /// true).
1007 
1008  /// A simplified description of \c CommentDecl kind that should be good enough
1009  /// for documentation rendering purposes.
1010  enum DeclKind {
1011  /// Everything else not explicitly mentioned below.
1013 
1014  /// Something that we consider a "function":
1015  /// \li function,
1016  /// \li function template,
1017  /// \li function template specialization,
1018  /// \li member function,
1019  /// \li member function template,
1020  /// \li member function template specialization,
1021  /// \li ObjC method,
1022  /// \li a typedef for a function pointer, member function pointer,
1023  /// ObjC block.
1025 
1026  /// Something that we consider a "class":
1027  /// \li class/struct,
1028  /// \li class template,
1029  /// \li class template (partial) specialization.
1031 
1032  /// Something that we consider a "variable":
1033  /// \li namespace scope variables;
1034  /// \li static and non-static class data members;
1035  /// \li enumerators.
1037 
1038  /// A C++ namespace.
1040 
1041  /// A C++ typedef-name (a 'typedef' decl specifier or alias-declaration),
1042  /// see \c TypedefNameDecl.
1044 
1045  /// An enumeration or scoped enumeration.
1047  };
1048 
1049  /// What kind of template specialization \c CommentDecl is.
1055  };
1056 
1057  /// If false, only \c CommentDecl is valid.
1058  unsigned IsFilled : 1;
1059 
1060  /// Simplified kind of \c CommentDecl, see \c DeclKind enum.
1061  unsigned Kind : 3;
1062 
1063  /// Is \c CommentDecl a template declaration.
1064  unsigned TemplateKind : 2;
1065 
1066  /// Is \c CommentDecl an ObjCMethodDecl.
1067  unsigned IsObjCMethod : 1;
1068 
1069  /// Is \c CommentDecl a non-static member function of C++ class or
1070  /// instance method of ObjC class.
1071  /// Can be true only if \c IsFunctionDecl is true.
1072  unsigned IsInstanceMethod : 1;
1073 
1074  /// Is \c CommentDecl a static member function of C++ class or
1075  /// class method of ObjC class.
1076  /// Can be true only if \c IsFunctionDecl is true.
1077  unsigned IsClassMethod : 1;
1078 
1079  void fill();
1080 
1081  DeclKind getKind() const LLVM_READONLY {
1082  return static_cast<DeclKind>(Kind);
1083  }
1084 
1085  TemplateDeclKind getTemplateKind() const LLVM_READONLY {
1086  return static_cast<TemplateDeclKind>(TemplateKind);
1087  }
1088 };
1089 
1090 /// A full comment attached to a declaration, contains block content.
1091 class FullComment : public Comment {
1093  DeclInfo *ThisDeclInfo;
1094 
1095 public:
1097  Comment(FullCommentKind, SourceLocation(), SourceLocation()),
1098  Blocks(Blocks), ThisDeclInfo(D) {
1099  if (Blocks.empty())
1100  return;
1101 
1103  SourceRange(Blocks.front()->getBeginLoc(), Blocks.back()->getEndLoc()));
1104  setLocation(Blocks.front()->getBeginLoc());
1105  }
1106 
1107  static bool classof(const Comment *C) {
1108  return C->getCommentKind() == FullCommentKind;
1109  }
1110 
1112  return reinterpret_cast<child_iterator>(Blocks.begin());
1113  }
1114 
1116  return reinterpret_cast<child_iterator>(Blocks.end());
1117  }
1118 
1119  const Decl *getDecl() const LLVM_READONLY {
1120  return ThisDeclInfo->CommentDecl;
1121  }
1122 
1123  const DeclInfo *getDeclInfo() const LLVM_READONLY {
1124  if (!ThisDeclInfo->IsFilled)
1125  ThisDeclInfo->fill();
1126  return ThisDeclInfo;
1127  }
1128 
1129  ArrayRef<BlockContentComment *> getBlocks() const { return Blocks; }
1130 
1131 };
1132 } // end namespace comments
1133 } // end namespace clang
1134 
1135 #endif
1136 
clang::comments::InlineContentComment::hasTrailingNewline
bool hasTrailingNewline() const
Definition: Comment.h:255
clang::comments::DeclInfo::EnumKind
@ EnumKind
An enumeration or scoped enumeration.
Definition: Comment.h:1046
clang::comments::ParagraphComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:568
clang::comments::ParamCommandComment::getDirectionAsString
static const char * getDirectionAsString(PassDirection D)
Definition: Comment.cpp:192
clang::comments::HTMLStartTagComment::Attribute::Attribute
Attribute(SourceLocation NameLocBegin, StringRef Name)
Definition: Comment.h:427
clang::comments::tok::text
@ text
Definition: CommentLexer.h:35
clang::comments::TParamCommandComment::isPositionValid
bool isPositionValid() const LLVM_READONLY
Definition: Comment.h:842
clang::comments::FullComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:1107
clang::comments::VerbatimLineComment
A verbatim line command.
Definition: Comment.h:943
clang::comments::VerbatimBlockLineComment::getText
StringRef getText() const LLVM_READONLY
Definition: Comment.h:883
clang::comments::Comment::TextCommentBits
TextCommentBitfields TextCommentBits
Definition: Comment.h:168
clang::comments::Comment::dumpColor
void dumpColor() const
Definition: ASTDumper.cpp:268
clang::comments::Comment::CommentBitfields
Definition: Comment.h:60
clang::comments::TextComment::child_end
child_iterator child_end() const
Definition: Comment.h:279
clang::comments::DeclInfo::NamespaceKind
@ NamespaceKind
A C++ namespace.
Definition: Comment.h:1039
clang::comments::ParamCommandComment::Out
@ Out
Definition: Comment.h:739
clang::comments::InlineCommandComment::getArgText
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:360
clang::comments::InlineCommandComment::RenderEmphasized
@ RenderEmphasized
Definition: Comment.h:312
type
clang::comments::Comment::NoCommentKind
@ NoCommentKind
Definition: Comment.h:187
clang::comments::ParamCommandComment::isDirectionExplicit
bool isDirectionExplicit() const LLVM_READONLY
Definition: Comment.h:749
Nodes
BoundNodesTreeBuilder Nodes
Definition: ASTMatchFinder.cpp:82
clang::comments::ParamCommandComment::isParamIndexValid
bool isParamIndexValid() const LLVM_READONLY
Definition: Comment.h:772
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:212
clang::comments::ParamCommandComment::getParamNameRange
SourceRange getParamNameRange() const
Definition: Comment.h:768
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::comments::HTMLStartTagComment::getNumAttrs
unsigned getNumAttrs() const
Definition: Comment.h:472
clang::ast_matchers::stmt
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
Definition: ASTMatchersInternal.cpp:809
clang::frontend::RewriteTest
@ RewriteTest
Rewriter playground.
Definition: FrontendOptions.h:124
clang::comments::VerbatimBlockComment::getCloseName
StringRef getCloseName() const
Definition: Comment.h:927
clang::comments::Comment::HTMLTagCommentBits
HTMLTagCommentBitfields HTMLTagCommentBits
Definition: Comment.h:170
clang::comments::BlockCommandComment::setArgs
void setArgs(ArrayRef< Argument > A)
Definition: Comment.h:680
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:997
clang::comments::ParagraphComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:572
clang::comments::HTMLStartTagComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:464
clang::comments::Comment::child_count
unsigned child_count() const
Definition: Comment.h:229
include
include(CheckIncludeFiles) set(LLVM_LINK_COMPONENTS support) set(DIRECTORY_WATCHER_SOURCES DirectoryScanner.cpp) set(DIRECTORY_WATCHER_LINK_LIBS "") if(APPLE) check_include_files("CoreServices/CoreServices.h" HAVE_CORESERVICES) if(HAVE_CORESERVICES) list(APPEND DIRECTORY_WATCHER_SOURCES mac/DirectoryWatcher-mac.cpp) set(DIRECTORY_WATCHER_LINK_LIBS "-framework CoreServices") endif() elseif(CMAKE_SYSTEM_NAME MATCHES "Linux") check_include_files("sys/inotify.h" HAVE_INOTIFY) if(HAVE_INOTIFY) list(APPEND DIRECTORY_WATCHER_SOURCES linux/DirectoryWatcher-linux.cpp) find_package(Threads REQUIRED) endif() elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") list(APPEND DIRECTORY_WATCHER_SOURCES windows/DirectoryWatcher-windows.cpp) else() list(APPEND DIRECTORY_WATCHER_SOURCES default/DirectoryWatcher-not-implemented.cpp) endif() add_clang_library(clangDirectoryWatcher $
Definition: CMakeLists.txt:1
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::comments::ParamCommandComment::getDirection
PassDirection getDirection() const LLVM_READONLY
Definition: Comment.h:745
clang::SourceLocation::getLocWithOffset
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
Definition: SourceLocation.h:136
clang::comments::HTMLTagComment::TagNameRange
SourceRange TagNameRange
Definition: Comment.h:374
clang::SourceRange::getBegin
SourceLocation getBegin() const
Definition: SourceLocation.h:221
clang::comments::Comment::Loc
SourceLocation Loc
Preferred location to show caret.
Definition: Comment.h:55
clang::comments::HTMLEndTagComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:519
target_link_libraries
target_link_libraries(clangDirectoryWatcher PUBLIC ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(clangDirectoryWatcher PRIVATE $
Definition: CMakeLists.txt:30
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:673
clang::comments::Comment::NumInlineContentCommentBits
@ NumInlineContentCommentBits
Definition: Comment.h:77
clang::comments::DeclInfo::TemplatePartialSpecialization
@ TemplatePartialSpecialization
Definition: Comment.h:1054
clang::comments::BlockCommandComment::getCommandID
unsigned getCommandID() const
Definition: Comment.h:650
clang::comments::InlineCommandComment::getCommandName
StringRef getCommandName(const CommandTraits &Traits) const
Definition: Comment.h:344
clang::comments::BlockCommandComment::getParagraph
ParagraphComment * getParagraph() const LLVM_READONLY
Definition: Comment.h:689
clang::comments::BlockCommandComment::getArgRange
SourceRange getArgRange(unsigned Idx) const
Definition: Comment.h:676
clang::comments::InlineCommandComment::Argument::Range
SourceRange Range
Definition: Comment.h:300
clang::comments::TParamCommandComment::getDepth
unsigned getDepth() const
Definition: Comment.h:846
clang::comments::FullComment::FullComment
FullComment(ArrayRef< BlockContentComment * > Blocks, DeclInfo *D)
Definition: Comment.h:1096
clang::comments::VerbatimLineComment::child_end
child_iterator child_end() const
Definition: Comment.h:968
clang::comments::TParamCommandComment::getIndex
unsigned getIndex(unsigned Depth) const
Definition: Comment.h:851
clang::comments::VerbatimLineComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:962
clang::comments::DeclInfo::IsFilled
unsigned IsFilled
If false, only CommentDecl is valid.
Definition: Comment.h:1058
clang::comments::VerbatimBlockLineComment::child_end
child_iterator child_end() const
Definition: Comment.h:881
clang::comments::HTMLTagComment::getTagNameSourceRange
SourceRange getTagNameSourceRange() const LLVM_READONLY
Definition: Comment.h:397
clang::comments::VerbatimBlockComment::child_end
child_iterator child_end() const
Definition: Comment.h:914
clang::transformer::Stencil
std::shared_ptr< StencilInterface > Stencil
A sequence of code fragments, references to parameters and code-generation operations that together c...
Definition: Stencil.h:46
clang::comments::HTMLStartTagComment::Attribute::NameLocBegin
SourceLocation NameLocBegin
Definition: Comment.h:417
clang::comments::BlockCommandComment::getArgText
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:672
clang::comments::Comment::ParamCommandCommentBitfields
Definition: Comment.h:152
clang::comments::Comment::NumTextCommentBits
@ NumTextCommentBits
Definition: Comment.h:90
clang::comments::TextComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:273
clang::comments::Comment::ParagraphCommentBitfields
Definition: Comment.h:125
clang::comments::VerbatimBlockComment::getNumLines
unsigned getNumLines() const
Definition: Comment.h:931
clang::comments::Comment::getCommentKindName
const char * getCommentKindName() const
Definition: Comment.cpp:35
clang::comments::ParamCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:733
clang::comments::HTMLEndTagComment
A closing HTML tag.
Definition: Comment.h:507
clang::comments::Comment::InlineCommandCommentBits
InlineCommandCommentBitfields InlineCommandCommentBits
Definition: Comment.h:169
clang::ento::Store
const void * Store
Store - This opaque type encapsulates an immutable mapping from locations to values.
Definition: StoreRef.h:27
clang::comments::InlineContentComment
Inline content (contained within a block).
Definition: Comment.h:236
clang::comments::DeclInfo::TemplateDeclKind
TemplateDeclKind
What kind of template specialization CommentDecl is.
Definition: Comment.h:1050
clang::comments::ParamCommandComment::setParamIndex
void setParamIndex(unsigned Index)
Definition: Comment.h:791
clang::AttrSyntax::Pragma
@ Pragma
clang::comments::Comment::CommentBits
CommentBitfields CommentBits
Definition: Comment.h:166
clang::comments::InlineCommandComment::RenderMonospaced
@ RenderMonospaced
Definition: Comment.h:311
clang::frontend::RewriteObjC
@ RewriteObjC
ObjC->C Rewriter.
Definition: FrontendOptions.h:121
clang::transformer::RangeSelector
MatchConsumer< CharSourceRange > RangeSelector
Definition: RangeSelector.h:27
clang::comments::DeclInfo::CommentDecl
const Decl * CommentDecl
Declaration the comment is actually attached to (in the source).
Definition: Comment.h:983
clang::ast_matchers::traverse
internal::Matcher< T > traverse(TraversalKind TK, const internal::Matcher< T > &InnerMatcher)
Causes all nested matchers to be matched with the specified traversal kind.
Definition: ASTMatchers.h:813
clang::comments::HTMLStartTagComment::child_end
child_iterator child_end() const
Definition: Comment.h:470
clang::comments::ParamCommandComment::InvalidParamIndex
@ InvalidParamIndex
Definition: Comment.h:718
clang::comments::InlineCommandComment::Argument::Argument
Argument(SourceRange Range, StringRef Text)
Definition: Comment.h:303
clang::comments::CommandTraits::getCommandInfo
const CommandInfo * getCommandInfo(StringRef Name) const
Definition: CommentCommandTraits.h:145
macro
macro(clang_diag_gen component) clang_tablegen(Diagnostic$
Definition: CMakeLists.txt:1
clang::comments::InlineCommandComment
A command with word-like arguments that is considered inline content.
Definition: Comment.h:297
clang::comments::BlockCommandComment::BlockCommandComment
BlockCommandComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
Definition: Comment.h:626
clang::frontend::GeneratePCH
@ GeneratePCH
Generate pre-compiled header.
Definition: FrontendOptions.h:91
DeclObjC.h
clang::comments::DeclInfo::CurrentDecl
const Decl * CurrentDecl
CurrentDecl is the declaration with which the FullComment is associated.
Definition: Comment.h:993
clang::comments::TParamCommandComment::getParamNameRange
SourceRange getParamNameRange() const
Definition: Comment.h:838
clang::CodeGen::AlignmentSource::Decl
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
clang::comments::HTMLTagComment::TagName
StringRef TagName
Definition: Comment.h:373
clang::comments::ParamCommandComment::ParamCommandComment
ParamCommandComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
Definition: Comment.h:722
clang::comments::HTMLEndTagComment::HTMLEndTagComment
HTMLEndTagComment(SourceLocation LocBegin, SourceLocation LocEnd, StringRef TagName)
Definition: Comment.h:509
clang::comments::BlockCommandComment::BlockCommandComment
BlockCommandComment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
Definition: Comment.h:613
clang::comments::InlineCommandComment::RenderBold
@ RenderBold
Definition: Comment.h:310
U
clang::comments::VerbatimBlockLineComment
A line of text contained in a verbatim block.
Definition: Comment.h:863
clang::comments::ParamCommandComment
Doxygen \param command.
Definition: Comment.h:711
clang::comments::Comment
Any part of the comment.
Definition: Comment.h:52
clang::comments::InlineCommandComment::getRenderKind
RenderKind getRenderKind() const
Definition: Comment.h:352
clang::ast_matchers::attr
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
Definition: ASTMatchersInternal.cpp:1029
clang_tablegen
clang_tablegen(AttrParserStringSwitches.inc -gen-clang-attr-parser-string-switches -I ${CMAKE_CURRENT_SOURCE_DIR}/../../SOURCE ../Basic/Attr.td TARGET ClangAttrParserStringSwitches) clang_tablegen(AttrSubMatchRulesParserStringSwitches.inc -gen-clang-attr-subject-match-rules-parser-string-switches -I $
Definition: CMakeLists.txt:1
not
#define not
Definition: iso646.h:19
clang::comments::BlockCommandComment::child_end
child_iterator child_end() const
Definition: Comment.h:646
clang::comments::FullComment::getDecl
const Decl * getDecl() const LLVM_READONLY
Definition: Comment.h:1119
clang::comments::BlockCommandComment::Paragraph
ParagraphComment * Paragraph
Paragraph argument.
Definition: Comment.h:611
clang::comments::InlineCommandComment::getCommandNameRange
SourceRange getCommandNameRange() const
Definition: Comment.h:348
clang::comments::BlockCommandComment::Args
ArrayRef< Argument > Args
Word-like arguments.
Definition: Comment.h:608
clang::comments::VerbatimBlockComment::CloseName
StringRef CloseName
Definition: Comment.h:893
clang::comments::ParamCommandComment::getParamNameAsWritten
StringRef getParamNameAsWritten() const
Definition: Comment.h:764
clang::comments::Comment::ParagraphCommentBits
ParagraphCommentBitfields ParagraphCommentBits
Definition: Comment.h:172
clang::comments::DeclInfo::TypedefKind
@ TypedefKind
A C++ typedef-name (a 'typedef' decl specifier or alias-declaration), see TypedefNameDecl.
Definition: Comment.h:1043
clang::comments::ParamCommandComment::setIsVarArgParam
void setIsVarArgParam()
Definition: Comment.h:780
clang::SourceRange::getEnd
SourceLocation getEnd() const
Definition: SourceLocation.h:222
clang::comments::Comment::InlineContentCommentBitfields
Definition: Comment.h:68
EXPR
#define EXPR(type, base)
clang::comments::HTMLTagComment::setIsMalformed
void setIsMalformed()
Definition: Comment.h:407
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:212
clang::comments::HTMLStartTagComment::Attribute::Attribute
Attribute(SourceLocation NameLocBegin, StringRef Name, SourceLocation EqualsLoc, SourceRange ValueRange, StringRef Value)
Definition: Comment.h:433
clang::comments::Comment::child_begin
child_iterator child_begin() const
Definition: Comment.cpp:82
clang::comments::VerbatimLineComment::VerbatimLineComment
VerbatimLineComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, SourceLocation TextBegin, StringRef Text)
Definition: Comment.h:949
clang::comments::Comment::TextCommentBitfields
Definition: Comment.h:79
clang::comments::VerbatimLineComment::getTextRange
SourceRange getTextRange() const
Definition: Comment.h:974
clang::comments::HTMLStartTagComment::setGreaterLoc
void setGreaterLoc(SourceLocation GreaterLoc)
Definition: Comment.h:493
Depth
int Depth
Definition: ASTDiff.cpp:191
clang::comments::InlineContentComment::InlineContentComment
InlineContentComment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd)
Definition: Comment.h:238
clang::comments::TextComment::getText
StringRef getText() const LLVM_READONLY
Definition: Comment.h:281
clang::comments::ParamCommandComment::In
@ In
Definition: Comment.h:738
clang::comments::TParamCommandComment::setPosition
void setPosition(ArrayRef< unsigned > NewPosition)
Definition: Comment.h:856
clang::comments::BlockCommandComment::getNumArgs
unsigned getNumArgs() const
Definition: Comment.h:668
clang::comments::HTMLStartTagComment::Attribute::getNameRange
SourceRange getNameRange() const
Definition: Comment.h:445
clang::comments::VerbatimLineComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:966
clang::comments::Comment::HTMLTagCommentBitfields
Definition: Comment.h:104
clang::comments::DeclInfo::getKind
DeclKind getKind() const LLVM_READONLY
Definition: Comment.h:1081
clang::interp::PrimType
PrimType
Enumeration of the primitive types of the VM.
Definition: PrimType.h:27
clang::comments::CommandInfo::Name
const char * Name
Definition: CommentCommandTraits.h:37
clang::comments::HTMLStartTagComment::getAttr
const Attribute & getAttr(unsigned Idx) const
Definition: Comment.h:476
clang::comments::FullComment
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1091
clang::comments::InlineCommandComment::child_end
child_iterator child_end() const
Definition: Comment.h:338
set
set(LLVM_LINK_COMPONENTS Support) set(LLVM_EXPORTED_SYMBOL_FILE $
Definition: CMakeLists.txt:1
clang::comments::InlineCommandComment::getNumArgs
unsigned getNumArgs() const
Definition: Comment.h:356
if
lib PATH_LIB_START REVERSE if(PATH_LIB_START EQUAL -1) message(FATAL_ERROR "Couldn't find lib component in binary directory") endif() math(EXPR PATH_LIB_END "$
Definition: CMakeLists.txt:18
Type.h
clang::comments::Comment::NumParagraphCommentBits
@ NumParagraphCommentBits
Definition: Comment.h:136
clang::comments::VerbatimBlockComment::CloseNameLocBegin
SourceLocation CloseNameLocBegin
Definition: Comment.h:894
clang::comments::DeclInfo::OtherKind
@ OtherKind
Everything else not explicitly mentioned below.
Definition: Comment.h:1012
clang::comments::CommandMarkerKind
CommandMarkerKind
Describes the syntax that was used in a documentation command.
Definition: Comment.h:36
clang::comments::HTMLTagComment
Abstract class for opening and closing HTML tags.
Definition: Comment.h:371
clang::comments::Comment::NumInlineCommandCommentBits
@ NumInlineCommandCommentBits
Definition: Comment.h:101
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:1006
clang::comments::BlockCommandComment
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:596
clang::comments::InlineCommandComment::Argument::Text
StringRef Text
Definition: Comment.h:301
clang::comments::ParamCommandComment::isVarArgParam
bool isVarArgParam() const LLVM_READONLY
Definition: Comment.h:776
clang::comments::DeclInfo::FunctionKind
@ FunctionKind
Something that we consider a "function":
Definition: Comment.h:1024
clang::TemplateParameterList
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:69
clang::SourceRange::setEnd
void setEnd(SourceLocation e)
Definition: SourceLocation.h:225
clang::SelectorLocationsKind
SelectorLocationsKind
Whether all locations of the selector identifiers are in a "standard" position.
Definition: SelectorLocationsKind.h:27
clang::comments::DeclInfo::Template
@ Template
Definition: Comment.h:1052
clang::frontend::RewriteMacros
@ RewriteMacros
Expand macros but not #includes.
Definition: FrontendOptions.h:118
clang::comments::CMK_Backslash
@ CMK_Backslash
Command started with a backslash character:
Definition: Comment.h:41
clang::comments::DeclInfo::fill
void fill()
Definition: Comment.cpp:204
clang::comments::HTMLTagComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:390
clang::comments::ParamCommandComment::InOut
@ InOut
Definition: Comment.h:740
clang::comments::HTMLStartTagComment::Attribute::getNameLocEnd
SourceLocation getNameLocEnd() const
Definition: Comment.h:441
COMMENT
#define COMMENT(CLASS, PARENT)
Definition: Comment.h:188
clang::comments::BlockCommandComment::Argument
Definition: Comment.h:598
clang::ExecuteCompilerInvocation
bool ExecuteCompilerInvocation(CompilerInstance *Clang)
ExecuteCompilerInvocation - Execute the given actions described by the compiler invocation object in ...
Definition: ExecuteCompilerInvocation.cpp:187
clang::comments::DeclInfo::IsObjCMethod
unsigned IsObjCMethod
Is CommentDecl an ObjCMethodDecl.
Definition: Comment.h:1067
clang::comments::VerbatimBlockComment::setLines
void setLines(ArrayRef< VerbatimBlockLineComment * > L)
Definition: Comment.h:923
clang::comments::BlockCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:637
clang::comments::Comment::HTMLStartTagCommentBitfields
Definition: Comment.h:114
clang::comments::ParamCommandComment::setDirection
void setDirection(PassDirection Direction, bool Explicit)
Definition: Comment.h:753
clang::comments::HTMLStartTagComment
An opening HTML tag with attributes.
Definition: Comment.h:413
clang::comments::BlockCommandComment::getCommandName
StringRef getCommandName(const CommandTraits &Traits) const
Definition: Comment.h:654
clang::comments::ParamCommandComment::hasParamName
bool hasParamName() const
Definition: Comment.h:758
clang::comments::DeclInfo::TemplateKind
unsigned TemplateKind
Is CommentDecl a template declaration.
Definition: Comment.h:1064
clang::comments::Comment::setSourceRange
void setSourceRange(SourceRange SR)
Definition: Comment.h:177
clang::comments::BlockContentComment::BlockContentComment
BlockContentComment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd)
Definition: Comment.h:532
clang::comments::ParamCommandComment::getParamName
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:371
clang::comments::DeclInfo::DeclKind
DeclKind
A simplified description of CommentDecl kind that should be good enough for documentation rendering p...
Definition: Comment.h:1010
clang::comments::HTMLStartTagComment::HTMLStartTagComment
HTMLStartTagComment(SourceLocation LocBegin, StringRef TagName)
Definition: Comment.h:454
clang::comments::VerbatimBlockLineComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:879
clang::comments::TParamCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:824
clang::comments::VerbatimBlockComment::setCloseName
void setCloseName(StringRef Name, SourceLocation LocBegin)
Definition: Comment.h:918
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:1072
clang::comments::HTMLEndTagComment::child_end
child_iterator child_end() const
Definition: Comment.h:525
clang::comments::CommandInfo::NumCommandIDBits
@ NumCommandIDBits
Definition: CommentCommandTraits.h:43
clang::comments::InlineCommandComment::InlineCommandComment
InlineCommandComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, RenderKind RK, ArrayRef< Argument > Args)
Definition: Comment.h:321
clang::comments::Comment::NumParamCommandCommentBits
@ NumParamCommandCommentBits
Definition: Comment.h:163
SourceLocation.h
clang::ast_matchers::decl
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
Definition: ASTMatchersInternal.cpp:734
P
StringRef P
Definition: ASTMatchersInternal.cpp:563
clang::comments::VerbatimBlockComment::Lines
ArrayRef< VerbatimBlockLineComment * > Lines
Definition: Comment.h:895
clang::comments::ParagraphComment::child_end
child_iterator child_end() const
Definition: Comment.h:576
clang::comments::InlineCommandComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:336
clang::comments::FullComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:1111
clang::comments::HTMLStartTagComment::Attribute::Attribute
Attribute()
Definition: Comment.h:425
clang::comments::VerbatimBlockComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:906
clang::comments::Comment::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Comment.h:218
clang::comments::VerbatimLineComment::TextBegin
SourceLocation TextBegin
Definition: Comment.h:946
clang::comments::Comment::ParamCommandCommentBits
ParamCommandCommentBitfields ParamCommandCommentBits
Definition: Comment.h:174
clang::comments::DeclInfo::VariableKind
@ VariableKind
Something that we consider a "variable":
Definition: Comment.h:1036
clang::comments::ParagraphComment::ParagraphComment
ParagraphComment(ArrayRef< InlineContentComment * > Content)
Definition: Comment.h:550
clang::comments::HTMLStartTagComment::Attribute::ValueRange
SourceRange ValueRange
Definition: Comment.h:422
clang::comments::BlockContentComment
Block content (contains inline content).
Definition: Comment.h:530
clang::comments::BlockCommandComment::Argument::Argument
Argument()
Definition: Comment.h:602
clang::comments::DeclInfo
Information about the declaration, useful to clients of FullComment.
Definition: Comment.h:980
clang::comments::DeclInfo::Kind
unsigned Kind
Simplified kind of CommentDecl, see DeclKind enum.
Definition: Comment.h:1061
clang::comments::CMK_At
@ CMK_At
Command started with an 'at' character:
Definition: Comment.h:47
dump
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Definition: CoverageMappingGen.cpp:1521
clang::comments::TParamCommandComment::getParamNameAsWritten
StringRef getParamNameAsWritten() const
Definition: Comment.h:834
clang::comments::VerbatimBlockLineComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:875
clang::comments::Comment::InlineContentCommentBits
InlineContentCommentBitfields InlineContentCommentBits
Definition: Comment.h:167
clang::comments::BlockCommandComment::Argument::Text
StringRef Text
Definition: Comment.h:600
clang::comments::TParamCommandComment
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:799
llvm::ArrayRef
Definition: LLVM.h:34
Value
Value
Definition: UninitializedValues.cpp:102
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:89
ProgramState
and static some checkers Checker The latter are built on top of the former via the Checker and CheckerVisitor and attempts to isolate them from much of the gore of the internal analysis the analyzer is basically a source code simulator that traces out possible paths of execution The state of the and the combination of state and program point is a node in an exploded which has the entry program point and initial and then simulate transitions by analyzing individual expressions The analysis of an expression can cause the state to resulting in a new node in the ExplodedGraph with an updated program point and an updated state A bug is found by hitting a node that satisfies some bug condition(basically a violation of a checking invariant). The analyzer traces out multiple paths by reasoning about branches and then bifurcating the state it can contain cycles as paths loop back onto each other and cache out ProgramState and ExplodedNodes are basically immutable once created Once one creates a ProgramState
Definition: README.txt:34
clang::comments::HTMLTagComment::isMalformed
bool isMalformed() const
Definition: Comment.h:403
clang::comments::BlockCommandComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:642
clang::comments::Comment::Comment
Comment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd)
Definition: Comment.h:197
clang::comments::Comment::CommentKind
CommentKind
Definition: Comment.h:186
clang::comments::Comment::BlockCommandCommentBits
BlockCommandCommentBitfields BlockCommandCommentBits
Definition: Comment.h:173
clang::comments::BlockCommandComment::setParagraph
void setParagraph(ParagraphComment *PC)
Definition: Comment.h:697
clang::comments::FullComment::getDeclInfo
const DeclInfo * getDeclInfo() const LLVM_READONLY
Definition: Comment.h:1123
clang::comments::HTMLStartTagComment::Attribute::EqualsLoc
SourceLocation EqualsLoc
Definition: Comment.h:420
clang::comments::Comment::NumCommentBits
@ NumCommentBits
Definition: Comment.h:66
State
LineState State
Definition: UnwrappedLineFormatter.cpp:986
clang::comments::BlockCommandComment::getCommandNameRange
SourceRange getCommandNameRange(const CommandTraits &Traits) const
Definition: Comment.h:662
clang::comments::TextComment::isWhitespace
bool isWhitespace() const
Definition: Comment.h:283
clang::comments::TextComment::TextComment
TextComment(SourceLocation LocBegin, SourceLocation LocEnd, StringRef Text)
Definition: Comment.h:265
clang::comments::BlockCommandComment::Argument::Argument
Argument(SourceRange Range, StringRef Text)
Definition: Comment.h:603
clang::comments::BlockCommandComment::getCommandMarker
CommandMarkerKind getCommandMarker() const LLVM_READONLY
Definition: Comment.h:704
clang::comments::InlineCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:332
clang::comments::ParamCommandComment::PassDirection
PassDirection
Definition: Comment.h:737
clang::comments::Comment::getBeginLoc
SourceLocation getBeginLoc() const LLVM_READONLY
Definition: Comment.h:216
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::comments::InlineCommandComment::getCommandID
unsigned getCommandID() const
Definition: Comment.h:340
clang::comments::Comment::HTMLStartTagCommentBits
HTMLStartTagCommentBitfields HTMLStartTagCommentBits
Definition: Comment.h:171
clang::comments::Comment::NumHTMLTagCommentBits
@ NumHTMLTagCommentBits
Definition: Comment.h:112
clang::comments::BlockCommandComment::getCommandNameBeginLoc
SourceLocation getCommandNameBeginLoc() const
Definition: Comment.h:658
clang::comments::TextComment
Plain text.
Definition: Comment.h:261
clang::comments::InlineCommandComment::RenderKind
RenderKind
The most appropriate rendering mode for this command, chosen on command semantics in Doxygen.
Definition: Comment.h:308
clang::comments::DeclInfo::TemplateSpecialization
@ TemplateSpecialization
Definition: Comment.h:1053
clang
Definition: CalledOnceCheck.h:17
Text
StringRef Text
Definition: Format.cpp:2334
clang::comments::InlineContentComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:246
clang::comments::Comment::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
Definition: Comment.h:214
clang::comments::Comment::NumBlockCommandCommentBits
@ NumBlockCommandCommentBits
Definition: Comment.h:149
clang::comments::VerbatimBlockComment::getText
StringRef getText(unsigned LineIdx) const
Definition: Comment.h:935
clang::comments::HTMLTagComment::getTagName
StringRef getTagName() const LLVM_READONLY
Definition: Comment.h:395
CheckObjCInstMethSignature
static void CheckObjCInstMethSignature(const ObjCImplementationDecl *ID, BugReporter &BR, const CheckerBase *Checker)
Definition: CheckObjCInstMethSignature.cpp:78
endif
endif() if(clang_vc AND LLVM_APPEND_VC_REV) set(clang_source_dir $
Definition: CMakeLists.txt:15
clang::comments::VerbatimBlockComment
A verbatim block command (e.
Definition: Comment.h:891
clang::comments::ParamCommandComment::getParamIndex
unsigned getParamIndex() const LLVM_READONLY
Definition: Comment.h:785
clang::ast_matchers::match
SmallVector< BoundNodes, 1 > match(MatcherT Matcher, const NodeT &Node, ASTContext &Context)
Returns the results of matching Matcher on Node.
Definition: ASTMatchFinder.h:312
clang::comments::InlineCommandComment::Argument
Definition: Comment.h:299
clang::comments::FullComment::getBlocks
ArrayRef< BlockContentComment * > getBlocks() const
Definition: Comment.h:1129
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:112
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:46
clang::comments::HTMLTagComment::HTMLTagComment
HTMLTagComment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd, StringRef TagName, SourceLocation TagNameBegin, SourceLocation TagNameEnd)
Definition: Comment.h:376
clang::comments::InlineContentComment::addTrailingNewline
void addTrailingNewline()
Definition: Comment.h:251
unsigned
clang::comments::Comment::getLocation
SourceLocation getLocation() const LLVM_READONLY
Definition: Comment.h:220
clang::comments::BlockCommandComment::Argument::Range
SourceRange Range
Definition: Comment.h:599
clang::comments::HTMLStartTagComment::Attribute::Value
StringRef Value
Definition: Comment.h:423
clang::tooling::SymbolOccurrences
std::vector< SymbolOccurrence > SymbolOccurrences
Definition: SymbolOccurrences.h:86
clang::comments::DeclInfo::ClassKind
@ ClassKind
Something that we consider a "class":
Definition: Comment.h:1030
clang::comments::DeclInfo::getTemplateKind
TemplateDeclKind getTemplateKind() const LLVM_READONLY
Definition: Comment.h:1085
clang::comments::VerbatimLineComment::Text
StringRef Text
Definition: Comment.h:945
DynamicType
Definition: ExprConstant.cpp:5565
clang::comments::HTMLStartTagComment::setSelfClosing
void setSelfClosing()
Definition: Comment.h:501
c
__device__ __2f16 float c
Definition: __clang_hip_libdevice_declares.h:315
clang::comments::TextComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:277
find_first_existing_vc_file
llvm_vc find_first_existing_vc_file("${CLANG_SOURCE_DIR}" clang_vc) set(version_inc "$
Definition: CMakeLists.txt:6
clang::comments::BlockContentComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:539
clang::comments::DeclInfo::ReturnType
QualType ReturnType
Function return type if CommentDecl is something that we consider a "function".
Definition: Comment.h:1001
clang::comments::InlineCommandComment::getArgRange
SourceRange getArgRange(unsigned Idx) const
Definition: Comment.h:364
clang::comments::FullComment::child_end
child_iterator child_end() const
Definition: Comment.h:1115
clang::comments::InlineCommandComment::RenderNormal
@ RenderNormal
Definition: Comment.h:309
Tree
SyntaxTree::Impl & Tree
Definition: ASTDiff.cpp:193
clang::comments::Comment::BlockCommandCommentBitfields
Definition: Comment.h:138
clang::comments::InlineCommandComment::Args
ArrayRef< Argument > Args
Command arguments.
Definition: Comment.h:318
clang::transformer::node
RangeSelector node(std::string ID)
Selects a node, including trailing semicolon, if any (for declarations and non-expression statements)...
Definition: RangeSelector.cpp:141
clang::comments::VerbatimBlockComment::VerbatimBlockComment
VerbatimBlockComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID)
Definition: Comment.h:898
GCCTypeClass::Pointer
@ Pointer
clang::comments::Comment::child_iterator
Comment *const * child_iterator
Definition: Comment.h:222
clang::comments::ParamCommandComment::VarArgParamIndex
@ VarArgParamIndex
Definition: Comment.h:719
clang::comments::CommandTraits
This class provides information about commands that can be used in comments.
Definition: CommentCommandTraits.h:127
clang::comments::Comment::NumHTMLStartTagCommentBits
@ NumHTMLStartTagCommentBits
Definition: Comment.h:123
clang::comments::HTMLStartTagComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:468
clang::comments::TParamCommandComment::hasParamName
bool hasParamName() const
Definition: Comment.h:828
clang::ParseAST
void ParseAST(Preprocessor &pp, ASTConsumer *C, ASTContext &Ctx, bool PrintStats=false, TranslationUnitKind TUKind=TU_Complete, CodeCompleteConsumer *CompletionConsumer=nullptr, bool SkipFunctionBodies=false)
Parse the entire file specified, notifying the ASTConsumer as the file is parsed.
Definition: ParseAST.cpp:99
clang::driver::toolchains::AIX
Definition: AIX.h:57
clang::comments::InlineCommandComment::RenderAnchor
@ RenderAnchor
Definition: Comment.h:313
clang::comments::TParamCommandComment::TParamCommandComment
TParamCommandComment(SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
Definition: Comment.h:816
clang::transformer::name
RangeSelector name(std::string ID)
Given a node with a "name", (like NamedDecl, DeclRefExpr, CxxCtorInitializer, and TypeLoc) selects th...
Definition: RangeSelector.cpp:200
clang::comments::HTMLStartTagComment::Attribute::Name
StringRef Name
Definition: Comment.h:418
clang::ast_matchers::has
const internal::ArgumentAdaptingMatcherFunc< internal::HasMatcher > has
Matches AST nodes that have child AST nodes that match the provided matcher.
Definition: ASTMatchersInternal.cpp:1007
clang::comments::Comment::InlineCommandCommentBitfields
Definition: Comment.h:92
clang::comments::HTMLStartTagComment::isSelfClosing
bool isSelfClosing() const
Definition: Comment.h:497
clang::comments::VerbatimBlockLineComment::VerbatimBlockLineComment
VerbatimBlockLineComment(SourceLocation LocBegin, StringRef Text)
Definition: Comment.h:867
clang::comments::DeclInfo::IsClassMethod
unsigned IsClassMethod
Is CommentDecl a static member function of C++ class or class method of ObjC class.
Definition: Comment.h:1077
clang::comments::HTMLEndTagComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:523
CommentCommandTraits.h
clang::comments::Comment::dump
void dump() const
Definition: ASTDumper.cpp:251
clang::comments::VerbatimBlockComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:910
clang::comments::VerbatimLineComment::getText
StringRef getText() const
Definition: Comment.h:970
clang::comments::Comment::child_end
child_iterator child_end() const
Definition: Comment.cpp:96
clang::comments::Comment::Range
SourceRange Range
Source range of this AST node.
Definition: Comment.h:58
clang::comments::Comment::getCommentKind
CommentKind getCommentKind() const
Definition: Comment.h:204
clang::comments::HTMLStartTagComment::setAttrs
void setAttrs(ArrayRef< Attribute > Attrs)
Definition: Comment.h:480
clang::comments::BlockCommandComment::hasNonWhitespaceParagraph
bool hasNonWhitespaceParagraph() const
Definition: Comment.h:693
clang::comments::HTMLStartTagComment::Attribute
Definition: Comment.h:415
clang::comments::Comment::setLocation
void setLocation(SourceLocation L)
Definition: Comment.h:181
clang::comments::ParagraphComment::isWhitespace
bool isWhitespace() const
Definition: Comment.h:580
clang::comments::TParamCommandComment::getParamName
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:378
clang::comments::ParagraphComment
A single paragraph that contains inline content.
Definition: Comment.h:546
Type
MatchType Type
Definition: ASTMatchFinder.cpp:70
clang::comments::DeclInfo::NotTemplate
@ NotTemplate
Definition: Comment.h:1051