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 
429 
434 
436  return NameLocBegin.getLocWithOffset(Name.size());
437  }
438 
441  }
442  };
443 
444 private:
445  ArrayRef<Attribute> Attributes;
446 
447 public:
449  StringRef TagName) :
450  HTMLTagComment(HTMLStartTagCommentKind,
451  LocBegin, LocBegin.getLocWithOffset(1 + TagName.size()),
452  TagName,
453  LocBegin.getLocWithOffset(1),
454  LocBegin.getLocWithOffset(1 + TagName.size())) {
455  HTMLStartTagCommentBits.IsSelfClosing = false;
456  }
457 
458  static bool classof(const Comment *C) {
459  return C->getCommentKind() == HTMLStartTagCommentKind;
460  }
461 
462  child_iterator child_begin() const { return nullptr; }
463 
464  child_iterator child_end() const { return nullptr; }
465 
466  unsigned getNumAttrs() const {
467  return Attributes.size();
468  }
469 
470  const Attribute &getAttr(unsigned Idx) const {
471  return Attributes[Idx];
472  }
473 
475  Attributes = Attrs;
476  if (!Attrs.empty()) {
477  const Attribute &Attr = Attrs.back();
478  SourceLocation L = Attr.ValueRange.getEnd();
479  if (L.isValid())
480  Range.setEnd(L);
481  else {
482  Range.setEnd(Attr.getNameLocEnd());
483  }
484  }
485  }
486 
487  void setGreaterLoc(SourceLocation GreaterLoc) {
488  Range.setEnd(GreaterLoc);
489  }
490 
491  bool isSelfClosing() const {
492  return HTMLStartTagCommentBits.IsSelfClosing;
493  }
494 
495  void setSelfClosing() {
496  HTMLStartTagCommentBits.IsSelfClosing = true;
497  }
498 };
499 
500 /// A closing HTML tag.
502 public:
504  SourceLocation LocEnd,
505  StringRef TagName) :
506  HTMLTagComment(HTMLEndTagCommentKind,
507  LocBegin, LocEnd,
508  TagName,
509  LocBegin.getLocWithOffset(2),
510  LocBegin.getLocWithOffset(2 + TagName.size()))
511  { }
512 
513  static bool classof(const Comment *C) {
514  return C->getCommentKind() == HTMLEndTagCommentKind;
515  }
516 
517  child_iterator child_begin() const { return nullptr; }
518 
519  child_iterator child_end() const { return nullptr; }
520 };
521 
522 /// Block content (contains inline content).
523 /// Abstract class.
524 class BlockContentComment : public Comment {
525 protected:
527  SourceLocation LocBegin,
528  SourceLocation LocEnd) :
529  Comment(K, LocBegin, LocEnd)
530  { }
531 
532 public:
533  static bool classof(const Comment *C) {
534  return C->getCommentKind() >= FirstBlockContentCommentConstant &&
535  C->getCommentKind() <= LastBlockContentCommentConstant;
536  }
537 };
538 
539 /// A single paragraph that contains inline content.
542 
543 public:
545  BlockContentComment(ParagraphCommentKind,
546  SourceLocation(),
547  SourceLocation()),
548  Content(Content) {
549  if (Content.empty()) {
550  ParagraphCommentBits.IsWhitespace = true;
551  ParagraphCommentBits.IsWhitespaceValid = true;
552  return;
553  }
554 
555  ParagraphCommentBits.IsWhitespaceValid = false;
556 
557  setSourceRange(SourceRange(Content.front()->getBeginLoc(),
558  Content.back()->getEndLoc()));
559  setLocation(Content.front()->getBeginLoc());
560  }
561 
562  static bool classof(const Comment *C) {
563  return C->getCommentKind() == ParagraphCommentKind;
564  }
565 
567  return reinterpret_cast<child_iterator>(Content.begin());
568  }
569 
571  return reinterpret_cast<child_iterator>(Content.end());
572  }
573 
574  bool isWhitespace() const {
575  if (ParagraphCommentBits.IsWhitespaceValid)
576  return ParagraphCommentBits.IsWhitespace;
577 
578  ParagraphCommentBits.IsWhitespace = isWhitespaceNoCache();
579  ParagraphCommentBits.IsWhitespaceValid = true;
580  return ParagraphCommentBits.IsWhitespace;
581  }
582 
583 private:
584  bool isWhitespaceNoCache() const;
585 };
586 
587 /// A command that has zero or more word-like arguments (number of word-like
588 /// arguments depends on command name) and a paragraph as an argument
589 /// (e. g., \\brief).
591 public:
592  struct Argument {
594  StringRef Text;
595 
596  Argument() { }
598  };
599 
600 protected:
601  /// Word-like arguments.
603 
604  /// Paragraph argument.
606 
608  SourceLocation LocBegin,
609  SourceLocation LocEnd,
610  unsigned CommandID,
611  CommandMarkerKind CommandMarker) :
612  BlockContentComment(K, LocBegin, LocEnd),
613  Paragraph(nullptr) {
615  BlockCommandCommentBits.CommandID = CommandID;
616  BlockCommandCommentBits.CommandMarker = CommandMarker;
617  }
618 
619 public:
621  SourceLocation LocEnd,
622  unsigned CommandID,
623  CommandMarkerKind CommandMarker) :
624  BlockContentComment(BlockCommandCommentKind, LocBegin, LocEnd),
625  Paragraph(nullptr) {
627  BlockCommandCommentBits.CommandID = CommandID;
628  BlockCommandCommentBits.CommandMarker = CommandMarker;
629  }
630 
631  static bool classof(const Comment *C) {
632  return C->getCommentKind() >= FirstBlockCommandCommentConstant &&
633  C->getCommentKind() <= LastBlockCommandCommentConstant;
634  }
635 
637  return reinterpret_cast<child_iterator>(&Paragraph);
638  }
639 
641  return reinterpret_cast<child_iterator>(&Paragraph + 1);
642  }
643 
644  unsigned getCommandID() const {
645  return BlockCommandCommentBits.CommandID;
646  }
647 
648  StringRef getCommandName(const CommandTraits &Traits) const {
649  return Traits.getCommandInfo(getCommandID())->Name;
650  }
651 
653  return getBeginLoc().getLocWithOffset(1);
654  }
655 
657  StringRef Name = getCommandName(Traits);
659  getBeginLoc().getLocWithOffset(1 + Name.size()));
660  }
661 
662  unsigned getNumArgs() const {
663  return Args.size();
664  }
665 
666  StringRef getArgText(unsigned Idx) const {
667  return Args[Idx].Text;
668  }
669 
670  SourceRange getArgRange(unsigned Idx) const {
671  return Args[Idx].Range;
672  }
673 
675  Args = A;
676  if (Args.size() > 0) {
677  SourceLocation NewLocEnd = Args.back().Range.getEnd();
678  if (NewLocEnd.isValid())
679  setSourceRange(SourceRange(getBeginLoc(), NewLocEnd));
680  }
681  }
682 
683  ParagraphComment *getParagraph() const LLVM_READONLY {
684  return Paragraph;
685  }
686 
688  return Paragraph && !Paragraph->isWhitespace();
689  }
690 
692  Paragraph = PC;
693  SourceLocation NewLocEnd = PC->getEndLoc();
694  if (NewLocEnd.isValid())
695  setSourceRange(SourceRange(getBeginLoc(), NewLocEnd));
696  }
697 
698  CommandMarkerKind getCommandMarker() const LLVM_READONLY {
699  return static_cast<CommandMarkerKind>(
700  BlockCommandCommentBits.CommandMarker);
701  }
702 };
703 
704 /// Doxygen \\param command.
706 private:
707  /// Parameter index in the function declaration.
708  unsigned ParamIndex;
709 
710 public:
711  enum : unsigned {
713  VarArgParamIndex = ~0U/*InvalidParamIndex*/ - 1U
714  };
715 
717  SourceLocation LocEnd,
718  unsigned CommandID,
719  CommandMarkerKind CommandMarker) :
720  BlockCommandComment(ParamCommandCommentKind, LocBegin, LocEnd,
721  CommandID, CommandMarker),
722  ParamIndex(InvalidParamIndex) {
723  ParamCommandCommentBits.Direction = In;
724  ParamCommandCommentBits.IsDirectionExplicit = false;
725  }
726 
727  static bool classof(const Comment *C) {
728  return C->getCommentKind() == ParamCommandCommentKind;
729  }
730 
732  In,
735  };
736 
737  static const char *getDirectionAsString(PassDirection D);
738 
739  PassDirection getDirection() const LLVM_READONLY {
740  return static_cast<PassDirection>(ParamCommandCommentBits.Direction);
741  }
742 
743  bool isDirectionExplicit() const LLVM_READONLY {
744  return ParamCommandCommentBits.IsDirectionExplicit;
745  }
746 
747  void setDirection(PassDirection Direction, bool Explicit) {
748  ParamCommandCommentBits.Direction = Direction;
749  ParamCommandCommentBits.IsDirectionExplicit = Explicit;
750  }
751 
752  bool hasParamName() const {
753  return getNumArgs() > 0;
754  }
755 
756  StringRef getParamName(const FullComment *FC) const;
757 
758  StringRef getParamNameAsWritten() const {
759  return Args[0].Text;
760  }
761 
763  return Args[0].Range;
764  }
765 
766  bool isParamIndexValid() const LLVM_READONLY {
767  return ParamIndex != InvalidParamIndex;
768  }
769 
770  bool isVarArgParam() const LLVM_READONLY {
771  return ParamIndex == VarArgParamIndex;
772  }
773 
775  ParamIndex = VarArgParamIndex;
776  assert(isParamIndexValid());
777  }
778 
779  unsigned getParamIndex() const LLVM_READONLY {
780  assert(isParamIndexValid());
781  assert(!isVarArgParam());
782  return ParamIndex;
783  }
784 
785  void setParamIndex(unsigned Index) {
786  ParamIndex = Index;
787  assert(isParamIndexValid());
788  assert(!isVarArgParam());
789  }
790 };
791 
792 /// Doxygen \\tparam command, describes a template parameter.
794 private:
795  /// If this template parameter name was resolved (found in template parameter
796  /// list), then this stores a list of position indexes in all template
797  /// parameter lists.
798  ///
799  /// For example:
800  /// \verbatim
801  /// template<typename C, template<typename T> class TT>
802  /// void test(TT<int> aaa);
803  /// \endverbatim
804  /// For C: Position = { 0 }
805  /// For TT: Position = { 1 }
806  /// For T: Position = { 1, 0 }
807  ArrayRef<unsigned> Position;
808 
809 public:
811  SourceLocation LocEnd,
812  unsigned CommandID,
813  CommandMarkerKind CommandMarker) :
814  BlockCommandComment(TParamCommandCommentKind, LocBegin, LocEnd, CommandID,
815  CommandMarker)
816  { }
817 
818  static bool classof(const Comment *C) {
819  return C->getCommentKind() == TParamCommandCommentKind;
820  }
821 
822  bool hasParamName() const {
823  return getNumArgs() > 0;
824  }
825 
826  StringRef getParamName(const FullComment *FC) const;
827 
828  StringRef getParamNameAsWritten() const {
829  return Args[0].Text;
830  }
831 
833  return Args[0].Range;
834  }
835 
836  bool isPositionValid() const LLVM_READONLY {
837  return !Position.empty();
838  }
839 
840  unsigned getDepth() const {
841  assert(isPositionValid());
842  return Position.size();
843  }
844 
845  unsigned getIndex(unsigned Depth) const {
846  assert(isPositionValid());
847  return Position[Depth];
848  }
849 
850  void setPosition(ArrayRef<unsigned> NewPosition) {
851  Position = NewPosition;
852  assert(isPositionValid());
853  }
854 };
855 
856 /// A line of text contained in a verbatim block.
858  StringRef Text;
859 
860 public:
862  StringRef Text) :
863  Comment(VerbatimBlockLineCommentKind,
864  LocBegin,
865  LocBegin.getLocWithOffset(Text.size())),
866  Text(Text)
867  { }
868 
869  static bool classof(const Comment *C) {
870  return C->getCommentKind() == VerbatimBlockLineCommentKind;
871  }
872 
873  child_iterator child_begin() const { return nullptr; }
874 
875  child_iterator child_end() const { return nullptr; }
876 
877  StringRef getText() const LLVM_READONLY {
878  return Text;
879  }
880 };
881 
882 /// A verbatim block command (e. g., preformatted code). Verbatim block has an
883 /// opening and a closing command and contains multiple lines of text
884 /// (VerbatimBlockLineComment nodes).
886 protected:
887  StringRef CloseName;
890 
891 public:
893  SourceLocation LocEnd,
894  unsigned CommandID) :
895  BlockCommandComment(VerbatimBlockCommentKind,
896  LocBegin, LocEnd, CommandID,
897  CMK_At) // FIXME: improve source fidelity.
898  { }
899 
900  static bool classof(const Comment *C) {
901  return C->getCommentKind() == VerbatimBlockCommentKind;
902  }
903 
905  return reinterpret_cast<child_iterator>(Lines.begin());
906  }
907 
909  return reinterpret_cast<child_iterator>(Lines.end());
910  }
911 
912  void setCloseName(StringRef Name, SourceLocation LocBegin) {
913  CloseName = Name;
914  CloseNameLocBegin = LocBegin;
915  }
916 
918  Lines = L;
919  }
920 
921  StringRef getCloseName() const {
922  return CloseName;
923  }
924 
925  unsigned getNumLines() const {
926  return Lines.size();
927  }
928 
929  StringRef getText(unsigned LineIdx) const {
930  return Lines[LineIdx]->getText();
931  }
932 };
933 
934 /// A verbatim line command. Verbatim line has an opening command, a single
935 /// line of text (up to the newline after the opening command) and has no
936 /// closing command.
938 protected:
939  StringRef Text;
941 
942 public:
944  SourceLocation LocEnd,
945  unsigned CommandID,
947  StringRef Text) :
948  BlockCommandComment(VerbatimLineCommentKind,
949  LocBegin, LocEnd,
950  CommandID,
951  CMK_At), // FIXME: improve source fidelity.
952  Text(Text),
954  { }
955 
956  static bool classof(const Comment *C) {
957  return C->getCommentKind() == VerbatimLineCommentKind;
958  }
959 
960  child_iterator child_begin() const { return nullptr; }
961 
962  child_iterator child_end() const { return nullptr; }
963 
964  StringRef getText() const {
965  return Text;
966  }
967 
969  return SourceRange(TextBegin, getEndLoc());
970  }
971 };
972 
973 /// Information about the declaration, useful to clients of FullComment.
974 struct DeclInfo {
975  /// Declaration the comment is actually attached to (in the source).
976  /// Should not be NULL.
978 
979  /// CurrentDecl is the declaration with which the FullComment is associated.
980  ///
981  /// It can be different from \c CommentDecl. It happens when we decide
982  /// that the comment originally attached to \c CommentDecl is fine for
983  /// \c CurrentDecl too (for example, for a redeclaration or an overrider of
984  /// \c CommentDecl).
985  ///
986  /// The information in the DeclInfo corresponds to CurrentDecl.
988 
989  /// Parameters that can be referenced by \\param if \c CommentDecl is something
990  /// that we consider a "function".
992 
993  /// Function return type if \c CommentDecl is something that we consider
994  /// a "function".
996 
997  /// Template parameters that can be referenced by \\tparam if \c CommentDecl is
998  /// a template (\c IsTemplateDecl or \c IsTemplatePartialSpecialization is
999  /// true).
1001 
1002  /// A simplified description of \c CommentDecl kind that should be good enough
1003  /// for documentation rendering purposes.
1004  enum DeclKind {
1005  /// Everything else not explicitly mentioned below.
1007 
1008  /// Something that we consider a "function":
1009  /// \li function,
1010  /// \li function template,
1011  /// \li function template specialization,
1012  /// \li member function,
1013  /// \li member function template,
1014  /// \li member function template specialization,
1015  /// \li ObjC method,
1017 
1018  /// Something that we consider a "class":
1019  /// \li class/struct,
1020  /// \li class template,
1021  /// \li class template (partial) specialization.
1023 
1024  /// Something that we consider a "variable":
1025  /// \li namespace scope variables and variable templates;
1026  /// \li static and non-static class data members and member templates;
1027  /// \li enumerators.
1029 
1030  /// A C++ namespace.
1032 
1033  /// A C++ typedef-name (a 'typedef' decl specifier or alias-declaration),
1034  /// see \c TypedefNameDecl.
1036 
1037  /// An enumeration or scoped enumeration.
1039  };
1040 
1041  /// What kind of template specialization \c CommentDecl is.
1047  };
1048 
1049  /// If false, only \c CommentDecl is valid.
1050  unsigned IsFilled : 1;
1051 
1052  /// Simplified kind of \c CommentDecl, see \c DeclKind enum.
1053  unsigned Kind : 3;
1054 
1055  /// Is \c CommentDecl a template declaration.
1056  unsigned TemplateKind : 2;
1057 
1058  /// Is \c CommentDecl an ObjCMethodDecl.
1059  unsigned IsObjCMethod : 1;
1060 
1061  /// Is \c CommentDecl a non-static member function of C++ class or
1062  /// instance method of ObjC class.
1063  /// Can be true only if \c IsFunctionDecl is true.
1064  unsigned IsInstanceMethod : 1;
1065 
1066  /// Is \c CommentDecl a static member function of C++ class or
1067  /// class method of ObjC class.
1068  /// Can be true only if \c IsFunctionDecl is true.
1069  unsigned IsClassMethod : 1;
1070 
1071  /// Is \c CommentDecl something we consider a "function" that's variadic.
1072  unsigned IsVariadic : 1;
1073 
1074  void fill();
1075 
1076  DeclKind getKind() const LLVM_READONLY {
1077  return static_cast<DeclKind>(Kind);
1078  }
1079 
1080  TemplateDeclKind getTemplateKind() const LLVM_READONLY {
1081  return static_cast<TemplateDeclKind>(TemplateKind);
1082  }
1083 
1084  bool involvesFunctionType() const { return !ReturnType.isNull(); }
1085 };
1086 
1087 /// A full comment attached to a declaration, contains block content.
1088 class FullComment : public Comment {
1090  DeclInfo *ThisDeclInfo;
1091 
1092 public:
1094  Comment(FullCommentKind, SourceLocation(), SourceLocation()),
1095  Blocks(Blocks), ThisDeclInfo(D) {
1096  if (Blocks.empty())
1097  return;
1098 
1100  SourceRange(Blocks.front()->getBeginLoc(), Blocks.back()->getEndLoc()));
1101  setLocation(Blocks.front()->getBeginLoc());
1102  }
1103 
1104  static bool classof(const Comment *C) {
1105  return C->getCommentKind() == FullCommentKind;
1106  }
1107 
1109  return reinterpret_cast<child_iterator>(Blocks.begin());
1110  }
1111 
1113  return reinterpret_cast<child_iterator>(Blocks.end());
1114  }
1115 
1116  const Decl *getDecl() const LLVM_READONLY {
1117  return ThisDeclInfo->CommentDecl;
1118  }
1119 
1120  const DeclInfo *getDeclInfo() const LLVM_READONLY {
1121  if (!ThisDeclInfo->IsFilled)
1122  ThisDeclInfo->fill();
1123  return ThisDeclInfo;
1124  }
1125 
1126  ArrayRef<BlockContentComment *> getBlocks() const { return Blocks; }
1127 
1128 };
1129 } // end namespace comments
1130 } // end namespace clang
1131 
1132 #endif
1133 
clang::comments::InlineContentComment::hasTrailingNewline
bool hasTrailingNewline() const
Definition: Comment.h:255
clang::comments::DeclInfo::EnumKind
@ EnumKind
An enumeration or scoped enumeration.
Definition: Comment.h:1038
clang::comments::ParagraphComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:562
clang::comments::ParamCommandComment::getDirectionAsString
static const char * getDirectionAsString(PassDirection D)
Definition: Comment.cpp:187
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:836
clang::comments::FullComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:1104
clang::comments::VerbatimLineComment
A verbatim line command.
Definition: Comment.h:937
clang::comments::DeclInfo::IsVariadic
unsigned IsVariadic
Is CommentDecl something we consider a "function" that's variadic.
Definition: Comment.h:1072
clang::comments::VerbatimBlockLineComment::getText
StringRef getText() const LLVM_READONLY
Definition: Comment.h:877
clang::comments::Comment::TextCommentBits
TextCommentBitfields TextCommentBits
Definition: Comment.h:168
clang::comments::Comment::dumpColor
void dumpColor() const
Definition: ASTDumper.cpp:260
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:1031
clang::comments::ParamCommandComment::Out
@ Out
Definition: Comment.h:733
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:743
Nodes
BoundNodesTreeBuilder Nodes
Definition: ASTMatchFinder.cpp:82
clang::comments::ParamCommandComment::isParamIndexValid
bool isParamIndexValid() const LLVM_READONLY
Definition: Comment.h:766
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
clang::comments::ParamCommandComment::getParamNameRange
SourceRange getParamNameRange() const
Definition: Comment.h:762
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:466
clang::ast_matchers::stmt
const internal::VariadicAllOfMatcher< Stmt > stmt
Matches statements.
Definition: ASTMatchersInternal.cpp:810
clang::frontend::RewriteTest
@ RewriteTest
Rewriter playground.
Definition: FrontendOptions.h:124
clang::comments::VerbatimBlockComment::getCloseName
StringRef getCloseName() const
Definition: Comment.h:921
clang::comments::Comment::HTMLTagCommentBits
HTMLTagCommentBitfields HTMLTagCommentBits
Definition: Comment.h:170
clang::comments::BlockCommandComment::setArgs
void setArgs(ArrayRef< Argument > A)
Definition: Comment.h:674
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:991
clang::comments::ParagraphComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:566
clang::comments::HTMLStartTagComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:458
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:86
clang::comments::ParamCommandComment::getDirection
PassDirection getDirection() const LLVM_READONLY
Definition: Comment.h:739
clang::SourceLocation::getLocWithOffset
SourceLocation getLocWithOffset(IntTy Offset) const
Return a source location with the specified offset from this SourceLocation.
Definition: SourceLocation.h:134
clang::comments::HTMLTagComment::TagNameRange
SourceRange TagNameRange
Definition: Comment.h:374
clang::SourceRange::getBegin
SourceLocation getBegin() const
Definition: SourceLocation.h:219
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:513
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:674
clang::comments::Comment::NumInlineContentCommentBits
@ NumInlineContentCommentBits
Definition: Comment.h:77
clang::comments::DeclInfo::TemplatePartialSpecialization
@ TemplatePartialSpecialization
Definition: Comment.h:1046
clang::comments::BlockCommandComment::getCommandID
unsigned getCommandID() const
Definition: Comment.h:644
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:683
clang::comments::BlockCommandComment::getArgRange
SourceRange getArgRange(unsigned Idx) const
Definition: Comment.h:670
clang::comments::InlineCommandComment::Argument::Range
SourceRange Range
Definition: Comment.h:300
clang::comments::TParamCommandComment::getDepth
unsigned getDepth() const
Definition: Comment.h:840
clang::comments::FullComment::FullComment
FullComment(ArrayRef< BlockContentComment * > Blocks, DeclInfo *D)
Definition: Comment.h:1093
clang::comments::VerbatimLineComment::child_end
child_iterator child_end() const
Definition: Comment.h:962
clang::comments::TParamCommandComment::getIndex
unsigned getIndex(unsigned Depth) const
Definition: Comment.h:845
clang::comments::VerbatimLineComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:956
clang::comments::DeclInfo::IsFilled
unsigned IsFilled
If false, only CommentDecl is valid.
Definition: Comment.h:1050
clang::comments::VerbatimBlockLineComment::child_end
child_iterator child_end() const
Definition: Comment.h:875
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:908
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:666
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:925
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:727
clang::comments::HTMLEndTagComment
A closing HTML tag.
Definition: Comment.h:501
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:1042
clang::comments::ParamCommandComment::setParamIndex
void setParamIndex(unsigned Index)
Definition: Comment.h:785
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:977
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:815
clang::comments::HTMLStartTagComment::child_end
child_iterator child_end() const
Definition: Comment.h:464
clang::comments::ParamCommandComment::InvalidParamIndex
@ InvalidParamIndex
Definition: Comment.h:712
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:620
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:987
clang::comments::TParamCommandComment::getParamNameRange
SourceRange getParamNameRange() const
Definition: Comment.h:832
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:716
clang::comments::HTMLEndTagComment::HTMLEndTagComment
HTMLEndTagComment(SourceLocation LocBegin, SourceLocation LocEnd, StringRef TagName)
Definition: Comment.h:503
clang::comments::BlockCommandComment::BlockCommandComment
BlockCommandComment(CommentKind K, SourceLocation LocBegin, SourceLocation LocEnd, unsigned CommandID, CommandMarkerKind CommandMarker)
Definition: Comment.h:607
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:857
clang::comments::ParamCommandComment
Doxygen \param command.
Definition: Comment.h:705
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:1030
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:640
clang::comments::FullComment::getDecl
const Decl * getDecl() const LLVM_READONLY
Definition: Comment.h:1116
clang::comments::BlockCommandComment::Paragraph
ParagraphComment * Paragraph
Paragraph argument.
Definition: Comment.h:605
clang::comments::InlineCommandComment::getCommandNameRange
SourceRange getCommandNameRange() const
Definition: Comment.h:348
clang::comments::BlockCommandComment::Args
ArrayRef< Argument > Args
Word-like arguments.
Definition: Comment.h:602
clang::comments::VerbatimBlockComment::CloseName
StringRef CloseName
Definition: Comment.h:887
clang::comments::ParamCommandComment::getParamNameAsWritten
StringRef getParamNameAsWritten() const
Definition: Comment.h:758
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:1035
clang::comments::ParamCommandComment::setIsVarArgParam
void setIsVarArgParam()
Definition: Comment.h:774
clang::SourceRange::getEnd
SourceLocation getEnd() const
Definition: SourceLocation.h:220
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:209
clang::comments::HTMLStartTagComment::Attribute::Attribute
Attribute(SourceLocation NameLocBegin, StringRef Name, SourceLocation EqualsLoc, SourceRange ValueRange, StringRef Value)
Definition: Comment.h:430
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:943
clang::comments::Comment::TextCommentBitfields
Definition: Comment.h:79
clang::comments::VerbatimLineComment::getTextRange
SourceRange getTextRange() const
Definition: Comment.h:968
clang::comments::HTMLStartTagComment::setGreaterLoc
void setGreaterLoc(SourceLocation GreaterLoc)
Definition: Comment.h:487
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:732
clang::comments::TParamCommandComment::setPosition
void setPosition(ArrayRef< unsigned > NewPosition)
Definition: Comment.h:850
clang::comments::BlockCommandComment::getNumArgs
unsigned getNumArgs() const
Definition: Comment.h:662
clang::comments::HTMLStartTagComment::Attribute::getNameRange
SourceRange getNameRange() const
Definition: Comment.h:439
clang::comments::VerbatimLineComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:960
clang::comments::Comment::HTMLTagCommentBitfields
Definition: Comment.h:104
clang::comments::DeclInfo::getKind
DeclKind getKind() const LLVM_READONLY
Definition: Comment.h:1076
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:470
clang::comments::FullComment
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1088
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:888
clang::comments::DeclInfo::OtherKind
@ OtherKind
Everything else not explicitly mentioned below.
Definition: Comment.h:1006
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:1000
clang::comments::BlockCommandComment
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:590
clang::comments::InlineCommandComment::Argument::Text
StringRef Text
Definition: Comment.h:301
clang::comments::ParamCommandComment::isVarArgParam
bool isVarArgParam() const LLVM_READONLY
Definition: Comment.h:770
clang::comments::DeclInfo::FunctionKind
@ FunctionKind
Something that we consider a "function":
Definition: Comment.h:1016
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:223
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:1044
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:199
clang::comments::HTMLTagComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:390
clang::comments::ParamCommandComment::InOut
@ InOut
Definition: Comment.h:734
clang::comments::HTMLStartTagComment::Attribute::getNameLocEnd
SourceLocation getNameLocEnd() const
Definition: Comment.h:435
COMMENT
#define COMMENT(CLASS, PARENT)
Definition: Comment.h:188
clang::comments::BlockCommandComment::Argument
Definition: Comment.h:592
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:1059
clang::comments::VerbatimBlockComment::setLines
void setLines(ArrayRef< VerbatimBlockLineComment * > L)
Definition: Comment.h:917
clang::comments::BlockCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:631
clang::comments::Comment::HTMLStartTagCommentBitfields
Definition: Comment.h:114
clang::comments::ParamCommandComment::setDirection
void setDirection(PassDirection Direction, bool Explicit)
Definition: Comment.h:747
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:648
clang::comments::ParamCommandComment::hasParamName
bool hasParamName() const
Definition: Comment.h:752
clang::comments::DeclInfo::TemplateKind
unsigned TemplateKind
Is CommentDecl a template declaration.
Definition: Comment.h:1056
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:526
clang::comments::ParamCommandComment::getParamName
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:364
clang::comments::DeclInfo::DeclKind
DeclKind
A simplified description of CommentDecl kind that should be good enough for documentation rendering p...
Definition: Comment.h:1004
clang::comments::HTMLStartTagComment::HTMLStartTagComment
HTMLStartTagComment(SourceLocation LocBegin, StringRef TagName)
Definition: Comment.h:448
clang::comments::VerbatimBlockLineComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:873
clang::comments::TParamCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:818
clang::comments::VerbatimBlockComment::setCloseName
void setCloseName(StringRef Name, SourceLocation LocBegin)
Definition: Comment.h:912
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:1064
clang::comments::HTMLEndTagComment::child_end
child_iterator child_end() const
Definition: Comment.h:519
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:889
clang::comments::ParagraphComment::child_end
child_iterator child_end() const
Definition: Comment.h:570
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:1108
clang::comments::HTMLStartTagComment::Attribute::Attribute
Attribute()
Definition: Comment.h:425
clang::comments::VerbatimBlockComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:900
clang::comments::Comment::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: Comment.h:218
clang::comments::VerbatimLineComment::TextBegin
SourceLocation TextBegin
Definition: Comment.h:940
clang::comments::Comment::ParamCommandCommentBits
ParamCommandCommentBitfields ParamCommandCommentBits
Definition: Comment.h:174
clang::comments::DeclInfo::VariableKind
@ VariableKind
Something that we consider a "variable":
Definition: Comment.h:1028
clang::comments::ParagraphComment::ParagraphComment
ParagraphComment(ArrayRef< InlineContentComment * > Content)
Definition: Comment.h:544
clang::comments::HTMLStartTagComment::Attribute::ValueRange
SourceRange ValueRange
Definition: Comment.h:422
clang::comments::BlockContentComment
Block content (contains inline content).
Definition: Comment.h:524
clang::comments::BlockCommandComment::Argument::Argument
Argument()
Definition: Comment.h:596
clang::comments::DeclInfo
Information about the declaration, useful to clients of FullComment.
Definition: Comment.h:974
clang::comments::DeclInfo::Kind
unsigned Kind
Simplified kind of CommentDecl, see DeclKind enum.
Definition: Comment.h:1053
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:1519
clang::comments::TParamCommandComment::getParamNameAsWritten
StringRef getParamNameAsWritten() const
Definition: Comment.h:828
clang::comments::VerbatimBlockLineComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:869
clang::comments::Comment::InlineContentCommentBits
InlineContentCommentBitfields InlineContentCommentBits
Definition: Comment.h:167
clang::comments::BlockCommandComment::Argument::Text
StringRef Text
Definition: Comment.h:594
clang::QualType::isNull
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:739
clang::comments::TParamCommandComment
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:793
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:83
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:636
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:691
clang::comments::FullComment::getDeclInfo
const DeclInfo * getDeclInfo() const LLVM_READONLY
Definition: Comment.h:1120
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:1052
clang::comments::BlockCommandComment::getCommandNameRange
SourceRange getCommandNameRange(const CommandTraits &Traits) const
Definition: Comment.h:656
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:597
clang::comments::BlockCommandComment::getCommandMarker
CommandMarkerKind getCommandMarker() const LLVM_READONLY
Definition: Comment.h:698
clang::comments::InlineCommandComment::classof
static bool classof(const Comment *C)
Definition: Comment.h:332
clang::comments::ParamCommandComment::PassDirection
PassDirection
Definition: Comment.h:731
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:652
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:1045
clang
Definition: CalledOnceCheck.h:17
Text
StringRef Text
Definition: Format.cpp:2432
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:929
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:885
clang::comments::ParamCommandComment::getParamIndex
unsigned getParamIndex() const LLVM_READONLY
Definition: Comment.h:779
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:1126
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:110
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:41
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:593
clang::comments::DeclInfo::involvesFunctionType
bool involvesFunctionType() const
Definition: Comment.h:1084
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:1022
clang::comments::DeclInfo::getTemplateKind
TemplateDeclKind getTemplateKind() const LLVM_READONLY
Definition: Comment.h:1080
clang::comments::VerbatimLineComment::Text
StringRef Text
Definition: Comment.h:939
DynamicType
Definition: ExprConstant.cpp:5581
clang::comments::HTMLStartTagComment::setSelfClosing
void setSelfClosing()
Definition: Comment.h:495
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:533
clang::comments::DeclInfo::ReturnType
QualType ReturnType
Function return type if CommentDecl is something that we consider a "function".
Definition: Comment.h:995
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:1112
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:892
GCCTypeClass::Pointer
@ Pointer
clang::comments::Comment::child_iterator
Comment *const * child_iterator
Definition: Comment.h:222
clang::comments::ParamCommandComment::VarArgParamIndex
@ VarArgParamIndex
Definition: Comment.h:713
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:462
clang::comments::TParamCommandComment::hasParamName
bool hasParamName() const
Definition: Comment.h:822
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:810
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:1008
clang::comments::Comment::InlineCommandCommentBitfields
Definition: Comment.h:92
clang::comments::HTMLStartTagComment::isSelfClosing
bool isSelfClosing() const
Definition: Comment.h:491
clang::comments::VerbatimBlockLineComment::VerbatimBlockLineComment
VerbatimBlockLineComment(SourceLocation LocBegin, StringRef Text)
Definition: Comment.h:861
clang::comments::DeclInfo::IsClassMethod
unsigned IsClassMethod
Is CommentDecl a static member function of C++ class or class method of ObjC class.
Definition: Comment.h:1069
clang::comments::HTMLEndTagComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:517
CommentCommandTraits.h
clang::comments::Comment::dump
void dump() const
Definition: ASTDumper.cpp:243
clang::comments::VerbatimBlockComment::child_begin
child_iterator child_begin() const
Definition: Comment.h:904
clang::comments::VerbatimLineComment::getText
StringRef getText() const
Definition: Comment.h:964
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:474
clang::comments::BlockCommandComment::hasNonWhitespaceParagraph
bool hasNonWhitespaceParagraph() const
Definition: Comment.h:687
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:574
clang::comments::TParamCommandComment::getParamName
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:371
clang::comments::ParagraphComment
A single paragraph that contains inline content.
Definition: Comment.h:540
Type
MatchType Type
Definition: ASTMatchFinder.cpp:70
clang::comments::DeclInfo::NotTemplate
@ NotTemplate
Definition: Comment.h:1043