clang  8.0.0
TextNodeDumper.cpp
Go to the documentation of this file.
1 //===--- TextNodeDumper.cpp - Printing of AST nodes -----------------------===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file implements AST dumping of components of individual AST nodes.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "clang/AST/DeclFriend.h"
16 #include "clang/AST/DeclOpenMP.h"
17 #include "clang/AST/DeclTemplate.h"
18 #include "clang/AST/LocInfoType.h"
19 
20 using namespace clang;
21 
22 static void dumpPreviousDeclImpl(raw_ostream &OS, ...) {}
23 
24 template <typename T>
25 static void dumpPreviousDeclImpl(raw_ostream &OS, const Mergeable<T> *D) {
26  const T *First = D->getFirstDecl();
27  if (First != D)
28  OS << " first " << First;
29 }
30 
31 template <typename T>
32 static void dumpPreviousDeclImpl(raw_ostream &OS, const Redeclarable<T> *D) {
33  const T *Prev = D->getPreviousDecl();
34  if (Prev)
35  OS << " prev " << Prev;
36 }
37 
38 /// Dump the previous declaration in the redeclaration chain for a declaration,
39 /// if any.
40 static void dumpPreviousDecl(raw_ostream &OS, const Decl *D) {
41  switch (D->getKind()) {
42 #define DECL(DERIVED, BASE) \
43  case Decl::DERIVED: \
44  return dumpPreviousDeclImpl(OS, cast<DERIVED##Decl>(D));
45 #define ABSTRACT_DECL(DECL)
46 #include "clang/AST/DeclNodes.inc"
47  }
48  llvm_unreachable("Decl that isn't part of DeclNodes.inc!");
49 }
50 
51 TextNodeDumper::TextNodeDumper(raw_ostream &OS, bool ShowColors,
52  const SourceManager *SM,
53  const PrintingPolicy &PrintPolicy,
54  const comments::CommandTraits *Traits)
55  : TextTreeStructure(OS, ShowColors), OS(OS), ShowColors(ShowColors), SM(SM),
56  PrintPolicy(PrintPolicy), Traits(Traits) {}
57 
59  const comments::FullComment *FC) {
60  if (!C) {
61  ColorScope Color(OS, ShowColors, NullColor);
62  OS << "<<<NULL>>>";
63  return;
64  }
65 
66  {
67  ColorScope Color(OS, ShowColors, CommentColor);
68  OS << C->getCommentKindName();
69  }
70  dumpPointer(C);
72 
73  ConstCommentVisitor<TextNodeDumper, void,
74  const comments::FullComment *>::visit(C, FC);
75 }
76 
77 void TextNodeDumper::Visit(const Attr *A) {
78  {
79  ColorScope Color(OS, ShowColors, AttrColor);
80 
81  switch (A->getKind()) {
82 #define ATTR(X) \
83  case attr::X: \
84  OS << #X; \
85  break;
86 #include "clang/Basic/AttrList.inc"
87  }
88  OS << "Attr";
89  }
90  dumpPointer(A);
92  if (A->isInherited())
93  OS << " Inherited";
94  if (A->isImplicit())
95  OS << " Implicit";
96 
98 }
99 
101  const Decl *From, StringRef Label) {
102  OS << "TemplateArgument";
103  if (R.isValid())
104  dumpSourceRange(R);
105 
106  if (From)
107  dumpDeclRef(From, Label);
108 
110 }
111 
113  if (!Node) {
114  ColorScope Color(OS, ShowColors, NullColor);
115  OS << "<<<NULL>>>";
116  return;
117  }
118  {
119  ColorScope Color(OS, ShowColors, StmtColor);
120  OS << Node->getStmtClassName();
121  }
122  dumpPointer(Node);
124 
125  if (const auto *E = dyn_cast<Expr>(Node)) {
126  dumpType(E->getType());
127 
128  {
129  ColorScope Color(OS, ShowColors, ValueKindColor);
130  switch (E->getValueKind()) {
131  case VK_RValue:
132  break;
133  case VK_LValue:
134  OS << " lvalue";
135  break;
136  case VK_XValue:
137  OS << " xvalue";
138  break;
139  }
140  }
141 
142  {
143  ColorScope Color(OS, ShowColors, ObjectKindColor);
144  switch (E->getObjectKind()) {
145  case OK_Ordinary:
146  break;
147  case OK_BitField:
148  OS << " bitfield";
149  break;
150  case OK_ObjCProperty:
151  OS << " objcproperty";
152  break;
153  case OK_ObjCSubscript:
154  OS << " objcsubscript";
155  break;
156  case OK_VectorComponent:
157  OS << " vectorcomponent";
158  break;
159  }
160  }
161  }
162 
164 }
165 
166 void TextNodeDumper::Visit(const Type *T) {
167  if (!T) {
168  ColorScope Color(OS, ShowColors, NullColor);
169  OS << "<<<NULL>>>";
170  return;
171  }
172  if (isa<LocInfoType>(T)) {
173  {
174  ColorScope Color(OS, ShowColors, TypeColor);
175  OS << "LocInfo Type";
176  }
177  dumpPointer(T);
178  return;
179  }
180 
181  {
182  ColorScope Color(OS, ShowColors, TypeColor);
183  OS << T->getTypeClassName() << "Type";
184  }
185  dumpPointer(T);
186  OS << " ";
187  dumpBareType(QualType(T, 0), false);
188 
189  QualType SingleStepDesugar =
191  if (SingleStepDesugar != QualType(T, 0))
192  OS << " sugar";
193 
194  if (T->isDependentType())
195  OS << " dependent";
196  else if (T->isInstantiationDependentType())
197  OS << " instantiation_dependent";
198 
199  if (T->isVariablyModifiedType())
200  OS << " variably_modified";
202  OS << " contains_unexpanded_pack";
203  if (T->isFromAST())
204  OS << " imported";
205 
207 }
208 
210  OS << "QualType";
212  OS << " ";
213  dumpBareType(T, false);
214  OS << " " << T.split().Quals.getAsString();
215 }
216 
217 void TextNodeDumper::Visit(const Decl *D) {
218  if (!D) {
219  ColorScope Color(OS, ShowColors, NullColor);
220  OS << "<<<NULL>>>";
221  return;
222  }
223 
224  {
225  ColorScope Color(OS, ShowColors, DeclKindNameColor);
226  OS << D->getDeclKindName() << "Decl";
227  }
228  dumpPointer(D);
229  if (D->getLexicalDeclContext() != D->getDeclContext())
230  OS << " parent " << cast<Decl>(D->getDeclContext());
231  dumpPreviousDecl(OS, D);
233  OS << ' ';
235  if (D->isFromASTFile())
236  OS << " imported";
237  if (Module *M = D->getOwningModule())
238  OS << " in " << M->getFullModuleName();
239  if (auto *ND = dyn_cast<NamedDecl>(D))
241  const_cast<NamedDecl *>(ND)))
242  AddChild([=] { OS << "also in " << M->getFullModuleName(); });
243  if (const NamedDecl *ND = dyn_cast<NamedDecl>(D))
244  if (ND->isHidden())
245  OS << " hidden";
246  if (D->isImplicit())
247  OS << " implicit";
248 
249  if (D->isUsed())
250  OS << " used";
251  else if (D->isThisDeclarationReferenced())
252  OS << " referenced";
253 
254  if (D->isInvalidDecl())
255  OS << " invalid";
256  if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
257  if (FD->isConstexpr())
258  OS << " constexpr";
259 }
260 
262  OS << "CXXCtorInitializer";
263  if (Init->isAnyMemberInitializer()) {
264  OS << ' ';
265  dumpBareDeclRef(Init->getAnyMember());
266  } else if (Init->isBaseInitializer()) {
267  dumpType(QualType(Init->getBaseClass(), 0));
268  } else if (Init->isDelegatingInitializer()) {
269  dumpType(Init->getTypeSourceInfo()->getType());
270  } else {
271  llvm_unreachable("Unknown initializer type");
272  }
273 }
274 
276  OS << "capture";
277  if (C.isByRef())
278  OS << " byref";
279  if (C.isNested())
280  OS << " nested";
281  if (C.getVariable()) {
282  OS << ' ';
284  }
285 }
286 
288  if (!C) {
289  ColorScope Color(OS, ShowColors, NullColor);
290  OS << "<<<NULL>>> OMPClause";
291  return;
292  }
293  {
294  ColorScope Color(OS, ShowColors, AttrColor);
295  StringRef ClauseName(getOpenMPClauseName(C->getClauseKind()));
296  OS << "OMP" << ClauseName.substr(/*Start=*/0, /*N=*/1).upper()
297  << ClauseName.drop_front() << "Clause";
298  }
299  dumpPointer(C);
301  if (C->isImplicit())
302  OS << " <implicit>";
303 }
304 
305 void TextNodeDumper::dumpPointer(const void *Ptr) {
306  ColorScope Color(OS, ShowColors, AddressColor);
307  OS << ' ' << Ptr;
308 }
309 
311  if (!SM)
312  return;
313 
314  ColorScope Color(OS, ShowColors, LocationColor);
315  SourceLocation SpellingLoc = SM->getSpellingLoc(Loc);
316 
317  // The general format we print out is filename:line:col, but we drop pieces
318  // that haven't changed since the last loc printed.
319  PresumedLoc PLoc = SM->getPresumedLoc(SpellingLoc);
320 
321  if (PLoc.isInvalid()) {
322  OS << "<invalid sloc>";
323  return;
324  }
325 
326  if (strcmp(PLoc.getFilename(), LastLocFilename) != 0) {
327  OS << PLoc.getFilename() << ':' << PLoc.getLine() << ':'
328  << PLoc.getColumn();
329  LastLocFilename = PLoc.getFilename();
330  LastLocLine = PLoc.getLine();
331  } else if (PLoc.getLine() != LastLocLine) {
332  OS << "line" << ':' << PLoc.getLine() << ':' << PLoc.getColumn();
333  LastLocLine = PLoc.getLine();
334  } else {
335  OS << "col" << ':' << PLoc.getColumn();
336  }
337 }
338 
340  // Can't translate locations if a SourceManager isn't available.
341  if (!SM)
342  return;
343 
344  OS << " <";
345  dumpLocation(R.getBegin());
346  if (R.getBegin() != R.getEnd()) {
347  OS << ", ";
348  dumpLocation(R.getEnd());
349  }
350  OS << ">";
351 
352  // <t2.c:123:421[blah], t2.c:412:321>
353 }
354 
356  ColorScope Color(OS, ShowColors, TypeColor);
357 
358  SplitQualType T_split = T.split();
359  OS << "'" << QualType::getAsString(T_split, PrintPolicy) << "'";
360 
361  if (Desugar && !T.isNull()) {
362  // If the type is sugared, also dump a (shallow) desugared type.
363  SplitQualType D_split = T.getSplitDesugaredType();
364  if (T_split != D_split)
365  OS << ":'" << QualType::getAsString(D_split, PrintPolicy) << "'";
366  }
367 }
368 
370  OS << ' ';
371  dumpBareType(T);
372 }
373 
375  if (!D) {
376  ColorScope Color(OS, ShowColors, NullColor);
377  OS << "<<<NULL>>>";
378  return;
379  }
380 
381  {
382  ColorScope Color(OS, ShowColors, DeclKindNameColor);
383  OS << D->getDeclKindName();
384  }
385  dumpPointer(D);
386 
387  if (const NamedDecl *ND = dyn_cast<NamedDecl>(D)) {
388  ColorScope Color(OS, ShowColors, DeclNameColor);
389  OS << " '" << ND->getDeclName() << '\'';
390  }
391 
392  if (const ValueDecl *VD = dyn_cast<ValueDecl>(D))
393  dumpType(VD->getType());
394 }
395 
397  if (ND->getDeclName()) {
398  ColorScope Color(OS, ShowColors, DeclNameColor);
399  OS << ' ' << ND->getNameAsString();
400  }
401 }
402 
404  switch (AS) {
405  case AS_none:
406  break;
407  case AS_public:
408  OS << "public";
409  break;
410  case AS_protected:
411  OS << "protected";
412  break;
413  case AS_private:
414  OS << "private";
415  break;
416  }
417 }
418 
419 void TextNodeDumper::dumpCXXTemporary(const CXXTemporary *Temporary) {
420  OS << "(CXXTemporary";
421  dumpPointer(Temporary);
422  OS << ")";
423 }
424 
425 void TextNodeDumper::dumpDeclRef(const Decl *D, StringRef Label) {
426  if (!D)
427  return;
428 
429  AddChild([=] {
430  if (!Label.empty())
431  OS << Label << ' ';
432  dumpBareDeclRef(D);
433  });
434 }
435 
436 const char *TextNodeDumper::getCommandName(unsigned CommandID) {
437  if (Traits)
438  return Traits->getCommandInfo(CommandID)->Name;
439  const comments::CommandInfo *Info =
441  if (Info)
442  return Info->Name;
443  return "<not a builtin command>";
444 }
445 
447  const comments::FullComment *) {
448  OS << " Text=\"" << C->getText() << "\"";
449 }
450 
453  OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
454  switch (C->getRenderKind()) {
456  OS << " RenderNormal";
457  break;
459  OS << " RenderBold";
460  break;
462  OS << " RenderMonospaced";
463  break;
465  OS << " RenderEmphasized";
466  break;
467  }
468 
469  for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
470  OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
471 }
472 
475  OS << " Name=\"" << C->getTagName() << "\"";
476  if (C->getNumAttrs() != 0) {
477  OS << " Attrs: ";
478  for (unsigned i = 0, e = C->getNumAttrs(); i != e; ++i) {
480  OS << " \"" << Attr.Name << "=\"" << Attr.Value << "\"";
481  }
482  }
483  if (C->isSelfClosing())
484  OS << " SelfClosing";
485 }
486 
489  OS << " Name=\"" << C->getTagName() << "\"";
490 }
491 
494  OS << " Name=\"" << getCommandName(C->getCommandID()) << "\"";
495  for (unsigned i = 0, e = C->getNumArgs(); i != e; ++i)
496  OS << " Arg[" << i << "]=\"" << C->getArgText(i) << "\"";
497 }
498 
501  OS << " "
503 
504  if (C->isDirectionExplicit())
505  OS << " explicitly";
506  else
507  OS << " implicitly";
508 
509  if (C->hasParamName()) {
510  if (C->isParamIndexValid())
511  OS << " Param=\"" << C->getParamName(FC) << "\"";
512  else
513  OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
514  }
515 
516  if (C->isParamIndexValid() && !C->isVarArgParam())
517  OS << " ParamIndex=" << C->getParamIndex();
518 }
519 
522  if (C->hasParamName()) {
523  if (C->isPositionValid())
524  OS << " Param=\"" << C->getParamName(FC) << "\"";
525  else
526  OS << " Param=\"" << C->getParamNameAsWritten() << "\"";
527  }
528 
529  if (C->isPositionValid()) {
530  OS << " Position=<";
531  for (unsigned i = 0, e = C->getDepth(); i != e; ++i) {
532  OS << C->getIndex(i);
533  if (i != e - 1)
534  OS << ", ";
535  }
536  OS << ">";
537  }
538 }
539 
542  OS << " Name=\"" << getCommandName(C->getCommandID())
543  << "\""
544  " CloseName=\""
545  << C->getCloseName() << "\"";
546 }
547 
550  const comments::FullComment *) {
551  OS << " Text=\"" << C->getText() << "\"";
552 }
553 
556  OS << " Text=\"" << C->getText() << "\"";
557 }
558 
560  OS << " null";
561 }
562 
564  OS << " type";
565  dumpType(TA.getAsType());
566 }
567 
569  const TemplateArgument &TA) {
570  OS << " decl";
571  dumpDeclRef(TA.getAsDecl());
572 }
573 
575  OS << " nullptr";
576 }
577 
579  OS << " integral " << TA.getAsIntegral();
580 }
581 
583  OS << " template ";
584  TA.getAsTemplate().dump(OS);
585 }
586 
588  const TemplateArgument &TA) {
589  OS << " template expansion ";
591 }
592 
594  OS << " expr";
595 }
596 
598  OS << " pack";
599 }
600 
601 static void dumpBasePath(raw_ostream &OS, const CastExpr *Node) {
602  if (Node->path_empty())
603  return;
604 
605  OS << " (";
606  bool First = true;
607  for (CastExpr::path_const_iterator I = Node->path_begin(),
608  E = Node->path_end();
609  I != E; ++I) {
610  const CXXBaseSpecifier *Base = *I;
611  if (!First)
612  OS << " -> ";
613 
614  const CXXRecordDecl *RD =
615  cast<CXXRecordDecl>(Base->getType()->getAs<RecordType>()->getDecl());
616 
617  if (Base->isVirtual())
618  OS << "virtual ";
619  OS << RD->getName();
620  First = false;
621  }
622 
623  OS << ')';
624 }
625 
627  if (Node->hasInitStorage())
628  OS << " has_init";
629  if (Node->hasVarStorage())
630  OS << " has_var";
631  if (Node->hasElseStorage())
632  OS << " has_else";
633 }
634 
636  if (Node->hasInitStorage())
637  OS << " has_init";
638  if (Node->hasVarStorage())
639  OS << " has_var";
640 }
641 
643  if (Node->hasVarStorage())
644  OS << " has_var";
645 }
646 
648  OS << " '" << Node->getName() << "'";
649 }
650 
652  OS << " '" << Node->getLabel()->getName() << "'";
653  dumpPointer(Node->getLabel());
654 }
655 
657  if (Node->caseStmtIsGNURange())
658  OS << " gnu_range";
659 }
660 
662  if (Node->usesADL())
663  OS << " adl";
664 }
665 
667  OS << " <";
668  {
669  ColorScope Color(OS, ShowColors, CastColor);
670  OS << Node->getCastKindName();
671  }
672  dumpBasePath(OS, Node);
673  OS << ">";
674 }
675 
677  VisitCastExpr(Node);
678  if (Node->isPartOfExplicitCast())
679  OS << " part_of_explicit_cast";
680 }
681 
683  OS << " ";
684  dumpBareDeclRef(Node->getDecl());
685  if (Node->getDecl() != Node->getFoundDecl()) {
686  OS << " (";
687  dumpBareDeclRef(Node->getFoundDecl());
688  OS << ")";
689  }
690 }
691 
693  const UnresolvedLookupExpr *Node) {
694  OS << " (";
695  if (!Node->requiresADL())
696  OS << "no ";
697  OS << "ADL) = '" << Node->getName() << '\'';
698 
700  E = Node->decls_end();
701  if (I == E)
702  OS << " empty";
703  for (; I != E; ++I)
704  dumpPointer(*I);
705 }
706 
708  {
709  ColorScope Color(OS, ShowColors, DeclKindNameColor);
710  OS << " " << Node->getDecl()->getDeclKindName() << "Decl";
711  }
712  OS << "='" << *Node->getDecl() << "'";
713  dumpPointer(Node->getDecl());
714  if (Node->isFreeIvar())
715  OS << " isFreeIvar";
716 }
717 
719  OS << " " << PredefinedExpr::getIdentKindName(Node->getIdentKind());
720 }
721 
723  ColorScope Color(OS, ShowColors, ValueColor);
724  OS << " " << Node->getValue();
725 }
726 
728  bool isSigned = Node->getType()->isSignedIntegerType();
729  ColorScope Color(OS, ShowColors, ValueColor);
730  OS << " " << Node->getValue().toString(10, isSigned);
731 }
732 
734  ColorScope Color(OS, ShowColors, ValueColor);
735  OS << " " << Node->getValueAsString(/*Radix=*/10);
736 }
737 
739  ColorScope Color(OS, ShowColors, ValueColor);
740  OS << " " << Node->getValueAsApproximateDouble();
741 }
742 
744  ColorScope Color(OS, ShowColors, ValueColor);
745  OS << " ";
746  Str->outputString(OS);
747 }
748 
750  if (auto *Field = ILE->getInitializedFieldInUnion()) {
751  OS << " field ";
752  dumpBareDeclRef(Field);
753  }
754 }
755 
757  OS << " " << (Node->isPostfix() ? "postfix" : "prefix") << " '"
758  << UnaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
759  if (!Node->canOverflow())
760  OS << " cannot overflow";
761 }
762 
765  switch (Node->getKind()) {
766  case UETT_SizeOf:
767  OS << " sizeof";
768  break;
769  case UETT_AlignOf:
770  OS << " alignof";
771  break;
772  case UETT_VecStep:
773  OS << " vec_step";
774  break;
776  OS << " __builtin_omp_required_simd_align";
777  break;
779  OS << " __alignof";
780  break;
781  }
782  if (Node->isArgumentType())
783  dumpType(Node->getArgumentType());
784 }
785 
787  OS << " " << (Node->isArrow() ? "->" : ".") << *Node->getMemberDecl();
788  dumpPointer(Node->getMemberDecl());
789 }
790 
792  const ExtVectorElementExpr *Node) {
793  OS << " " << Node->getAccessor().getNameStart();
794 }
795 
797  OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode()) << "'";
798 }
799 
801  const CompoundAssignOperator *Node) {
802  OS << " '" << BinaryOperator::getOpcodeStr(Node->getOpcode())
803  << "' ComputeLHSTy=";
805  OS << " ComputeResultTy=";
807 }
808 
810  OS << " " << Node->getLabel()->getName();
811  dumpPointer(Node->getLabel());
812 }
813 
815  OS << " " << Node->getCastName() << "<"
816  << Node->getTypeAsWritten().getAsString() << ">"
817  << " <" << Node->getCastKindName();
818  dumpBasePath(OS, Node);
819  OS << ">";
820 }
821 
823  OS << " " << (Node->getValue() ? "true" : "false");
824 }
825 
827  OS << " this";
828 }
829 
831  const CXXFunctionalCastExpr *Node) {
832  OS << " functional cast to " << Node->getTypeAsWritten().getAsString() << " <"
833  << Node->getCastKindName() << ">";
834 }
835 
838  dumpType(Node->getTypeAsWritten());
839  if (Node->isListInitialization())
840  OS << " list";
841 }
842 
844  CXXConstructorDecl *Ctor = Node->getConstructor();
845  dumpType(Ctor->getType());
846  if (Node->isElidable())
847  OS << " elidable";
848  if (Node->isListInitialization())
849  OS << " list";
850  if (Node->isStdInitListInitialization())
851  OS << " std::initializer_list";
852  if (Node->requiresZeroInitialization())
853  OS << " zeroing";
854 }
855 
857  const CXXBindTemporaryExpr *Node) {
858  OS << " ";
859  dumpCXXTemporary(Node->getTemporary());
860 }
861 
863  if (Node->isGlobalNew())
864  OS << " global";
865  if (Node->isArray())
866  OS << " array";
867  if (Node->getOperatorNew()) {
868  OS << ' ';
870  }
871  // We could dump the deallocation function used in case of error, but it's
872  // usually not that interesting.
873 }
874 
876  if (Node->isGlobalDelete())
877  OS << " global";
878  if (Node->isArrayForm())
879  OS << " array";
880  if (Node->getOperatorDelete()) {
881  OS << ' ';
883  }
884 }
885 
888  if (const ValueDecl *VD = Node->getExtendingDecl()) {
889  OS << " extended by ";
890  dumpBareDeclRef(VD);
891  }
892 }
893 
895  for (unsigned i = 0, e = Node->getNumObjects(); i != e; ++i)
896  dumpDeclRef(Node->getObject(i), "cleanup");
897 }
898 
900  dumpPointer(Node->getPack());
901  dumpName(Node->getPack());
902 }
903 
906  OS << " " << (Node->isArrow() ? "->" : ".") << Node->getMember();
907 }
908 
910  OS << " selector=";
911  Node->getSelector().print(OS);
912  switch (Node->getReceiverKind()) {
914  break;
915 
917  OS << " class=";
919  break;
920 
922  OS << " super (instance)";
923  break;
924 
926  OS << " super (class)";
927  break;
928  }
929 }
930 
932  if (auto *BoxingMethod = Node->getBoxingMethod()) {
933  OS << " selector=";
934  BoxingMethod->getSelector().print(OS);
935  }
936 }
937 
939  if (!Node->getCatchParamDecl())
940  OS << " catch all";
941 }
942 
944  dumpType(Node->getEncodedType());
945 }
946 
948  OS << " ";
949  Node->getSelector().print(OS);
950 }
951 
953  OS << ' ' << *Node->getProtocol();
954 }
955 
957  if (Node->isImplicitProperty()) {
958  OS << " Kind=MethodRef Getter=\"";
959  if (Node->getImplicitPropertyGetter())
961  else
962  OS << "(null)";
963 
964  OS << "\" Setter=\"";
965  if (ObjCMethodDecl *Setter = Node->getImplicitPropertySetter())
966  Setter->getSelector().print(OS);
967  else
968  OS << "(null)";
969  OS << "\"";
970  } else {
971  OS << " Kind=PropertyRef Property=\"" << *Node->getExplicitProperty()
972  << '"';
973  }
974 
975  if (Node->isSuperReceiver())
976  OS << " super";
977 
978  OS << " Messaging=";
979  if (Node->isMessagingGetter() && Node->isMessagingSetter())
980  OS << "Getter&Setter";
981  else if (Node->isMessagingGetter())
982  OS << "Getter";
983  else if (Node->isMessagingSetter())
984  OS << "Setter";
985 }
986 
988  const ObjCSubscriptRefExpr *Node) {
989  if (Node->isArraySubscriptRefExpr())
990  OS << " Kind=ArraySubscript GetterForArray=\"";
991  else
992  OS << " Kind=DictionarySubscript GetterForDictionary=\"";
993  if (Node->getAtIndexMethodDecl())
994  Node->getAtIndexMethodDecl()->getSelector().print(OS);
995  else
996  OS << "(null)";
997 
998  if (Node->isArraySubscriptRefExpr())
999  OS << "\" SetterForArray=\"";
1000  else
1001  OS << "\" SetterForDictionary=\"";
1002  if (Node->setAtIndexMethodDecl())
1003  Node->setAtIndexMethodDecl()->getSelector().print(OS);
1004  else
1005  OS << "(null)";
1006 }
1007 
1009  OS << " " << (Node->getValue() ? "__objc_yes" : "__objc_no");
1010 }
1011 
1013  if (T->isSpelledAsLValue())
1014  OS << " written as lvalue reference";
1015 }
1016 
1018  switch (T->getSizeModifier()) {
1019  case ArrayType::Normal:
1020  break;
1021  case ArrayType::Static:
1022  OS << " static";
1023  break;
1024  case ArrayType::Star:
1025  OS << " *";
1026  break;
1027  }
1028  OS << " " << T->getIndexTypeQualifiers().getAsString();
1029 }
1030 
1032  OS << " " << T->getSize();
1033  VisitArrayType(T);
1034 }
1035 
1037  OS << " ";
1039  VisitArrayType(T);
1040 }
1041 
1043  const DependentSizedArrayType *T) {
1044  VisitArrayType(T);
1045  OS << " ";
1047 }
1048 
1050  const DependentSizedExtVectorType *T) {
1051  OS << " ";
1053 }
1054 
1056  switch (T->getVectorKind()) {
1058  break;
1060  OS << " altivec";
1061  break;
1063  OS << " altivec pixel";
1064  break;
1066  OS << " altivec bool";
1067  break;
1069  OS << " neon";
1070  break;
1072  OS << " neon poly";
1073  break;
1074  }
1075  OS << " " << T->getNumElements();
1076 }
1077 
1079  auto EI = T->getExtInfo();
1080  if (EI.getNoReturn())
1081  OS << " noreturn";
1082  if (EI.getProducesResult())
1083  OS << " produces_result";
1084  if (EI.getHasRegParm())
1085  OS << " regparm " << EI.getRegParm();
1086  OS << " " << FunctionType::getNameForCallConv(EI.getCC());
1087 }
1088 
1090  auto EPI = T->getExtProtoInfo();
1091  if (EPI.HasTrailingReturn)
1092  OS << " trailing_return";
1093  if (T->isConst())
1094  OS << " const";
1095  if (T->isVolatile())
1096  OS << " volatile";
1097  if (T->isRestrict())
1098  OS << " restrict";
1099  switch (EPI.RefQualifier) {
1100  case RQ_None:
1101  break;
1102  case RQ_LValue:
1103  OS << " &";
1104  break;
1105  case RQ_RValue:
1106  OS << " &&";
1107  break;
1108  }
1109  // FIXME: Exception specification.
1110  // FIXME: Consumed parameters.
1111  VisitFunctionType(T);
1112 }
1113 
1115  dumpDeclRef(T->getDecl());
1116 }
1117 
1119  dumpDeclRef(T->getDecl());
1120 }
1121 
1123  switch (T->getUTTKind()) {
1125  OS << " underlying_type";
1126  break;
1127  }
1128 }
1129 
1131  dumpDeclRef(T->getDecl());
1132 }
1133 
1135  OS << " depth " << T->getDepth() << " index " << T->getIndex();
1136  if (T->isParameterPack())
1137  OS << " pack";
1138  dumpDeclRef(T->getDecl());
1139 }
1140 
1142  if (T->isDecltypeAuto())
1143  OS << " decltype(auto)";
1144  if (!T->isDeduced())
1145  OS << " undeduced";
1146 }
1147 
1149  const TemplateSpecializationType *T) {
1150  if (T->isTypeAlias())
1151  OS << " alias";
1152  OS << " ";
1153  T->getTemplateName().dump(OS);
1154 }
1155 
1157  const InjectedClassNameType *T) {
1158  dumpDeclRef(T->getDecl());
1159 }
1160 
1162  dumpDeclRef(T->getDecl());
1163 }
1164 
1166  if (auto N = T->getNumExpansions())
1167  OS << " expansions " << *N;
1168 }
ObjCPropertyRefExpr - A dot-syntax expression to access an ObjC property.
Definition: ExprObjC.h:577
bool isBaseInitializer() const
Determine whether this initializer is initializing a base class.
Definition: DeclCXX.h:2325
The receiver is the instance of the superclass object.
Definition: ExprObjC.h:1061
void VisitObjCIvarRefExpr(const ObjCIvarRefExpr *Node)
bool path_empty() const
Definition: Expr.h:3073
Represents a function declaration or definition.
Definition: Decl.h:1738
static const TerminalColor StmtColor
NamedDecl * getFoundDecl()
Get the NamedDecl through which this reference occurred.
Definition: Expr.h:1151
bool getValue() const
Definition: ExprObjC.h:94
bool isVarArgParam() const LLVM_READONLY
Definition: Comment.h:777
The receiver is an object instance.
Definition: ExprObjC.h:1055
void VisitCXXDeleteExpr(const CXXDeleteExpr *Node)
A class which contains all the information about a particular captured value.
Definition: Decl.h:3864
Module * getOwningModule() const
Get the module that owns this declaration (for visibility purposes).
Definition: DeclBase.h:752
Represents the dependent type named by a dependently-scoped typename using declaration, e.g.
Definition: Type.h:4121
void VisitIfStmt(const IfStmt *Node)
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:673
A (possibly-)qualified type.
Definition: Type.h:638
void VisitNullPtrTemplateArgument(const TemplateArgument &TA)
const char * getDeclKindName() const
Definition: DeclBase.cpp:123
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
Definition: Expr.h:2778
ObjCMethodDecl * getAtIndexMethodDecl() const
Definition: ExprObjC.h:854
Selector getSelector() const
Definition: ExprObjC.cpp:312
void VisitCXXConstructExpr(const CXXConstructExpr *Node)
bool isSuperReceiver() const
Definition: ExprObjC.h:739
bool hasVarStorage() const
True if this IfStmt has storage for a variable declaration.
Definition: Stmt.h:1757
static void dumpPreviousDeclImpl(raw_ostream &OS,...)
bool isListInitialization() const
Determine whether this expression models list-initialization.
Definition: ExprCXX.h:3223
bool isPositionValid() const LLVM_READONLY
Definition: Comment.h:843
ObjCProtocolDecl * getProtocol() const
Definition: ExprObjC.h:490
Stmt - This represents one statement.
Definition: Stmt.h:66
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:3355
IfStmt - This represents an if/then/else.
Definition: Stmt.h:1687
ObjCMethodDecl * setAtIndexMethodDecl() const
Definition: ExprObjC.h:858
bool isDecltypeAuto() const
Definition: Type.h:4760
void VisitPredefinedExpr(const PredefinedExpr *Node)
void VisitCompoundAssignOperator(const CompoundAssignOperator *Node)
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:87
TagDecl * getDecl() const
Definition: Type.cpp:3166
void VisitObjCProtocolExpr(const ObjCProtocolExpr *Node)
ObjCMethodDecl * getImplicitPropertySetter() const
Definition: ExprObjC.h:680
FunctionDecl * getOperatorNew() const
Definition: ExprCXX.h:2033
bool isVirtual() const
Determines whether the base class is a virtual base class (or not).
Definition: DeclCXX.h:245
A reference to a name which we were able to look up during parsing but could not resolve to a specifi...
Definition: ExprCXX.h:2828
Defines the C++ template declaration subclasses.
Opcode getOpcode() const
Definition: Expr.h:3327
Represents a C++11 auto or C++14 decltype(auto) type.
Definition: Type.h:4749
void visitTParamCommandComment(const comments::TParamCommandComment *C, const comments::FullComment *FC)
void VisitCaseStmt(const CaseStmt *Node)
The base class of the type hierarchy.
Definition: Type.h:1407
bool requiresZeroInitialization() const
Whether this construction first requires zero-initialization before the initializer is called...
Definition: ExprCXX.h:1373
void VisitCastExpr(const CastExpr *Node)
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2812
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1262
ObjCSubscriptRefExpr - used for array and dictionary subscripting.
Definition: ExprObjC.h:803
RetTy Visit(const Type *T)
Performs the operation associated with this visitor object.
Definition: TypeVisitor.h:69
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:98
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:357
bool hasVarStorage() const
True if this SwitchStmt has storage for a condition variable.
Definition: Stmt.h:1944
IdentKind getIdentKind() const
Definition: Expr.h:1806
void VisitObjCBoolLiteralExpr(const ObjCBoolLiteralExpr *Node)
TemplateTypeParmDecl * getDecl() const
Definition: Type.h:4569
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2484
Represents a prvalue temporary that is written into memory so that a reference can bind to it...
Definition: ExprCXX.h:4156
static const TerminalColor ObjectKindColor
void dumpSourceRange(SourceRange R)
void VisitSizeOfPackExpr(const SizeOfPackExpr *Node)
const CXXBaseSpecifier *const * path_const_iterator
Definition: Expr.h:3072
An Objective-C array/dictionary subscripting which reads an object or writes at the subscripted array...
Definition: Specifiers.h:141
StringRef getArgText(unsigned Idx) const
Definition: Comment.h:361
void VisitTagType(const TagType *T)
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:6748
void VisitExtVectorElementExpr(const ExtVectorElementExpr *Node)
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:139
bool hasInitStorage() const
True if this SwitchStmt has storage for an init statement.
Definition: Stmt.h:1941
void VisitVectorType(const VectorType *T)
DeclarationName getName() const
Gets the name looked up.
Definition: ExprCXX.h:2744
bool isConst() const
Definition: Type.h:3630
const char * getName() const
Definition: Stmt.cpp:348
bool isInvalidDecl() const
Definition: DeclBase.h:542
bool requiresADL() const
True if this declaration should be extended by argument-dependent lookup.
Definition: ExprCXX.h:2896
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
unsigned getIndex(unsigned Depth) const
Definition: Comment.h:852
Represents an expression – generally a full-expression – that introduces cleanups to be run at the ...
Definition: ExprCXX.h:3089
ObjCPropertyDecl * getExplicitProperty() const
Definition: ExprObjC.h:670
void VisitDeclarationTemplateArgument(const TemplateArgument &TA)
void VisitTemplateSpecializationType(const TemplateSpecializationType *T)
Information about a single command.
const char * getStmtClassName() const
Definition: Stmt.cpp:75
SourceLocation getAttributeLoc() const
Definition: Type.h:3145
LabelStmt - Represents a label, which has a substatement.
Definition: Stmt.h:1593
void VisitCXXNamedCastExpr(const CXXNamedCastExpr *Node)
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:298
const char * getOpenMPClauseName(OpenMPClauseKind Kind)
Definition: OpenMPKinds.cpp:62
Provides common interface for the Decls that can be redeclared.
Definition: Redeclarable.h:85
void VisitMaterializeTemporaryExpr(const MaterializeTemporaryExpr *Node)
QualType getComputationResultType() const
Definition: Expr.h:3535
bool isImplicit() const
Returns true if the attribute has been implicitly created instead of explicitly written by the user...
Definition: Attr.h:102
A vector component is an element or range of elements on a vector.
Definition: Specifiers.h:132
is ARM Neon vector
Definition: Type.h:3184
RenderKind getRenderKind() const
Definition: Comment.h:353
Used for GCC&#39;s __alignof.
Definition: TypeTraits.h:107
bool isSpelledAsLValue() const
Definition: Type.h:2689
void VisitPackTemplateArgument(const TemplateArgument &TA)
TemplateName getTemplateName() const
Retrieve the name of the template that we are specializing.
Definition: Type.h:4904
TypeSourceInfo * getTypeSourceInfo() const
Returns the declarator information for a base class or delegating initializer.
Definition: DeclCXX.h:2386
StringRef getText() const LLVM_READONLY
Definition: Comment.h:884
The iterator over UnresolvedSets.
Definition: UnresolvedSet.h:32
void VisitFunctionProtoType(const FunctionProtoType *T)
virtual SourceRange getSourceRange() const LLVM_READONLY
Source range that this declaration covers.
Definition: DeclBase.h:406
ExtVectorElementExpr - This represents access to specific elements of a vector, and may occur on the ...
Definition: Expr.h:5121
Describes a module or submodule.
Definition: Module.h:65
An r-value expression (a pr-value in the C++11 taxonomy) produces a temporary value.
Definition: Specifiers.h:110
Selector getSelector() const
Definition: ExprObjC.h:442
Represents Objective-C&#39;s @catch statement.
Definition: StmtObjC.h:74
StringRef getOpcodeStr() const
Definition: Expr.h:3348
void VisitSwitchStmt(const SwitchStmt *Node)
A command with word-like arguments that is considered inline content.
Definition: Comment.h:299
Describes an C or C++ initializer list.
Definition: Expr.h:4190
void VisitCXXBindTemporaryExpr(const CXXBindTemporaryExpr *Node)
UnresolvedUsingTypenameDecl * getDecl() const
Definition: Type.h:4132
An lvalue ref-qualifier was provided (&).
Definition: Type.h:1363
A line of text contained in a verbatim block.
Definition: Comment.h:864
bool isMessagingSetter() const
True if the property reference will result in a message to the setter.
Definition: ExprObjC.h:707
FunctionDecl * getOperatorDelete() const
Definition: ExprCXX.h:2210
bool isElidable() const
Whether this construction is elidable.
Definition: ExprCXX.h:1340
bool isGlobalNew() const
Definition: ExprCXX.h:2074
A verbatim line command.
Definition: Comment.h:944
void VisitUnresolvedLookupExpr(const UnresolvedLookupExpr *Node)
An x-value expression is a reference to an object with independent storage but which can be "moved"...
Definition: Specifiers.h:119
bool isTypeAlias() const
Determine if this template specialization type is for a type alias template that has been substituted...
Definition: Type.h:4889
path_iterator path_begin()
Definition: Expr.h:3075
void VisitObjCSubscriptRefExpr(const ObjCSubscriptRefExpr *Node)
bool isByRef() const
Whether this is a "by ref" capture, i.e.
Definition: Decl.h:3889
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1831
A builtin binary operation expression such as "x + y" or "x <= y".
Definition: Expr.h:3292
static bool isPostfix(Opcode Op)
isPostfix - Return true if this is a postfix operation, like x++.
Definition: Expr.h:1943
Any part of the comment.
Definition: Comment.h:53
void VisitObjCAtCatchStmt(const ObjCAtCatchStmt *Node)
bool hasElseStorage() const
True if this IfStmt has storage for an else statement.
Definition: Stmt.h:1760
CXXRecordDecl * getDecl() const
Definition: Type.cpp:3255
bool isArrow() const
Definition: Expr.h:2879
static const TerminalColor DeclNameColor
void VisitTemplateTypeParmType(const TemplateTypeParmType *T)
void VisitTemplateExpansionTemplateArgument(const TemplateArgument &TA)
static const TerminalColor LocationColor
void VisitExpressionTemplateArgument(const TemplateArgument &TA)
CaseStmt - Represent a case statement.
Definition: Stmt.h:1394
bool isAnyMemberInitializer() const
Definition: DeclCXX.h:2333
void dumpLocation(SourceLocation Loc)
CastExpr - Base class for type casts, including both implicit casts (ImplicitCastExpr) and explicit c...
Definition: Expr.h:3003
unsigned getParamIndex() const LLVM_READONLY
Definition: Comment.h:786
Represents binding an expression to a temporary.
Definition: ExprCXX.h:1217
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC)...
Definition: DeclBase.h:821
SourceLocation getSpellingLoc(SourceLocation Loc) const
Given a SourceLocation object, return the spelling location referenced by the ID. ...
CXXTemporary * getTemporary()
Definition: ExprCXX.h:1236
FieldDecl * getAnyMember() const
Definition: DeclCXX.h:2398
void * getAsOpaquePtr() const
Definition: Type.h:683
void VisitLabelStmt(const LabelStmt *Node)
An ordinary object is located at an address in memory.
Definition: Specifiers.h:126
Represents a C++ member access expression where the actual member referenced could not be resolved be...
Definition: ExprCXX.h:3284
is ARM Neon polynomial vector
Definition: Type.h:3187
SplitQualType getSplitDesugaredType() const
Definition: Type.h:942
void visitHTMLStartTagComment(const comments::HTMLStartTagComment *C, const comments::FullComment *)
Represents an extended vector type where either the type or size is dependent.
Definition: Type.h:3128
void visitVerbatimBlockComment(const comments::VerbatimBlockComment *C, const comments::FullComment *)
Represents the this expression in C++.
Definition: ExprCXX.h:976
ObjCIvarDecl * getDecl()
Definition: ExprObjC.h:543
bool isArrayForm() const
Definition: ExprCXX.h:2197
QualType getTypeAsWritten() const
getTypeAsWritten - Returns the type that this expression is casting to, as written in the source code...
Definition: Expr.h:3218
decl_type * getFirstDecl()
Return the first declaration of this declaration or itself if this is the only declaration.
Definition: Redeclarable.h:319
A verbatim block command (e.
Definition: Comment.h:892
void VisitInjectedClassNameType(const InjectedClassNameType *T)
const ValueDecl * getExtendingDecl() const
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Definition: ExprCXX.h:4219
void VisitDependentSizedExtVectorType(const DependentSizedExtVectorType *T)
void VisitTemplateTemplateArgument(const TemplateArgument &TA)
StringRef getText() const LLVM_READONLY
Definition: Comment.h:283
bool isStdInitListInitialization() const
Whether this constructor call was written as list-initialization, but was interpreted as forming a st...
Definition: ExprCXX.h:1364
ArrayRef< Module * > getModulesWithMergedDefinition(const NamedDecl *Def)
Get the additional modules in which the definition Def has been merged.
Definition: ASTContext.h:990
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3687
void VisitImplicitCastExpr(const ImplicitCastExpr *Node)
CXXConstructorDecl * getConstructor() const
Get the constructor that this expression will (ultimately) call.
Definition: ExprCXX.h:1334
QualType getComputationLHSType() const
Definition: Expr.h:3532
OpenMPClauseKind getClauseKind() const
Returns kind of OpenMP clause (private, shared, reduction, etc.).
Definition: OpenMPClause.h:79
bool isDelegatingInitializer() const
Determine whether this initializer is creating a delegating constructor.
Definition: DeclCXX.h:2353
UnaryExprOrTypeTraitExpr - expression with either a type or (unevaluated) expression operand...
Definition: Expr.h:2222
void VisitObjCPropertyRefExpr(const ObjCPropertyRefExpr *Node)
ValueDecl * getAsDecl() const
Retrieve the declaration for a declaration non-type template argument.
Definition: TemplateBase.h:264
void outputString(raw_ostream &OS) const
Definition: Expr.cpp:1005
unsigned getValue() const
Definition: Expr.h:1426
An Objective-C property is a logical field of an Objective-C object which is read and written via Obj...
Definition: Specifiers.h:136
Represents an array type in C++ whose size is a value-dependent expression.
Definition: Type.h:3026
ObjCMethodDecl * getBoxingMethod() const
Definition: ExprObjC.h:138
static const TerminalColor ValueColor
static const TerminalColor CommentColor
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Definition: Decl.h:637
void visitParamCommandComment(const comments::ParamCommandComment *C, const comments::FullComment *FC)
void visitInlineCommandComment(const comments::InlineCommandComment *C, const comments::FullComment *)
bool isInvalid() const
Return true if this object is invalid or uninitialized.
std::string Label
unsigned getIndex() const
Definition: Type.h:4566
void VisitObjCSelectorExpr(const ObjCSelectorExpr *Node)
unsigned getLine() const
Return the presumed line number of this location.
void visitVerbatimBlockLineComment(const comments::VerbatimBlockLineComment *C, const comments::FullComment *)
void VisitCXXFunctionalCastExpr(const CXXFunctionalCastExpr *Node)
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:547
TextNodeDumper(raw_ostream &OS, bool ShowColors, const SourceManager *SM, const PrintingPolicy &PrintPolicy, const comments::CommandTraits *Traits)
const char * getTypeClassName() const
Definition: Type.cpp:2646
QualType getArgumentType() const
Definition: Expr.h:2259
A command that has zero or more word-like arguments (number of word-like arguments depends on command...
Definition: Comment.h:597
DeclContext * getDeclContext()
Definition: DeclBase.h:427
ObjCSelectorExpr used for @selector in Objective-C.
Definition: ExprObjC.h:429
Represents an expression that computes the length of a parameter pack.
Definition: ExprCXX.h:3844
IdentifierInfo & getAccessor() const
Definition: Expr.h:5143
decls_iterator decls_begin() const
Definition: ExprCXX.h:2727
A std::pair-like structure for storing a qualified type split into its local qualifiers and its local...
Definition: Type.h:577
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char, signed char, short, int, long..], or an enum decl which has a signed representation.
Definition: Type.cpp:1844
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
QualType getType() const
Definition: Expr.h:128
static const TerminalColor ValueKindColor
A unary type transform, which is a type constructed from another.
Definition: Type.h:4289
void VisitGotoStmt(const GotoStmt *Node)
void dump(raw_ostream &OS) const
Debugging aid that dumps the template name.
Qualifiers Quals
The local qualifiers.
Definition: Type.h:582
bool isDirectionExplicit() const LLVM_READONLY
Definition: Comment.h:750
LabelDecl * getLabel() const
Definition: Stmt.h:2317
QualType getEncodedType() const
Definition: ExprObjC.h:407
An expression that sends a message to the given Objective-C object or class.
Definition: ExprObjC.h:904
void VisitTypedefType(const TypedefType *T)
Represents an unpacked "presumed" location which can be presented to the user.
ObjCMethodDecl * getImplicitPropertyGetter() const
Definition: ExprObjC.h:675
SourceLocation getEnd() const
UnaryOperator - This represents the unary-expression&#39;s (except sizeof and alignof), the postinc/postdec operators from postfix-expression, and various extensions.
Definition: Expr.h:1896
void dumpBareType(QualType T, bool Desugar=true)
Represents a GCC generic vector type.
Definition: Type.h:3168
ReceiverKind getReceiverKind() const
Determine the kind of receiver that this message is being sent to.
Definition: ExprObjC.h:1188
An opening HTML tag with attributes.
Definition: Comment.h:414
ArraySizeModifier getSizeModifier() const
Definition: Type.h:2849
UTTKind getUTTKind() const
Definition: Type.h:4317
ValueDecl * getDecl()
Definition: Expr.h:1114
Selector getSelector() const
Definition: DeclObjC.h:321
std::string getAsString() const
static QualType Desugar(ASTContext &Context, QualType QT, bool &ShouldAKA)
void VisitExprWithCleanups(const ExprWithCleanups *Node)
bool isNull() const
Return true if this QualType doesn&#39;t point to a type yet.
Definition: Type.h:703
void visitBlockCommandComment(const comments::BlockCommandComment *C, const comments::FullComment *)
void VisitFloatingLiteral(const FloatingLiteral *Node)
bool getValue() const
Definition: ExprCXX.h:574
const SourceManager & SM
Definition: Format.cpp:1490
static const char * getDirectionAsString(PassDirection D)
Definition: Comment.cpp:178
SplitQualType split() const
Divides a QualType into its unqualified type and a set of local qualifiers.
Definition: Type.h:6080
const char * getFilename() const
Return the presumed filename of this location.
This class provides information about commands that can be used in comments.
is AltiVec &#39;vector Pixel&#39;
Definition: Type.h:3178
static StringRef getIdentKindName(IdentKind IK)
Definition: Expr.cpp:513
not a target-specific vector type
Definition: Type.h:3172
bool isImplicitProperty() const
Definition: ExprObjC.h:667
decl_type * getPreviousDecl()
Return the previous declaration of this declaration or NULL if this is the first declaration.
Definition: Redeclarable.h:204
void VisitNullTemplateArgument(const TemplateArgument &TA)
ExtProtoInfo getExtProtoInfo() const
Definition: Type.h:3899
unsigned getColumn() const
Return the presumed column number of this location.
Encodes a location in the source.
ObjCInterfaceDecl * getDecl() const
Get the declaration of this interface.
Definition: Type.h:5751
void VisitIntegralTemplateArgument(const TemplateArgument &TA)
void VisitDependentSizedArrayType(const DependentSizedArrayType *T)
bool hasVarStorage() const
True if this WhileStmt has storage for a condition variable.
Definition: Stmt.h:2110
void dumpPointer(const void *Ptr)
Represents a C++ temporary.
Definition: ExprCXX.h:1185
void VisitFixedPointLiteral(const FixedPointLiteral *Node)
Interfaces are the core concept in Objective-C for object oriented design.
Definition: Type.h:5738
bool isVariablyModifiedType() const
Whether this type is a variably-modified type (C99 6.7.5).
Definition: Type.h:2095
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
Definition: Decl.h:292
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)"...
Definition: ExprCXX.h:1914
SourceRange getSourceRange() const LLVM_READONLY
Definition: Comment.h:216
ASTContext & getASTContext() const LLVM_READONLY
Definition: DeclBase.cpp:376
bool isParamIndexValid() const LLVM_READONLY
Definition: Comment.h:773
void VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *Node)
static void dumpBasePath(raw_ostream &OS, const CastExpr *Node)
const CommandInfo * getCommandInfo(StringRef Name) const
bool isRestrict() const
Definition: Type.h:3632
QualType getLocallyUnqualifiedSingleStepDesugaredType() const
Pull a single level of sugar off of this locally-unqualified type.
Definition: Type.cpp:302
std::string getValueAsString(unsigned Radix) const
Definition: Expr.cpp:822
void VisitMemberExpr(const MemberExpr *Node)
void VisitCallExpr(const CallExpr *Node)
bool canOverflow() const
Returns true if the unary operator can cause an overflow.
Definition: Expr.h:1939
No ref-qualifier was provided.
Definition: Type.h:1360
const char * getNameStart() const
Return the beginning of the actual null-terminated string for this identifier.
This file defines OpenMP nodes for declarative directives.
bool isParameterPack() const
Definition: Type.h:4567
This is a basic class for representing single OpenMP clause.
Definition: OpenMPClause.h:51
UnaryExprOrTypeTrait getKind() const
Definition: Expr.h:2253
bool isArray() const
Definition: ExprCXX.h:2038
static const TerminalColor NullColor
ObjCProtocolExpr used for protocol expression in Objective-C.
Definition: ExprObjC.h:474
StringRef getParamNameAsWritten() const
Definition: Comment.h:835
is AltiVec &#39;vector bool ...&#39;
Definition: Type.h:3181
ImplicitCastExpr - Allows us to explicitly represent implicit type conversions, which have no direct ...
Definition: Expr.h:3120
bool isFromASTFile() const
Determine whether this declaration came from an AST file (such as a precompiled header or module) rat...
Definition: DeclBase.h:695
void dumpDeclRef(const Decl *D, StringRef Label={})
bool isMessagingGetter() const
True if the property reference will result in a message to the getter.
Definition: ExprObjC.h:700
is AltiVec vector
Definition: Type.h:3175
PassDirection getDirection() const LLVM_READONLY
Definition: Comment.h:746
void VisitCXXNewExpr(const CXXNewExpr *Node)
Qualifiers getIndexTypeQualifiers() const
Definition: Type.h:2853
Used for C&#39;s _Alignof and C++&#39;s alignof.
Definition: TypeTraits.h:101
void VisitVariableArrayType(const VariableArrayType *T)
bool isUsed(bool CheckUsedAttr=true) const
Whether any (re-)declaration of the entity was used, meaning that a definition is required...
Definition: DeclBase.cpp:397
VarDecl * getVariable() const
The variable being captured.
Definition: Decl.h:3885
llvm::APSInt getAsIntegral() const
Retrieve the template argument as an integral value.
Definition: TemplateBase.h:301
void VisitInitListExpr(const InitListExpr *ILE)
A closing HTML tag.
Definition: Comment.h:508
An rvalue ref-qualifier was provided (&&).
Definition: Type.h:1366
SourceRange getBracketsRange() const
Definition: Type.h:3054
void VisitPackExpansionType(const PackExpansionType *T)
ObjCBoxedExpr - used for generalized expression boxing.
Definition: ExprObjC.h:117
bool isArgumentType() const
Definition: Expr.h:2258
Optional< unsigned > getNumExpansions() const
Retrieve the number of expansions that this pack expansion will generate, if known.
Definition: Type.h:5380
bool isPartOfExplicitCast() const
Definition: Expr.h:3139
std::string getAsString() const
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:2085
void VisitObjCEncodeExpr(const ObjCEncodeExpr *Node)
Doxygen \tparam command, describes a template parameter.
Definition: Comment.h:800
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:4978
Represents a pack expansion of types.
Definition: Type.h:5355
CompoundAssignOperator - For compound assignments (e.g.
Definition: Expr.h:3509
void VisitArrayType(const ArrayType *T)
SourceRange getRange() const
Definition: Attr.h:95
void VisitIntegerLiteral(const IntegerLiteral *Node)
AddrLabelExpr - The GNU address of label extension, representing &&label.
Definition: Expr.h:3762
ast_type_traits::DynTypedNode Node
void dumpAccessSpecifier(AccessSpecifier AS)
Represents a template argument.
Definition: TemplateBase.h:51
bool isThisDeclarationReferenced() const
Whether this declaration was referenced.
Definition: DeclBase.h:575
bool isDeduced() const
Definition: Type.h:4738
Dataflow Directional Tag Classes.
ExtInfo getExtInfo() const
Definition: Type.h:3624
[C99 6.4.2.2] - A predefined identifier such as func.
Definition: Expr.h:1758
static const TerminalColor AttrColor
Represents a delete expression for memory deallocation and destructor calls, e.g. ...
Definition: ExprCXX.h:2170
bool isNested() const
Whether this is a nested capture, i.e.
Definition: Decl.h:3901
bool hasInitStorage() const
True if this IfStmt has the storage for an init statement.
Definition: Stmt.h:1754
void visitTextComment(const comments::TextComment *C, const comments::FullComment *)
bool usesADL() const
Definition: Expr.h:2524
DeclarationName getMember() const
Retrieve the name of the member that this expression refers to.
Definition: ExprCXX.h:3430
bool isImplicit() const
Definition: OpenMPClause.h:81
VectorKind getVectorKind() const
Definition: Type.h:3213
static std::string getAsString(SplitQualType split, const PrintingPolicy &Policy)
Definition: Type.h:971
Kind getKind() const
Definition: DeclBase.h:421
void VisitUnresolvedUsingType(const UnresolvedUsingType *T)
bool isListInitialization() const
Whether this constructor call was written as list-initialization.
Definition: ExprCXX.h:1353
const Type * getBaseClass() const
If this is a base class initializer, returns the type of the base class.
Definition: DeclCXX.cpp:2266
void VisitDeclRefExpr(const DeclRefExpr *Node)
PresumedLoc getPresumedLoc(SourceLocation Loc, bool UseLineDirectives=true) const
Returns the "presumed" location of a SourceLocation specifies.
void VisitObjCMessageExpr(const ObjCMessageExpr *Node)
SourceLocation getBeginLoc() const
Returns the starting location of the clause.
Definition: OpenMPClause.h:67
llvm::APInt getValue() const
Definition: Expr.h:1292
LabelDecl * getLabel() const
Definition: Expr.h:3784
void VisitTypeTemplateArgument(const TemplateArgument &TA)
SourceLocation getEndLoc() const
Returns the ending location of the clause.
Definition: OpenMPClause.h:70
QualType getClassReceiver() const
Returns the type of a class message send, or NULL if the message is not a class message.
Definition: ExprObjC.h:1226
path_iterator path_end()
Definition: Expr.h:3076
StringRef getTagName() const LLVM_READONLY
Definition: Comment.h:396
void VisitAddrLabelExpr(const AddrLabelExpr *Node)
SwitchStmt - This represents a &#39;switch&#39; stmt.
Definition: Stmt.h:1886
void Visit(const comments::Comment *C, const comments::FullComment *FC)
Provides common interface for the Decls that cannot be redeclared, but can be merged if the same decl...
Definition: Redeclarable.h:313
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4370
void VisitCXXDependentScopeMemberExpr(const CXXDependentScopeMemberExpr *Node)
static const CommandInfo * getBuiltinCommandInfo(StringRef Name)
void VisitFunctionType(const FunctionType *T)
Represents a C++ base or member initializer.
Definition: DeclCXX.h:2256
unsigned getNumObjects() const
Definition: ExprCXX.h:3120
ObjCEncodeExpr, used for @encode in Objective-C.
Definition: ExprObjC.h:386
bool isFromAST() const
Whether this type comes from an AST file.
Definition: Type.h:1814
void VisitConstantArrayType(const ConstantArrayType *T)
static void dumpPreviousDecl(raw_ostream &OS, const Decl *D)
Dump the previous declaration in the redeclaration chain for a declaration, if any.
static const TerminalColor CastColor
const llvm::APInt & getSize() const
Definition: Type.h:2890
static const TerminalColor TypeColor
Opcode getOpcode() const
Definition: Expr.h:1921
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2673
static const TerminalColor DeclKindNameColor
SourceRange getBracketsRange() const
Definition: Type.h:2997
static const char * getCastKindName(CastKind CK)
Definition: Expr.cpp:1745
bool isVolatile() const
Definition: Type.h:3631
void VisitCXXUnresolvedConstructExpr(const CXXUnresolvedConstructExpr *Node)
bool isArrow() const
Determine whether this member expression used the &#39;->&#39; operator; otherwise, it used the &#39;...
Definition: ExprCXX.h:3391
Represents a base class of a C++ class.
Definition: DeclCXX.h:192
A bitfield object is a bitfield on a C or C++ record.
Definition: Specifiers.h:129
void VisitCharacterLiteral(const CharacterLiteral *Node)
ObjCIvarRefExpr - A reference to an ObjC instance variable.
Definition: ExprObjC.h:513
Describes an explicit type conversion that uses functional notion but could not be resolved because o...
Definition: ExprCXX.h:3169
GotoStmt - This represents a direct goto.
Definition: Stmt.h:2304
void VisitBinaryOperator(const BinaryOperator *Node)
TypedefNameDecl * getDecl() const
Definition: Type.h:4167
unsigned getDepth() const
Definition: Type.h:4565
bool isFreeIvar() const
Definition: ExprObjC.h:552
void dumpName(const NamedDecl *ND)
MemberExpr - [C99 6.5.2.3] Structure and Union Members.
Definition: Expr.h:2687
Represents a C++ struct/union/class.
Definition: DeclCXX.h:300
const char * getCommentKindName() const
Definition: Comment.cpp:21
bool isValid() const
void VisitUnaryTransformType(const UnaryTransformType *T)
Represents an explicit C++ type conversion that uses "functional" notation (C++ [expr.type.conv]).
Definition: ExprCXX.h:1519
WhileStmt - This represents a &#39;while&#39; stmt.
Definition: Stmt.h:2063
void dumpBareDeclRef(const Decl *D)
CleanupObject getObject(unsigned i) const
Definition: ExprCXX.h:3122
bool isInherited() const
Definition: Attr.h:98
const Attribute & getAttr(unsigned Idx) const
Definition: Comment.h:477
The receiver is a class.
Definition: ExprObjC.h:1052
SourceRange getSourceRange() const LLVM_READONLY
SourceLocation tokens are not useful in isolation - they are low level value objects created/interpre...
Definition: Stmt.cpp:276
bool isGlobalDelete() const
Definition: ExprCXX.h:2196
void VisitObjCInterfaceType(const ObjCInterfaceType *T)
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1566
void dumpType(QualType T)
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition: Expr.h:2396
StringRef getName() const
Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:276
StringRef getParamNameAsWritten() const
Definition: Comment.h:765
Abstract class common to all of the C++ "named"/"keyword" casts.
Definition: ExprCXX.h:270
unsigned getNumElements() const
Definition: Type.h:3204
ObjCBoolLiteralExpr - Objective-C Boolean Literal.
Definition: ExprObjC.h:82
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2079
QualType getAsType() const
Retrieve the type for a type template argument.
Definition: TemplateBase.h:257
A reference to a declared variable, function, enum, etc.
Definition: Expr.h:1041
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:4841
Doxygen \param command.
Definition: Comment.h:712
const VarDecl * getCatchParamDecl() const
Definition: StmtObjC.h:94
const char * getCastName() const
getCastName - Get the name of the C++ cast being used, e.g., "static_cast", "dynamic_cast", "reinterpret_cast", or "const_cast".
Definition: ExprCXX.cpp:678
FieldDecl * getInitializedFieldInUnion()
If this initializes a union, specifies which field in the union to initialize.
Definition: Expr.h:4302
bool isArraySubscriptRefExpr() const
Definition: ExprObjC.h:862
QualType getTypeAsWritten() const
Retrieve the type that is being constructed, as specified in the source code.
Definition: ExprCXX.h:3204
static StringRef getNameForCallConv(CallingConv CC)
Definition: Type.cpp:2822
QualType getType() const
Definition: Decl.h:648
An l-value expression is a reference to an object with independent storage.
Definition: Specifiers.h:114
void VisitAutoType(const AutoType *T)
static const TerminalColor AddressColor
A trivial tuple used to represent a source range.
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to...
Definition: Expr.cpp:1193
This represents a decl that may have a name.
Definition: Decl.h:249
A boolean literal, per ([C++ lex.bool] Boolean literals).
Definition: ExprCXX.h:562
StringRef getParamName(const FullComment *FC) const
Definition: Comment.cpp:364
Represents a C array with a specified size that is not an integer-constant-expression.
Definition: Type.h:2971
void VisitCXXThisExpr(const CXXThisExpr *Node)
TemplateName getAsTemplate() const
Retrieve the template name for a template name argument.
Definition: TemplateBase.h:281
void VisitUnaryExprOrTypeTraitExpr(const UnaryExprOrTypeTraitExpr *Node)
void visitHTMLEndTagComment(const comments::HTMLEndTagComment *C, const comments::FullComment *)
void visitVerbatimLineComment(const comments::VerbatimLineComment *C, const comments::FullComment *)
double getValueAsApproximateDouble() const
getValueAsApproximateDouble - This returns the value as an inaccurate double.
Definition: Expr.cpp:896
attr::Kind getKind() const
Definition: Attr.h:87
The receiver is a superclass.
Definition: ExprObjC.h:1058
TemplateName getAsTemplateOrTemplatePattern() const
Retrieve the template argument as a template name; if the argument is a pack expansion, return the pattern as a template name.
Definition: TemplateBase.h:288
SourceLocation getBegin() const
NamedDecl * getPack() const
Retrieve the parameter pack.
Definition: ExprCXX.h:3915
decls_iterator decls_end() const
Definition: ExprCXX.h:2730
bool caseStmtIsGNURange() const
True if this case statement is of the form case LHS ...
Definition: Stmt.h:1463
Represents the canonical version of C arrays with a specified constant size.
Definition: Type.h:2872
This class handles loading and caching of source files into memory.
void VisitUnaryOperator(const UnaryOperator *Node)
void AddChild(Fn DoAddChild)
Add a child of the current node. Calls DoAddChild without arguments.
Attr - This represents one attribute.
Definition: Attr.h:44
SourceLocation getLocation() const
Definition: DeclBase.h:418
A full comment attached to a declaration, contains block content.
Definition: Comment.h:1092
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:98
void VisitObjCBoxedExpr(const ObjCBoxedExpr *Node)
void VisitWhileStmt(const WhileStmt *Node)
void VisitStringLiteral(const StringLiteral *Str)
QualType getType() const
Retrieves the type of the base class.
Definition: DeclCXX.h:291
void VisitRValueReferenceType(const ReferenceType *T)