clang  3.8.0
DeclPrinter.cpp
Go to the documentation of this file.
1 //===--- DeclPrinter.cpp - Printing implementation for Decl ASTs ----------===//
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 the Decl::print method, which pretty prints the
11 // AST back out to C/Objective-C/C++/Objective-C++ code.
12 //
13 //===----------------------------------------------------------------------===//
14 #include "clang/AST/ASTContext.h"
15 #include "clang/AST/Attr.h"
16 #include "clang/AST/Decl.h"
17 #include "clang/AST/DeclCXX.h"
18 #include "clang/AST/DeclObjC.h"
19 #include "clang/AST/DeclVisitor.h"
20 #include "clang/AST/Expr.h"
21 #include "clang/AST/ExprCXX.h"
23 #include "clang/Basic/Module.h"
24 #include "llvm/Support/raw_ostream.h"
25 using namespace clang;
26 
27 namespace {
28  class DeclPrinter : public DeclVisitor<DeclPrinter> {
29  raw_ostream &Out;
30  PrintingPolicy Policy;
31  unsigned Indentation;
32  bool PrintInstantiation;
33 
34  raw_ostream& Indent() { return Indent(Indentation); }
35  raw_ostream& Indent(unsigned Indentation);
36  void ProcessDeclGroup(SmallVectorImpl<Decl*>& Decls);
37 
38  void Print(AccessSpecifier AS);
39 
40  /// Print an Objective-C method type in parentheses.
41  ///
42  /// \param Quals The Objective-C declaration qualifiers.
43  /// \param T The type to print.
44  void PrintObjCMethodType(ASTContext &Ctx, Decl::ObjCDeclQualifier Quals,
45  QualType T);
46 
47  void PrintObjCTypeParams(ObjCTypeParamList *Params);
48 
49  public:
50  DeclPrinter(raw_ostream &Out, const PrintingPolicy &Policy,
51  unsigned Indentation = 0, bool PrintInstantiation = false)
52  : Out(Out), Policy(Policy), Indentation(Indentation),
53  PrintInstantiation(PrintInstantiation) { }
54 
55  void VisitDeclContext(DeclContext *DC, bool Indent = true);
56 
60  void VisitEnumDecl(EnumDecl *D);
61  void VisitRecordDecl(RecordDecl *D);
63  void VisitEmptyDecl(EmptyDecl *D);
65  void VisitFriendDecl(FriendDecl *D);
66  void VisitFieldDecl(FieldDecl *D);
67  void VisitVarDecl(VarDecl *D);
68  void VisitLabelDecl(LabelDecl *D);
71  void VisitImportDecl(ImportDecl *D);
78  void VisitTemplateDecl(const TemplateDecl *D);
92  void VisitUsingDecl(UsingDecl *D);
95 
96  void PrintTemplateParameters(const TemplateParameterList *Params,
97  const TemplateArgumentList *Args = nullptr);
98  void prettyPrintAttributes(Decl *D);
99  void prettyPrintPragmas(Decl *D);
100  void printDeclType(QualType T, StringRef DeclName, bool Pack = false);
101  };
102 }
103 
104 void Decl::print(raw_ostream &Out, unsigned Indentation,
105  bool PrintInstantiation) const {
106  print(Out, getASTContext().getPrintingPolicy(), Indentation, PrintInstantiation);
107 }
108 
109 void Decl::print(raw_ostream &Out, const PrintingPolicy &Policy,
110  unsigned Indentation, bool PrintInstantiation) const {
111  DeclPrinter Printer(Out, Policy, Indentation, PrintInstantiation);
112  Printer.Visit(const_cast<Decl*>(this));
113 }
114 
116  // FIXME: This should be on the Type class!
117  QualType BaseType = T;
118  while (!BaseType->isSpecifierType()) {
119  if (isa<TypedefType>(BaseType))
120  break;
121  else if (const PointerType* PTy = BaseType->getAs<PointerType>())
122  BaseType = PTy->getPointeeType();
123  else if (const BlockPointerType *BPy = BaseType->getAs<BlockPointerType>())
124  BaseType = BPy->getPointeeType();
125  else if (const ArrayType* ATy = dyn_cast<ArrayType>(BaseType))
126  BaseType = ATy->getElementType();
127  else if (const FunctionType* FTy = BaseType->getAs<FunctionType>())
128  BaseType = FTy->getReturnType();
129  else if (const VectorType *VTy = BaseType->getAs<VectorType>())
130  BaseType = VTy->getElementType();
131  else if (const ReferenceType *RTy = BaseType->getAs<ReferenceType>())
132  BaseType = RTy->getPointeeType();
133  else
134  llvm_unreachable("Unknown declarator!");
135  }
136  return BaseType;
137 }
138 
140  if (TypedefNameDecl* TDD = dyn_cast<TypedefNameDecl>(D))
141  return TDD->getUnderlyingType();
142  if (ValueDecl* VD = dyn_cast<ValueDecl>(D))
143  return VD->getType();
144  return QualType();
145 }
146 
147 void Decl::printGroup(Decl** Begin, unsigned NumDecls,
148  raw_ostream &Out, const PrintingPolicy &Policy,
149  unsigned Indentation) {
150  if (NumDecls == 1) {
151  (*Begin)->print(Out, Policy, Indentation);
152  return;
153  }
154 
155  Decl** End = Begin + NumDecls;
156  TagDecl* TD = dyn_cast<TagDecl>(*Begin);
157  if (TD)
158  ++Begin;
159 
160  PrintingPolicy SubPolicy(Policy);
161  if (TD && TD->isCompleteDefinition()) {
162  TD->print(Out, Policy, Indentation);
163  Out << " ";
164  SubPolicy.SuppressTag = true;
165  }
166 
167  bool isFirst = true;
168  for ( ; Begin != End; ++Begin) {
169  if (isFirst) {
170  SubPolicy.SuppressSpecifiers = false;
171  isFirst = false;
172  } else {
173  if (!isFirst) Out << ", ";
174  SubPolicy.SuppressSpecifiers = true;
175  }
176 
177  (*Begin)->print(Out, SubPolicy, Indentation);
178  }
179 }
180 
181 LLVM_DUMP_METHOD void DeclContext::dumpDeclContext() const {
182  // Get the translation unit
183  const DeclContext *DC = this;
184  while (!DC->isTranslationUnit())
185  DC = DC->getParent();
186 
187  ASTContext &Ctx = cast<TranslationUnitDecl>(DC)->getASTContext();
188  DeclPrinter Printer(llvm::errs(), Ctx.getPrintingPolicy(), 0);
189  Printer.VisitDeclContext(const_cast<DeclContext *>(this), /*Indent=*/false);
190 }
191 
192 raw_ostream& DeclPrinter::Indent(unsigned Indentation) {
193  for (unsigned i = 0; i != Indentation; ++i)
194  Out << " ";
195  return Out;
196 }
197 
198 void DeclPrinter::prettyPrintAttributes(Decl *D) {
199  if (Policy.PolishForDeclaration)
200  return;
201 
202  if (D->hasAttrs()) {
203  AttrVec &Attrs = D->getAttrs();
204  for (auto *A : Attrs) {
205  switch (A->getKind()) {
206 #define ATTR(X)
207 #define PRAGMA_SPELLING_ATTR(X) case attr::X:
208 #include "clang/Basic/AttrList.inc"
209  break;
210  default:
211  A->printPretty(Out, Policy);
212  break;
213  }
214  }
215  }
216 }
217 
218 void DeclPrinter::prettyPrintPragmas(Decl *D) {
219  if (Policy.PolishForDeclaration)
220  return;
221 
222  if (D->hasAttrs()) {
223  AttrVec &Attrs = D->getAttrs();
224  for (auto *A : Attrs) {
225  switch (A->getKind()) {
226 #define ATTR(X)
227 #define PRAGMA_SPELLING_ATTR(X) case attr::X:
228 #include "clang/Basic/AttrList.inc"
229  A->printPretty(Out, Policy);
230  Indent();
231  break;
232  default:
233  break;
234  }
235  }
236  }
237 }
238 
239 void DeclPrinter::printDeclType(QualType T, StringRef DeclName, bool Pack) {
240  // Normally, a PackExpansionType is written as T[3]... (for instance, as a
241  // template argument), but if it is the type of a declaration, the ellipsis
242  // is placed before the name being declared.
243  if (auto *PET = T->getAs<PackExpansionType>()) {
244  Pack = true;
245  T = PET->getPattern();
246  }
247  T.print(Out, Policy, (Pack ? "..." : "") + DeclName);
248 }
249 
250 void DeclPrinter::ProcessDeclGroup(SmallVectorImpl<Decl*>& Decls) {
251  this->Indent();
252  Decl::printGroup(Decls.data(), Decls.size(), Out, Policy, Indentation);
253  Out << ";\n";
254  Decls.clear();
255 
256 }
257 
258 void DeclPrinter::Print(AccessSpecifier AS) {
259  switch(AS) {
260  case AS_none: llvm_unreachable("No access specifier!");
261  case AS_public: Out << "public"; break;
262  case AS_protected: Out << "protected"; break;
263  case AS_private: Out << "private"; break;
264  }
265 }
266 
267 //----------------------------------------------------------------------------
268 // Common C declarations
269 //----------------------------------------------------------------------------
270 
271 void DeclPrinter::VisitDeclContext(DeclContext *DC, bool Indent) {
272  if (Policy.TerseOutput)
273  return;
274 
275  if (Indent)
276  Indentation += Policy.Indentation;
277 
278  SmallVector<Decl*, 2> Decls;
279  for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end();
280  D != DEnd; ++D) {
281 
282  // Don't print ObjCIvarDecls, as they are printed when visiting the
283  // containing ObjCInterfaceDecl.
284  if (isa<ObjCIvarDecl>(*D))
285  continue;
286 
287  // Skip over implicit declarations in pretty-printing mode.
288  if (D->isImplicit())
289  continue;
290 
291  // The next bits of code handles stuff like "struct {int x;} a,b"; we're
292  // forced to merge the declarations because there's no other way to
293  // refer to the struct in question. This limited merging is safe without
294  // a bunch of other checks because it only merges declarations directly
295  // referring to the tag, not typedefs.
296  //
297  // Check whether the current declaration should be grouped with a previous
298  // unnamed struct.
299  QualType CurDeclType = getDeclType(*D);
300  if (!Decls.empty() && !CurDeclType.isNull()) {
301  QualType BaseType = GetBaseType(CurDeclType);
302  if (!BaseType.isNull() && isa<ElaboratedType>(BaseType))
303  BaseType = cast<ElaboratedType>(BaseType)->getNamedType();
304  if (!BaseType.isNull() && isa<TagType>(BaseType) &&
305  cast<TagType>(BaseType)->getDecl() == Decls[0]) {
306  Decls.push_back(*D);
307  continue;
308  }
309  }
310 
311  // If we have a merged group waiting to be handled, handle it now.
312  if (!Decls.empty())
313  ProcessDeclGroup(Decls);
314 
315  // If the current declaration is an unnamed tag type, save it
316  // so we can merge it with the subsequent declaration(s) using it.
317  if (isa<TagDecl>(*D) && !cast<TagDecl>(*D)->getIdentifier()) {
318  Decls.push_back(*D);
319  continue;
320  }
321 
322  if (isa<AccessSpecDecl>(*D)) {
323  Indentation -= Policy.Indentation;
324  this->Indent();
325  Print(D->getAccess());
326  Out << ":\n";
327  Indentation += Policy.Indentation;
328  continue;
329  }
330 
331  this->Indent();
332  Visit(*D);
333 
334  // FIXME: Need to be able to tell the DeclPrinter when
335  const char *Terminator = nullptr;
336  if (isa<OMPThreadPrivateDecl>(*D))
337  Terminator = nullptr;
338  else if (isa<FunctionDecl>(*D) &&
339  cast<FunctionDecl>(*D)->isThisDeclarationADefinition())
340  Terminator = nullptr;
341  else if (isa<ObjCMethodDecl>(*D) && cast<ObjCMethodDecl>(*D)->getBody())
342  Terminator = nullptr;
343  else if (isa<NamespaceDecl>(*D) || isa<LinkageSpecDecl>(*D) ||
344  isa<ObjCImplementationDecl>(*D) ||
345  isa<ObjCInterfaceDecl>(*D) ||
346  isa<ObjCProtocolDecl>(*D) ||
347  isa<ObjCCategoryImplDecl>(*D) ||
348  isa<ObjCCategoryDecl>(*D))
349  Terminator = nullptr;
350  else if (isa<EnumConstantDecl>(*D)) {
352  ++Next;
353  if (Next != DEnd)
354  Terminator = ",";
355  } else
356  Terminator = ";";
357 
358  if (Terminator)
359  Out << Terminator;
360  Out << "\n";
361  }
362 
363  if (!Decls.empty())
364  ProcessDeclGroup(Decls);
365 
366  if (Indent)
367  Indentation -= Policy.Indentation;
368 }
369 
370 void DeclPrinter::VisitTranslationUnitDecl(TranslationUnitDecl *D) {
371  VisitDeclContext(D, false);
372 }
373 
374 void DeclPrinter::VisitTypedefDecl(TypedefDecl *D) {
375  if (!Policy.SuppressSpecifiers) {
376  Out << "typedef ";
377 
378  if (D->isModulePrivate())
379  Out << "__module_private__ ";
380  }
381  D->getTypeSourceInfo()->getType().print(Out, Policy, D->getName());
382  prettyPrintAttributes(D);
383 }
384 
385 void DeclPrinter::VisitTypeAliasDecl(TypeAliasDecl *D) {
386  Out << "using " << *D;
387  prettyPrintAttributes(D);
388  Out << " = " << D->getTypeSourceInfo()->getType().getAsString(Policy);
389 }
390 
391 void DeclPrinter::VisitEnumDecl(EnumDecl *D) {
392  if (!Policy.SuppressSpecifiers && D->isModulePrivate())
393  Out << "__module_private__ ";
394  Out << "enum ";
395  if (D->isScoped()) {
396  if (D->isScopedUsingClassTag())
397  Out << "class ";
398  else
399  Out << "struct ";
400  }
401  Out << *D;
402 
403  if (D->isFixed())
404  Out << " : " << D->getIntegerType().stream(Policy);
405 
406  if (D->isCompleteDefinition()) {
407  Out << " {\n";
408  VisitDeclContext(D);
409  Indent() << "}";
410  }
411  prettyPrintAttributes(D);
412 }
413 
414 void DeclPrinter::VisitRecordDecl(RecordDecl *D) {
415  if (!Policy.SuppressSpecifiers && D->isModulePrivate())
416  Out << "__module_private__ ";
417  Out << D->getKindName();
418 
419  prettyPrintAttributes(D);
420 
421  if (D->getIdentifier())
422  Out << ' ' << *D;
423 
424  if (D->isCompleteDefinition()) {
425  Out << " {\n";
426  VisitDeclContext(D);
427  Indent() << "}";
428  }
429 }
430 
431 void DeclPrinter::VisitEnumConstantDecl(EnumConstantDecl *D) {
432  Out << *D;
433  if (Expr *Init = D->getInitExpr()) {
434  Out << " = ";
435  Init->printPretty(Out, nullptr, Policy, Indentation);
436  }
437 }
438 
439 void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
440  if (!D->getDescribedFunctionTemplate() &&
442  prettyPrintPragmas(D);
443 
444  CXXConstructorDecl *CDecl = dyn_cast<CXXConstructorDecl>(D);
445  CXXConversionDecl *ConversionDecl = dyn_cast<CXXConversionDecl>(D);
446  if (!Policy.SuppressSpecifiers) {
447  switch (D->getStorageClass()) {
448  case SC_None: break;
449  case SC_Extern: Out << "extern "; break;
450  case SC_Static: Out << "static "; break;
451  case SC_PrivateExtern: Out << "__private_extern__ "; break;
452  case SC_Auto: case SC_Register:
453  llvm_unreachable("invalid for functions");
454  }
455 
456  if (D->isInlineSpecified()) Out << "inline ";
457  if (D->isVirtualAsWritten()) Out << "virtual ";
458  if (D->isModulePrivate()) Out << "__module_private__ ";
459  if (D->isConstexpr() && !D->isExplicitlyDefaulted()) Out << "constexpr ";
460  if ((CDecl && CDecl->isExplicitSpecified()) ||
461  (ConversionDecl && ConversionDecl->isExplicit()))
462  Out << "explicit ";
463  }
464 
465  PrintingPolicy SubPolicy(Policy);
466  SubPolicy.SuppressSpecifiers = false;
467  std::string Proto = D->getNameInfo().getAsString();
468 
469  QualType Ty = D->getType();
470  while (const ParenType *PT = dyn_cast<ParenType>(Ty)) {
471  Proto = '(' + Proto + ')';
472  Ty = PT->getInnerType();
473  }
474 
475  if (const FunctionType *AFT = Ty->getAs<FunctionType>()) {
476  const FunctionProtoType *FT = nullptr;
477  if (D->hasWrittenPrototype())
478  FT = dyn_cast<FunctionProtoType>(AFT);
479 
480  Proto += "(";
481  if (FT) {
482  llvm::raw_string_ostream POut(Proto);
483  DeclPrinter ParamPrinter(POut, SubPolicy, Indentation);
484  for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) {
485  if (i) POut << ", ";
486  ParamPrinter.VisitParmVarDecl(D->getParamDecl(i));
487  }
488 
489  if (FT->isVariadic()) {
490  if (D->getNumParams()) POut << ", ";
491  POut << "...";
492  }
493  } else if (D->doesThisDeclarationHaveABody() && !D->hasPrototype()) {
494  for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) {
495  if (i)
496  Proto += ", ";
497  Proto += D->getParamDecl(i)->getNameAsString();
498  }
499  }
500 
501  Proto += ")";
502 
503  if (FT) {
504  if (FT->isConst())
505  Proto += " const";
506  if (FT->isVolatile())
507  Proto += " volatile";
508  if (FT->isRestrict())
509  Proto += " restrict";
510 
511  switch (FT->getRefQualifier()) {
512  case RQ_None:
513  break;
514  case RQ_LValue:
515  Proto += " &";
516  break;
517  case RQ_RValue:
518  Proto += " &&";
519  break;
520  }
521  }
522 
523  if (FT && FT->hasDynamicExceptionSpec()) {
524  Proto += " throw(";
525  if (FT->getExceptionSpecType() == EST_MSAny)
526  Proto += "...";
527  else
528  for (unsigned I = 0, N = FT->getNumExceptions(); I != N; ++I) {
529  if (I)
530  Proto += ", ";
531 
532  Proto += FT->getExceptionType(I).getAsString(SubPolicy);
533  }
534  Proto += ")";
535  } else if (FT && isNoexceptExceptionSpec(FT->getExceptionSpecType())) {
536  Proto += " noexcept";
538  Proto += "(";
539  llvm::raw_string_ostream EOut(Proto);
540  FT->getNoexceptExpr()->printPretty(EOut, nullptr, SubPolicy,
541  Indentation);
542  EOut.flush();
543  Proto += EOut.str();
544  Proto += ")";
545  }
546  }
547 
548  if (CDecl) {
549  bool HasInitializerList = false;
550  for (const auto *BMInitializer : CDecl->inits()) {
551  if (BMInitializer->isInClassMemberInitializer())
552  continue;
553 
554  if (!HasInitializerList) {
555  Proto += " : ";
556  Out << Proto;
557  Proto.clear();
558  HasInitializerList = true;
559  } else
560  Out << ", ";
561 
562  if (BMInitializer->isAnyMemberInitializer()) {
563  FieldDecl *FD = BMInitializer->getAnyMember();
564  Out << *FD;
565  } else {
566  Out << QualType(BMInitializer->getBaseClass(), 0).getAsString(Policy);
567  }
568 
569  Out << "(";
570  if (!BMInitializer->getInit()) {
571  // Nothing to print
572  } else {
573  Expr *Init = BMInitializer->getInit();
574  if (ExprWithCleanups *Tmp = dyn_cast<ExprWithCleanups>(Init))
575  Init = Tmp->getSubExpr();
576 
577  Init = Init->IgnoreParens();
578 
579  Expr *SimpleInit = nullptr;
580  Expr **Args = nullptr;
581  unsigned NumArgs = 0;
582  if (ParenListExpr *ParenList = dyn_cast<ParenListExpr>(Init)) {
583  Args = ParenList->getExprs();
584  NumArgs = ParenList->getNumExprs();
585  } else if (CXXConstructExpr *Construct
586  = dyn_cast<CXXConstructExpr>(Init)) {
587  Args = Construct->getArgs();
588  NumArgs = Construct->getNumArgs();
589  } else
590  SimpleInit = Init;
591 
592  if (SimpleInit)
593  SimpleInit->printPretty(Out, nullptr, Policy, Indentation);
594  else {
595  for (unsigned I = 0; I != NumArgs; ++I) {
596  assert(Args[I] != nullptr && "Expected non-null Expr");
597  if (isa<CXXDefaultArgExpr>(Args[I]))
598  break;
599 
600  if (I)
601  Out << ", ";
602  Args[I]->printPretty(Out, nullptr, Policy, Indentation);
603  }
604  }
605  }
606  Out << ")";
607  if (BMInitializer->isPackExpansion())
608  Out << "...";
609  }
610  } else if (!ConversionDecl && !isa<CXXDestructorDecl>(D)) {
611  if (FT && FT->hasTrailingReturn()) {
612  Out << "auto " << Proto << " -> ";
613  Proto.clear();
614  }
615  AFT->getReturnType().print(Out, Policy, Proto);
616  Proto.clear();
617  }
618  Out << Proto;
619  } else {
620  Ty.print(Out, Policy, Proto);
621  }
622 
623  prettyPrintAttributes(D);
624 
625  if (D->isPure())
626  Out << " = 0";
627  else if (D->isDeletedAsWritten())
628  Out << " = delete";
629  else if (D->isExplicitlyDefaulted())
630  Out << " = default";
631  else if (D->doesThisDeclarationHaveABody() && !Policy.TerseOutput) {
632  if (!D->hasPrototype() && D->getNumParams()) {
633  // This is a K&R function definition, so we need to print the
634  // parameters.
635  Out << '\n';
636  DeclPrinter ParamPrinter(Out, SubPolicy, Indentation);
637  Indentation += Policy.Indentation;
638  for (unsigned i = 0, e = D->getNumParams(); i != e; ++i) {
639  Indent();
640  ParamPrinter.VisitParmVarDecl(D->getParamDecl(i));
641  Out << ";\n";
642  }
643  Indentation -= Policy.Indentation;
644  } else
645  Out << ' ';
646 
647  if (D->getBody())
648  D->getBody()->printPretty(Out, nullptr, SubPolicy, Indentation);
649  Out << '\n';
650  }
651 }
652 
653 void DeclPrinter::VisitFriendDecl(FriendDecl *D) {
654  if (TypeSourceInfo *TSI = D->getFriendType()) {
655  unsigned NumTPLists = D->getFriendTypeNumTemplateParameterLists();
656  for (unsigned i = 0; i < NumTPLists; ++i)
657  PrintTemplateParameters(D->getFriendTypeTemplateParameterList(i));
658  Out << "friend ";
659  Out << " " << TSI->getType().getAsString(Policy);
660  }
661  else if (FunctionDecl *FD =
662  dyn_cast<FunctionDecl>(D->getFriendDecl())) {
663  Out << "friend ";
664  VisitFunctionDecl(FD);
665  }
666  else if (FunctionTemplateDecl *FTD =
667  dyn_cast<FunctionTemplateDecl>(D->getFriendDecl())) {
668  Out << "friend ";
669  VisitFunctionTemplateDecl(FTD);
670  }
671  else if (ClassTemplateDecl *CTD =
672  dyn_cast<ClassTemplateDecl>(D->getFriendDecl())) {
673  Out << "friend ";
674  VisitRedeclarableTemplateDecl(CTD);
675  }
676 }
677 
678 void DeclPrinter::VisitFieldDecl(FieldDecl *D) {
679  // FIXME: add printing of pragma attributes if required.
680  if (!Policy.SuppressSpecifiers && D->isMutable())
681  Out << "mutable ";
682  if (!Policy.SuppressSpecifiers && D->isModulePrivate())
683  Out << "__module_private__ ";
684 
686  stream(Policy, D->getName());
687 
688  if (D->isBitField()) {
689  Out << " : ";
690  D->getBitWidth()->printPretty(Out, nullptr, Policy, Indentation);
691  }
692 
693  Expr *Init = D->getInClassInitializer();
694  if (!Policy.SuppressInitializers && Init) {
696  Out << " ";
697  else
698  Out << " = ";
699  Init->printPretty(Out, nullptr, Policy, Indentation);
700  }
701  prettyPrintAttributes(D);
702 }
703 
704 void DeclPrinter::VisitLabelDecl(LabelDecl *D) {
705  Out << *D << ":";
706 }
707 
708 void DeclPrinter::VisitVarDecl(VarDecl *D) {
709  prettyPrintPragmas(D);
710  if (!Policy.SuppressSpecifiers) {
711  StorageClass SC = D->getStorageClass();
712  if (SC != SC_None)
713  Out << VarDecl::getStorageClassSpecifierString(SC) << " ";
714 
715  switch (D->getTSCSpec()) {
716  case TSCS_unspecified:
717  break;
718  case TSCS___thread:
719  Out << "__thread ";
720  break;
721  case TSCS__Thread_local:
722  Out << "_Thread_local ";
723  break;
724  case TSCS_thread_local:
725  Out << "thread_local ";
726  break;
727  }
728 
729  if (D->isModulePrivate())
730  Out << "__module_private__ ";
731  }
732 
733  QualType T = D->getTypeSourceInfo()
734  ? D->getTypeSourceInfo()->getType()
736  printDeclType(T, D->getName());
737  Expr *Init = D->getInit();
738  if (!Policy.SuppressInitializers && Init) {
739  bool ImplicitInit = false;
740  if (CXXConstructExpr *Construct =
741  dyn_cast<CXXConstructExpr>(Init->IgnoreImplicit())) {
742  if (D->getInitStyle() == VarDecl::CallInit &&
743  !Construct->isListInitialization()) {
744  ImplicitInit = Construct->getNumArgs() == 0 ||
745  Construct->getArg(0)->isDefaultArgument();
746  }
747  }
748  if (!ImplicitInit) {
749  if ((D->getInitStyle() == VarDecl::CallInit) && !isa<ParenListExpr>(Init))
750  Out << "(";
751  else if (D->getInitStyle() == VarDecl::CInit) {
752  Out << " = ";
753  }
754  Init->printPretty(Out, nullptr, Policy, Indentation);
755  if ((D->getInitStyle() == VarDecl::CallInit) && !isa<ParenListExpr>(Init))
756  Out << ")";
757  }
758  }
759  prettyPrintAttributes(D);
760 }
761 
762 void DeclPrinter::VisitParmVarDecl(ParmVarDecl *D) {
763  VisitVarDecl(D);
764 }
765 
766 void DeclPrinter::VisitFileScopeAsmDecl(FileScopeAsmDecl *D) {
767  Out << "__asm (";
768  D->getAsmString()->printPretty(Out, nullptr, Policy, Indentation);
769  Out << ")";
770 }
771 
772 void DeclPrinter::VisitImportDecl(ImportDecl *D) {
773  Out << "@import " << D->getImportedModule()->getFullModuleName()
774  << ";\n";
775 }
776 
777 void DeclPrinter::VisitStaticAssertDecl(StaticAssertDecl *D) {
778  Out << "static_assert(";
779  D->getAssertExpr()->printPretty(Out, nullptr, Policy, Indentation);
780  if (StringLiteral *SL = D->getMessage()) {
781  Out << ", ";
782  SL->printPretty(Out, nullptr, Policy, Indentation);
783  }
784  Out << ")";
785 }
786 
787 //----------------------------------------------------------------------------
788 // C++ declarations
789 //----------------------------------------------------------------------------
790 void DeclPrinter::VisitNamespaceDecl(NamespaceDecl *D) {
791  if (D->isInline())
792  Out << "inline ";
793  Out << "namespace " << *D << " {\n";
794  VisitDeclContext(D);
795  Indent() << "}";
796 }
797 
798 void DeclPrinter::VisitUsingDirectiveDecl(UsingDirectiveDecl *D) {
799  Out << "using namespace ";
800  if (D->getQualifier())
801  D->getQualifier()->print(Out, Policy);
802  Out << *D->getNominatedNamespaceAsWritten();
803 }
804 
805 void DeclPrinter::VisitNamespaceAliasDecl(NamespaceAliasDecl *D) {
806  Out << "namespace " << *D << " = ";
807  if (D->getQualifier())
808  D->getQualifier()->print(Out, Policy);
809  Out << *D->getAliasedNamespace();
810 }
811 
812 void DeclPrinter::VisitEmptyDecl(EmptyDecl *D) {
813  prettyPrintAttributes(D);
814 }
815 
816 void DeclPrinter::VisitCXXRecordDecl(CXXRecordDecl *D) {
817  // FIXME: add printing of pragma attributes if required.
818  if (!Policy.SuppressSpecifiers && D->isModulePrivate())
819  Out << "__module_private__ ";
820  Out << D->getKindName();
821 
822  prettyPrintAttributes(D);
823 
824  if (D->getIdentifier())
825  Out << ' ' << *D;
826 
827  if (D->isCompleteDefinition()) {
828  // Print the base classes
829  if (D->getNumBases()) {
830  Out << " : ";
832  BaseEnd = D->bases_end(); Base != BaseEnd; ++Base) {
833  if (Base != D->bases_begin())
834  Out << ", ";
835 
836  if (Base->isVirtual())
837  Out << "virtual ";
838 
839  AccessSpecifier AS = Base->getAccessSpecifierAsWritten();
840  if (AS != AS_none) {
841  Print(AS);
842  Out << " ";
843  }
844  Out << Base->getType().getAsString(Policy);
845 
846  if (Base->isPackExpansion())
847  Out << "...";
848  }
849  }
850 
851  // Print the class definition
852  // FIXME: Doesn't print access specifiers, e.g., "public:"
853  Out << " {\n";
854  VisitDeclContext(D);
855  Indent() << "}";
856  }
857 }
858 
859 void DeclPrinter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
860  const char *l;
862  l = "C";
863  else {
864  assert(D->getLanguage() == LinkageSpecDecl::lang_cxx &&
865  "unknown language in linkage specification");
866  l = "C++";
867  }
868 
869  Out << "extern \"" << l << "\" ";
870  if (D->hasBraces()) {
871  Out << "{\n";
872  VisitDeclContext(D);
873  Indent() << "}";
874  } else
875  Visit(*D->decls_begin());
876 }
877 
878 void DeclPrinter::PrintTemplateParameters(const TemplateParameterList *Params,
879  const TemplateArgumentList *Args) {
880  assert(Params);
881  assert(!Args || Params->size() == Args->size());
882 
883  Out << "template <";
884 
885  for (unsigned i = 0, e = Params->size(); i != e; ++i) {
886  if (i != 0)
887  Out << ", ";
888 
889  const Decl *Param = Params->getParam(i);
890  if (const TemplateTypeParmDecl *TTP =
891  dyn_cast<TemplateTypeParmDecl>(Param)) {
892 
893  if (TTP->wasDeclaredWithTypename())
894  Out << "typename ";
895  else
896  Out << "class ";
897 
898  if (TTP->isParameterPack())
899  Out << "...";
900 
901  Out << *TTP;
902 
903  if (Args) {
904  Out << " = ";
905  Args->get(i).print(Policy, Out);
906  } else if (TTP->hasDefaultArgument()) {
907  Out << " = ";
908  Out << TTP->getDefaultArgument().getAsString(Policy);
909  };
910  } else if (const NonTypeTemplateParmDecl *NTTP =
911  dyn_cast<NonTypeTemplateParmDecl>(Param)) {
912  StringRef Name;
913  if (IdentifierInfo *II = NTTP->getIdentifier())
914  Name = II->getName();
915  printDeclType(NTTP->getType(), Name, NTTP->isParameterPack());
916 
917  if (Args) {
918  Out << " = ";
919  Args->get(i).print(Policy, Out);
920  } else if (NTTP->hasDefaultArgument()) {
921  Out << " = ";
922  NTTP->getDefaultArgument()->printPretty(Out, nullptr, Policy,
923  Indentation);
924  }
925  } else if (const TemplateTemplateParmDecl *TTPD =
926  dyn_cast<TemplateTemplateParmDecl>(Param)) {
927  VisitTemplateDecl(TTPD);
928  // FIXME: print the default argument, if present.
929  }
930  }
931 
932  Out << "> ";
933 }
934 
935 void DeclPrinter::VisitTemplateDecl(const TemplateDecl *D) {
936  PrintTemplateParameters(D->getTemplateParameters());
937 
938  if (const TemplateTemplateParmDecl *TTP =
939  dyn_cast<TemplateTemplateParmDecl>(D)) {
940  Out << "class ";
941  if (TTP->isParameterPack())
942  Out << "...";
943  Out << D->getName();
944  } else {
945  Visit(D->getTemplatedDecl());
946  }
947 }
948 
949 void DeclPrinter::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
950  if (PrintInstantiation) {
952  for (auto *I : D->specializations()) {
953  prettyPrintPragmas(I);
954  PrintTemplateParameters(Params, I->getTemplateSpecializationArgs());
955  Visit(I);
956  }
957  }
958 
959  prettyPrintPragmas(D->getTemplatedDecl());
960  return VisitRedeclarableTemplateDecl(D);
961 }
962 
963 void DeclPrinter::VisitClassTemplateDecl(ClassTemplateDecl *D) {
964  if (PrintInstantiation) {
966  for (auto *I : D->specializations()) {
967  PrintTemplateParameters(Params, &I->getTemplateArgs());
968  Visit(I);
969  Out << '\n';
970  }
971  }
972 
973  return VisitRedeclarableTemplateDecl(D);
974 }
975 
976 //----------------------------------------------------------------------------
977 // Objective-C declarations
978 //----------------------------------------------------------------------------
979 
980 void DeclPrinter::PrintObjCMethodType(ASTContext &Ctx,
982  QualType T) {
983  Out << '(';
984  if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_In)
985  Out << "in ";
986  if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Inout)
987  Out << "inout ";
988  if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Out)
989  Out << "out ";
990  if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Bycopy)
991  Out << "bycopy ";
992  if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Byref)
993  Out << "byref ";
994  if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_Oneway)
995  Out << "oneway ";
996  if (Quals & Decl::ObjCDeclQualifier::OBJC_TQ_CSNullability) {
997  if (auto nullability = AttributedType::stripOuterNullability(T))
998  Out << getNullabilitySpelling(*nullability, true) << ' ';
999  }
1000 
1001  Out << Ctx.getUnqualifiedObjCPointerType(T).getAsString(Policy);
1002  Out << ')';
1003 }
1004 
1005 void DeclPrinter::PrintObjCTypeParams(ObjCTypeParamList *Params) {
1006  Out << "<";
1007  unsigned First = true;
1008  for (auto *Param : *Params) {
1009  if (First) {
1010  First = false;
1011  } else {
1012  Out << ", ";
1013  }
1014 
1015  switch (Param->getVariance()) {
1017  break;
1018 
1020  Out << "__covariant ";
1021  break;
1022 
1024  Out << "__contravariant ";
1025  break;
1026  }
1027 
1028  Out << Param->getDeclName().getAsString();
1029 
1030  if (Param->hasExplicitBound()) {
1031  Out << " : " << Param->getUnderlyingType().getAsString(Policy);
1032  }
1033  }
1034  Out << ">";
1035 }
1036 
1037 void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) {
1038  if (OMD->isInstanceMethod())
1039  Out << "- ";
1040  else
1041  Out << "+ ";
1042  if (!OMD->getReturnType().isNull()) {
1043  PrintObjCMethodType(OMD->getASTContext(), OMD->getObjCDeclQualifier(),
1044  OMD->getReturnType());
1045  }
1046 
1047  std::string name = OMD->getSelector().getAsString();
1048  std::string::size_type pos, lastPos = 0;
1049  for (const auto *PI : OMD->params()) {
1050  // FIXME: selector is missing here!
1051  pos = name.find_first_of(':', lastPos);
1052  Out << " " << name.substr(lastPos, pos - lastPos) << ':';
1053  PrintObjCMethodType(OMD->getASTContext(),
1054  PI->getObjCDeclQualifier(),
1055  PI->getType());
1056  Out << *PI;
1057  lastPos = pos + 1;
1058  }
1059 
1060  if (OMD->param_begin() == OMD->param_end())
1061  Out << " " << name;
1062 
1063  if (OMD->isVariadic())
1064  Out << ", ...";
1065 
1066  prettyPrintAttributes(OMD);
1067 
1068  if (OMD->getBody() && !Policy.TerseOutput) {
1069  Out << ' ';
1070  OMD->getBody()->printPretty(Out, nullptr, Policy);
1071  }
1072  else if (Policy.PolishForDeclaration)
1073  Out << ';';
1074 }
1075 
1076 void DeclPrinter::VisitObjCImplementationDecl(ObjCImplementationDecl *OID) {
1077  std::string I = OID->getNameAsString();
1078  ObjCInterfaceDecl *SID = OID->getSuperClass();
1079 
1080  bool eolnOut = false;
1081  if (SID)
1082  Out << "@implementation " << I << " : " << *SID;
1083  else
1084  Out << "@implementation " << I;
1085 
1086  if (OID->ivar_size() > 0) {
1087  Out << "{\n";
1088  eolnOut = true;
1089  Indentation += Policy.Indentation;
1090  for (const auto *I : OID->ivars()) {
1091  Indent() << I->getASTContext().getUnqualifiedObjCPointerType(I->getType()).
1092  getAsString(Policy) << ' ' << *I << ";\n";
1093  }
1094  Indentation -= Policy.Indentation;
1095  Out << "}\n";
1096  }
1097  else if (SID || (OID->decls_begin() != OID->decls_end())) {
1098  Out << "\n";
1099  eolnOut = true;
1100  }
1101  VisitDeclContext(OID, false);
1102  if (!eolnOut)
1103  Out << "\n";
1104  Out << "@end";
1105 }
1106 
1107 void DeclPrinter::VisitObjCInterfaceDecl(ObjCInterfaceDecl *OID) {
1108  std::string I = OID->getNameAsString();
1109  ObjCInterfaceDecl *SID = OID->getSuperClass();
1110 
1111  if (!OID->isThisDeclarationADefinition()) {
1112  Out << "@class " << I;
1113 
1114  if (auto TypeParams = OID->getTypeParamListAsWritten()) {
1115  PrintObjCTypeParams(TypeParams);
1116  }
1117 
1118  Out << ";";
1119  return;
1120  }
1121  bool eolnOut = false;
1122  Out << "@interface " << I;
1123 
1124  if (auto TypeParams = OID->getTypeParamListAsWritten()) {
1125  PrintObjCTypeParams(TypeParams);
1126  }
1127 
1128  if (SID)
1129  Out << " : " << QualType(OID->getSuperClassType(), 0).getAsString(Policy);
1130 
1131  // Protocols?
1132  const ObjCList<ObjCProtocolDecl> &Protocols = OID->getReferencedProtocols();
1133  if (!Protocols.empty()) {
1134  for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(),
1135  E = Protocols.end(); I != E; ++I)
1136  Out << (I == Protocols.begin() ? '<' : ',') << **I;
1137  Out << "> ";
1138  }
1139 
1140  if (OID->ivar_size() > 0) {
1141  Out << "{\n";
1142  eolnOut = true;
1143  Indentation += Policy.Indentation;
1144  for (const auto *I : OID->ivars()) {
1145  Indent() << I->getASTContext()
1146  .getUnqualifiedObjCPointerType(I->getType())
1147  .getAsString(Policy) << ' ' << *I << ";\n";
1148  }
1149  Indentation -= Policy.Indentation;
1150  Out << "}\n";
1151  }
1152  else if (SID || (OID->decls_begin() != OID->decls_end())) {
1153  Out << "\n";
1154  eolnOut = true;
1155  }
1156 
1157  VisitDeclContext(OID, false);
1158  if (!eolnOut)
1159  Out << "\n";
1160  Out << "@end";
1161  // FIXME: implement the rest...
1162 }
1163 
1164 void DeclPrinter::VisitObjCProtocolDecl(ObjCProtocolDecl *PID) {
1165  if (!PID->isThisDeclarationADefinition()) {
1166  Out << "@protocol " << *PID << ";\n";
1167  return;
1168  }
1169  // Protocols?
1170  const ObjCList<ObjCProtocolDecl> &Protocols = PID->getReferencedProtocols();
1171  if (!Protocols.empty()) {
1172  Out << "@protocol " << *PID;
1173  for (ObjCList<ObjCProtocolDecl>::iterator I = Protocols.begin(),
1174  E = Protocols.end(); I != E; ++I)
1175  Out << (I == Protocols.begin() ? '<' : ',') << **I;
1176  Out << ">\n";
1177  } else
1178  Out << "@protocol " << *PID << '\n';
1179  VisitDeclContext(PID, false);
1180  Out << "@end";
1181 }
1182 
1183 void DeclPrinter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *PID) {
1184  Out << "@implementation " << *PID->getClassInterface() << '(' << *PID <<")\n";
1185 
1186  VisitDeclContext(PID, false);
1187  Out << "@end";
1188  // FIXME: implement the rest...
1189 }
1190 
1191 void DeclPrinter::VisitObjCCategoryDecl(ObjCCategoryDecl *PID) {
1192  Out << "@interface " << *PID->getClassInterface();
1193  if (auto TypeParams = PID->getTypeParamList()) {
1194  PrintObjCTypeParams(TypeParams);
1195  }
1196  Out << "(" << *PID << ")\n";
1197  if (PID->ivar_size() > 0) {
1198  Out << "{\n";
1199  Indentation += Policy.Indentation;
1200  for (const auto *I : PID->ivars())
1201  Indent() << I->getASTContext().getUnqualifiedObjCPointerType(I->getType()).
1202  getAsString(Policy) << ' ' << *I << ";\n";
1203  Indentation -= Policy.Indentation;
1204  Out << "}\n";
1205  }
1206 
1207  VisitDeclContext(PID, false);
1208  Out << "@end";
1209 
1210  // FIXME: implement the rest...
1211 }
1212 
1213 void DeclPrinter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *AID) {
1214  Out << "@compatibility_alias " << *AID
1215  << ' ' << *AID->getClassInterface() << ";\n";
1216 }
1217 
1218 /// PrintObjCPropertyDecl - print a property declaration.
1219 ///
1220 void DeclPrinter::VisitObjCPropertyDecl(ObjCPropertyDecl *PDecl) {
1222  Out << "@required\n";
1224  Out << "@optional\n";
1225 
1226  QualType T = PDecl->getType();
1227 
1228  Out << "@property";
1230  bool first = true;
1231  Out << " (";
1232  if (PDecl->getPropertyAttributes() &
1234  Out << (first ? ' ' : ',') << "readonly";
1235  first = false;
1236  }
1237 
1239  Out << (first ? ' ' : ',') << "getter = ";
1240  PDecl->getGetterName().print(Out);
1241  first = false;
1242  }
1244  Out << (first ? ' ' : ',') << "setter = ";
1245  PDecl->getSetterName().print(Out);
1246  first = false;
1247  }
1248 
1250  Out << (first ? ' ' : ',') << "assign";
1251  first = false;
1252  }
1253 
1254  if (PDecl->getPropertyAttributes() &
1256  Out << (first ? ' ' : ',') << "readwrite";
1257  first = false;
1258  }
1259 
1261  Out << (first ? ' ' : ',') << "retain";
1262  first = false;
1263  }
1264 
1266  Out << (first ? ' ' : ',') << "strong";
1267  first = false;
1268  }
1269 
1271  Out << (first ? ' ' : ',') << "copy";
1272  first = false;
1273  }
1274 
1275  if (PDecl->getPropertyAttributes() &
1277  Out << (first ? ' ' : ',') << "nonatomic";
1278  first = false;
1279  }
1280  if (PDecl->getPropertyAttributes() &
1282  Out << (first ? ' ' : ',') << "atomic";
1283  first = false;
1284  }
1285 
1286  if (PDecl->getPropertyAttributes() &
1288  if (auto nullability = AttributedType::stripOuterNullability(T)) {
1289  if (*nullability == NullabilityKind::Unspecified &&
1290  (PDecl->getPropertyAttributes() &
1292  Out << (first ? ' ' : ',') << "null_resettable";
1293  } else {
1294  Out << (first ? ' ' : ',')
1295  << getNullabilitySpelling(*nullability, true);
1296  }
1297  first = false;
1298  }
1299  }
1300 
1301  (void) first; // Silence dead store warning due to idiomatic code.
1302  Out << " )";
1303  }
1304  Out << ' ' << PDecl->getASTContext().getUnqualifiedObjCPointerType(T).
1305  getAsString(Policy) << ' ' << *PDecl;
1306  if (Policy.PolishForDeclaration)
1307  Out << ';';
1308 }
1309 
1310 void DeclPrinter::VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *PID) {
1312  Out << "@synthesize ";
1313  else
1314  Out << "@dynamic ";
1315  Out << *PID->getPropertyDecl();
1316  if (PID->getPropertyIvarDecl())
1317  Out << '=' << *PID->getPropertyIvarDecl();
1318 }
1319 
1320 void DeclPrinter::VisitUsingDecl(UsingDecl *D) {
1321  if (!D->isAccessDeclaration())
1322  Out << "using ";
1323  if (D->hasTypename())
1324  Out << "typename ";
1325  D->getQualifier()->print(Out, Policy);
1326  Out << *D;
1327 }
1328 
1329 void
1330 DeclPrinter::VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D) {
1331  Out << "using typename ";
1332  D->getQualifier()->print(Out, Policy);
1333  Out << D->getDeclName();
1334 }
1335 
1336 void DeclPrinter::VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D) {
1337  if (!D->isAccessDeclaration())
1338  Out << "using ";
1339  D->getQualifier()->print(Out, Policy);
1340  Out << D->getDeclName();
1341 }
1342 
1343 void DeclPrinter::VisitUsingShadowDecl(UsingShadowDecl *D) {
1344  // ignore
1345 }
1346 
1347 void DeclPrinter::VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D) {
1348  Out << "#pragma omp threadprivate";
1349  if (!D->varlist_empty()) {
1351  E = D->varlist_end();
1352  I != E; ++I) {
1353  Out << (I == D->varlist_begin() ? '(' : ',');
1354  NamedDecl *ND = cast<NamedDecl>(cast<DeclRefExpr>(*I)->getDecl());
1355  ND->printQualifiedName(Out);
1356  }
1357  Out << ")";
1358  }
1359 }
1360 
param_const_iterator param_begin() const
Definition: DeclObjC.h:359
Defines the clang::ASTContext interface.
QualType getExceptionType(unsigned i) const
Definition: Type.h:3221
TemplateParameterList * getFriendTypeTemplateParameterList(unsigned N) const
Definition: DeclFriend.h:113
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
Definition: Decl.h:1483
bool isVariadic() const
Definition: Type.h:3255
void VisitVarDecl(VarDecl *VD)
StringRef getName() const
getName - Get the name of identifier for this declaration as a StringRef.
Definition: Decl.h:169
PointerType - C99 6.7.5.1 - Pointer Declarators.
Definition: Type.h:2147
void VisitImportDecl(ImportDecl *D)
A (possibly-)qualified type.
Definition: Type.h:575
void VisitUsingDecl(UsingDecl *D)
ObjCInterfaceDecl * getClassInterface()
Definition: DeclObjC.h:1974
bool isBitField() const
Determines whether this field is a bitfield.
Definition: Decl.h:2277
spec_range specializations() const
Definition: DeclTemplate.h:946
IdentifierInfo * getIdentifier() const
getIdentifier - Get the identifier that names this declaration, if there is one.
Definition: Decl.h:164
void VisitFieldDecl(FieldDecl *FD)
PropertyControl getPropertyImplementation() const
Definition: DeclObjC.h:2575
void VisitOMPThreadPrivateDecl(OMPThreadPrivateDecl *D)
FunctionType - C99 6.7.5.3 - Function Declarators.
Definition: Type.h:2847
bool isThisDeclarationADefinition() const
Determine whether this particular declaration of this class is actually also a definition.
Definition: DeclObjC.h:1197
EnumConstantDecl - An instance of this object exists for each enum constant that is defined...
Definition: Decl.h:2397
TypedefDecl - Represents the declaration of a typedef-name via the 'typedef' type specifier...
Definition: Decl.h:2598
void VisitEnumConstantDecl(EnumConstantDecl *ECD)
Defines the clang::Module class, which describes a module in the source code.
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:77
std::string getAsString() const
Definition: Type.h:901
void VisitObjCCategoryDecl(ObjCCategoryDecl *D)
Represents an empty-declaration.
Definition: Decl.h:3718
The parameter is covariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant and ...
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Definition: Type.h:2424
const Expr * getInit() const
Definition: Decl.h:1070
NamespaceDecl - Represent a C++ namespace.
Definition: Decl.h:402
Represents a call to a C++ constructor.
Definition: ExprCXX.h:1149
NamedDecl * getParam(unsigned Idx)
Definition: DeclTemplate.h:100
AccessSpecifier
A C++ access specifier (public, private, protected), plus the special value "none" which means differ...
Definition: Specifiers.h:90
A container of type source information.
Definition: Decl.h:61
static void printGroup(Decl **Begin, unsigned NumDecls, raw_ostream &Out, const PrintingPolicy &Policy, unsigned Indentation=0)
const TemplateArgument & get(unsigned Idx) const
Retrieve the template argument at a given index.
Definition: DeclTemplate.h:217
Represents a C++ constructor within a class.
Definition: DeclCXX.h:2134
Expr * getInClassInitializer() const
getInClassInitializer - Get the C++11 in-class initializer for this member, or null if one has not be...
Definition: Decl.h:2332
InClassInitStyle getInClassInitStyle() const
getInClassInitStyle - Get the kind of (C++11) in-class initializer which this field has...
Definition: Decl.h:2316
void VisitStaticAssertDecl(StaticAssertDecl *D)
FriendDecl - Represents the declaration of a friend entity, which can be a function, a type, or a templated function or type.
Definition: DeclFriend.h:40
VarDecl - An instance of this class is created to represent a variable declaration or definition...
Definition: Decl.h:699
AccessSpecifier getAccess() const
Definition: DeclBase.h:428
ObjCMethodDecl - Represents an instance or class method declaration.
Definition: DeclObjC.h:113
void VisitClassTemplateDecl(ClassTemplateDecl *D)
Stores a list of template parameters for a TemplateDecl and its derived classes.
Definition: DeclTemplate.h:48
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:35
decl_iterator decls_end() const
Definition: DeclBase.h:1441
void VisitTypeAliasDecl(TypeAliasDecl *TD)
Represents an expression – generally a full-expression – that introduces cleanups to be run at the en...
Definition: ExprCXX.h:2847
ParmVarDecl - Represents a parameter to a function.
Definition: Decl.h:1299
Defines the clang::Expr interface and subclasses for C++ expressions.
QualType getType() const
Definition: DeclObjC.h:2497
bool isNoexceptExceptionSpec(ExceptionSpecificationType ESpecType)
TypeSourceInfo * getFriendType() const
If this friend declaration names an (untemplated but possibly dependent) type, return the type; other...
Definition: DeclFriend.h:107
Kind getPropertyImplementation() const
Definition: DeclObjC.h:2667
unsigned ivar_size() const
Definition: DeclObjC.h:1143
RecordDecl - Represents a struct/union/class.
Definition: Decl.h:3166
std::string getFullModuleName() const
Retrieve the full name of this module, including the path from its top-level module.
ObjCTypeParamList * getTypeParamListAsWritten() const
Retrieve the type parameters written on this particular declaration of the class. ...
Definition: DeclObjC.h:986
bool isFunctionTemplateSpecialization() const
Determine whether this function is a function template specialization.
Definition: Decl.h:2073
C11 _Thread_local.
Definition: Specifiers.h:194
One of these records is kept for each identifier that is lexed.
bool isScopedUsingClassTag() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3110
unsigned getFriendTypeNumTemplateParameterLists() const
Definition: DeclFriend.h:110
StringLiteral * getMessage()
Definition: DeclCXX.h:3169
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:4381
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:91
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
Definition: DeclCXX.h:2907
The parameter is contravariant, e.g., X<T> is a subtype of X<U> when the type parameter is covariant ...
bool isExplicitSpecified() const
Determine whether this constructor declaration has the explicit keyword specified.
Definition: DeclCXX.h:2171
std::string getNameAsString() const
Get the name of the class associated with this interface.
Definition: DeclObjC.h:2338
FieldDecl - An instance of this class is created by Sema::ActOnField to represent a member of a struc...
Definition: Decl.h:2209
FunctionDecl * getTemplatedDecl() const
Get the underlying function declaration of the template.
Definition: DeclTemplate.h:891
bool isCompleteDefinition() const
isCompleteDefinition - Return true if this decl has its body fully specified.
Definition: Decl.h:2788
bool isPure() const
Whether this virtual function is pure, i.e.
Definition: Decl.h:1748
bool isTranslationUnit() const
Definition: DeclBase.h:1269
unsigned size() const
Retrieve the number of template arguments in this template argument list.
Definition: DeclTemplate.h:232
bool varlist_empty() const
Definition: DeclOpenMP.h:72
void VisitFileScopeAsmDecl(FileScopeAsmDecl *AD)
param_range params()
Definition: DeclObjC.h:354
unsigned size() const
Definition: DeclTemplate.h:91
void VisitLabelDecl(LabelDecl *LD)
bool hasBraces() const
Determines whether this linkage specification had braces in its syntactic form.
Definition: DeclCXX.h:2501
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:875
bool isExplicitlyDefaulted() const
Whether this function is explicitly defaulted per C++0x.
Definition: Decl.h:1769
Represents a C++ using-declaration.
Definition: DeclCXX.h:2858
void VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D)
An lvalue ref-qualifier was provided (&).
Definition: Type.h:1208
static QualType getDeclType(Decl *D)
bool isImplicit() const
isImplicit - Indicates whether the declaration was implicitly generated by the implementation.
Definition: DeclBase.h:514
bool isInline() const
Returns true if this is an inline namespace declaration.
Definition: Decl.h:457
ObjCTypeParamList * getTypeParamList() const
Retrieve the type parameter list associated with this category or extension.
Definition: DeclObjC.h:1979
Microsoft throw(...) extension.
Whether values of this type can be null is (explicitly) unspecified.
NamedDecl * getNominatedNamespaceAsWritten()
Definition: DeclCXX.h:2593
void VisitCXXRecordDecl(CXXRecordDecl *D)
Expr * getNoexceptExpr() const
Definition: Type.h:3225
void VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D)
Selector getSetterName() const
Definition: DeclObjC.h:2562
DeclID VisitTemplateDecl(TemplateDecl *D)
std::string getNameAsString() const
getNameAsString - Get a human-readable name for the declaration, even if it is one of the special kin...
Definition: Decl.h:184
base_class_iterator bases_begin()
Definition: DeclCXX.h:720
bool empty() const
Definition: DeclObjC.h:46
Represents an Objective-C protocol declaration.
Definition: DeclObjC.h:1728
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
FunctionTemplateDecl * getDescribedFunctionTemplate() const
Retrieves the function template that is described by this function declaration.
Definition: Decl.cpp:3063
Represents an ObjC class declaration.
Definition: DeclObjC.h:853
Represents a linkage specification.
Definition: DeclCXX.h:2454
decl_iterator decls_begin() const
Definition: DeclBase.cpp:1167
detail::InMemoryDirectory::const_iterator I
PropertyAttributeKind getPropertyAttributes() const
Definition: DeclObjC.h:2508
QualType getType() const
Definition: Decl.h:530
bool hasPrototype() const
Whether this function has a prototype, either because one was explicitly written or because it was "i...
Definition: Decl.h:1782
ObjCPropertyImplDecl - Represents implementation declaration of a property in a class or category imp...
Definition: DeclObjC.h:2605
bool isThisDeclarationADefinition() const
Determine whether this particular declaration is also the definition.
Definition: DeclObjC.h:1869
TypeAliasDecl - Represents the declaration of a typedef-name via a C++0x alias-declaration.
Definition: Decl.h:2618
Represents a prototype with parameter type info, e.g.
Definition: Type.h:3041
ExceptionSpecificationType getExceptionSpecType() const
Get the kind of exception specification on this function.
Definition: Type.h:3193
void VisitParmVarDecl(ParmVarDecl *PD)
ObjCDeclQualifier getObjCDeclQualifier() const
Definition: DeclObjC.h:269
void VisitLinkageSpecDecl(LinkageSpecDecl *D)
const SmallVectorImpl< AnnotatedLine * >::const_iterator End
ivar_range ivars() const
Definition: DeclObjC.h:1127
MutableArrayRef< Expr * >::iterator varlist_iterator
Definition: DeclOpenMP.h:66
StorageClass getStorageClass() const
Returns the storage class as written in the source.
Definition: Decl.h:1979
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee...
Definition: Type.cpp:415
void VisitUsingShadowDecl(UsingShadowDecl *D)
void VisitFriendDecl(FriendDecl *D)
ValueDecl - Represent the declaration of a variable (in which case it is an lvalue) a function (in wh...
Definition: Decl.h:521
Expr - This represents one expression.
Definition: Expr.h:104
StringRef getName() const
Return the actual identifier string.
bool isDeletedAsWritten() const
Definition: Decl.h:1821
Declaration of a template type parameter.
ObjCIvarDecl * getPropertyIvarDecl() const
Definition: DeclObjC.h:2671
Expr * getBitWidth() const
Definition: Decl.h:2291
void VisitTypedefDecl(TypedefDecl *TD)
QualType getUnqualifiedObjCPointerType(QualType type) const
getUnqualifiedObjCPointerType - Returns version of Objective-C pointer type with lifetime qualifier r...
Definition: ASTContext.h:1708
const ParmVarDecl * getParamDecl(unsigned i) const
Definition: Decl.h:1927
NonTypeTemplateParmDecl - Declares a non-type template parameter, e.g., "Size" in.
static QualType GetBaseType(QualType T)
static Optional< NullabilityKind > stripOuterNullability(QualType &T)
Strip off the top-level nullability annotation on the given type, if it's there.
Definition: Type.cpp:3624
bool isScoped() const
Returns true if this is a C++11 scoped enumeration.
Definition: Decl.h:3105
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine()) const
Definition: Type.h:911
StorageClass
Storage classes.
Definition: Specifiers.h:198
bool isInstanceMethod() const
Definition: DeclObjC.h:419
bool hasTrailingReturn() const
Definition: Type.h:3265
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Definition: DeclBase.h:1200
Represents a GCC generic vector type.
Definition: Type.h:2724
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:190
TemplateTemplateParmDecl - Declares a template template parameter, e.g., "T" in.
class LLVM_ALIGNAS(8) TemplateSpecializationType unsigned NumArgs
Represents a type template specialization; the template must be a class template, a type alias templa...
Definition: Type.h:3988
unsigned getNumBases() const
Retrieves the number of base classes of this class.
Definition: DeclCXX.h:707
unsigned ivar_size() const
Definition: DeclObjC.h:2367
Represents a C++ conversion function within a class.
Definition: DeclCXX.h:2392
ivar_range ivars() const
Definition: DeclObjC.h:2360
void VisitNamespaceAliasDecl(NamespaceAliasDecl *D)
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:602
const clang::PrintingPolicy & getPrintingPolicy() const
Definition: ASTContext.h:545
bool isConstexpr() const
Whether this is a (C++11) constexpr function or constexpr constructor.
Definition: Decl.h:1794
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of the namespace.
Definition: DeclCXX.h:2589
bool isVirtualAsWritten() const
Whether this function is marked as virtual explicitly.
Definition: Decl.h:1743
void VisitObjCProtocolDecl(ObjCProtocolDecl *D)
AttrVec & getAttrs()
Definition: DeclBase.h:443
param_const_iterator param_end() const
Definition: DeclObjC.h:362
Stmt * getBody(const FunctionDecl *&Definition) const
getBody - Retrieve the body (definition) of the function.
Definition: Decl.cpp:2497
bool doesThisDeclarationHaveABody() const
doesThisDeclarationHaveABody - Returns whether this specific declaration of the function has a body -...
Definition: Decl.h:1732
SmallVectorImpl< AnnotatedLine * >::const_iterator Next
Sugar for parentheses used when specifying types.
Definition: Type.h:2116
unsigned getNumParams() const
getNumParams - Return the number of parameters this function must have based on its FunctionType...
Definition: Decl.cpp:2743
bool SuppressTag
Whether type printing should skip printing the actual tag type.
Definition: PrettyPrinter.h:87
RefQualifierKind getRefQualifier() const
Retrieve the ref-qualifier associated with this function type.
Definition: Type.h:3271
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2401
void VisitEmptyDecl(EmptyDecl *D)
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3121
bool SuppressSpecifiers
Whether we should suppress printing of the actual specifiers for the given type or declaration...
Definition: PrettyPrinter.h:67
TagDecl - Represents the declaration of a struct/union/class/enum.
Definition: Decl.h:2644
ASTContext & getASTContext() const LLVM_READONLY
Definition: DeclBase.cpp:311
LabelDecl - Represents the declaration of a label.
Definition: Decl.h:355
bool isVariadic() const
Definition: DeclObjC.h:421
Represents a dependent using declaration which was not marked with typename.
Definition: DeclCXX.h:3004
std::string getAsString() const
getAsString - Retrieve the human-readable string for this name.
Stmt * getBody() const override
Retrieve the body of this method, if it has one.
Definition: DeclObjC.cpp:756
bool isRestrict() const
Definition: Type.h:2989
void print(const PrintingPolicy &Policy, raw_ostream &Out) const
Print this template argument to the given output stream.
varlist_iterator varlist_begin()
Definition: DeclOpenMP.h:80
GNU __thread.
Definition: Specifiers.h:188
No ref-qualifier was provided.
Definition: Type.h:1206
C-style initialization with assignment.
Definition: Decl.h:709
ObjCCategoryDecl - Represents a category declaration.
Definition: DeclObjC.h:1931
Module * getImportedModule() const
Retrieve the module that was imported by the import declaration.
Definition: Decl.h:3702
const ObjCInterfaceDecl * getClassInterface() const
Definition: DeclObjC.h:2085
Direct list-initialization.
Definition: Specifiers.h:224
ThreadStorageClassSpecifier getTSCSpec() const
Definition: Decl.h:884
std::string getAsString() const
Derive the full selector name (e.g.
Represents one property declaration in an Objective-C interface.
Definition: DeclObjC.h:2416
A simple visitor class that helps create declaration visitors.
Definition: DeclVisitor.h:67
void VisitObjCInterfaceDecl(ObjCInterfaceDecl *D)
QualType getReturnType() const
Definition: DeclObjC.h:330
void VisitObjCPropertyImplDecl(ObjCPropertyImplDecl *D)
void VisitRecordDecl(RecordDecl *RD)
Indicates that the nullability of the type was spelled with a property attribute rather than a type q...
Definition: DeclObjC.h:2435
Represents a C++11 static_assert declaration.
Definition: DeclCXX.h:3146
bool isInlineSpecified() const
Determine whether the "inline" keyword was specified for this function.
Definition: Decl.h:1983
An rvalue ref-qualifier was provided (&&).
Definition: Type.h:1210
QualType getType() const
Return the type wrapped by this type source info.
Definition: Decl.h:69
void printQualifiedName(raw_ostream &OS) const
printQualifiedName - Returns human-readable qualified name for declaration, like A::B::i, for i being member of namespace A::B.
Definition: Decl.cpp:1402
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:3043
Describes a module import declaration, which makes the contents of the named module visible in the cu...
Definition: Decl.h:3658
Represents a pack expansion of types.
Definition: Type.h:4471
C++11 thread_local.
Definition: Specifiers.h:191
static const char * getStorageClassSpecifierString(StorageClass SC)
getStorageClassSpecifierString - Return the string used to specify the storage class SC...
Definition: Decl.cpp:1770
decl_iterator - Iterates through the declarations stored within this context.
Definition: DeclBase.h:1398
void VisitEnumDecl(EnumDecl *ED)
Base class for declarations which introduce a typedef-name.
Definition: Decl.h:2526
const ObjCProtocolList & getReferencedProtocols() const
Definition: DeclObjC.h:1778
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Print this nested name specifier to the given output stream.
bool hasTypename() const
Return true if the using declaration has 'typename'.
Definition: DeclCXX.h:2910
bool isAccessDeclaration() const
Return true if it is a C++03 access declaration (no 'using').
Definition: DeclCXX.h:3036
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
Definition: DeclBase.h:1121
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:331
void VisitFunctionDecl(FunctionDecl *FD)
bool isDefaultArgument() const
Determine whether this expression is a default function argument.
Definition: Expr.cpp:2619
LanguageIDs getLanguage() const
Return the language specified by this linkage specification.
Definition: DeclCXX.h:2495
bool hasWrittenPrototype() const
Definition: Decl.h:1786
Represents a dependent using declaration which was marked with typename.
Definition: DeclCXX.h:3087
void VisitObjCMethodDecl(ObjCMethodDecl *D)
Selector getGetterName() const
Definition: DeclObjC.h:2559
void VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *D)
void VisitObjCImplementationDecl(ObjCImplementationDecl *D)
Selector getSelector() const
Definition: DeclObjC.h:328
EnumDecl - Represents an enum.
Definition: Decl.h:2930
bool hasAttrs() const
Definition: DeclBase.h:439
void VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *D)
detail::InMemoryDirectory::const_iterator E
iterator begin() const
Definition: DeclObjC.h:65
spec_range specializations() const
Pointer to a block type.
Definition: Type.h:2254
ObjCImplementationDecl - Represents a class definition - this is where method definitions are specifi...
Definition: DeclObjC.h:2220
void VisitObjCPropertyDecl(ObjCPropertyDecl *D)
void print(raw_ostream &Out, unsigned Indentation=0, bool PrintInstantiation=false) const
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:5675
NamedDecl * getFriendDecl() const
If this friend declaration doesn't name a type, return the inner declaration.
Definition: DeclFriend.h:120
bool isSpecifierType() const
Returns true if this type can be represented by some set of type specifiers.
Definition: Type.cpp:2346
QualType getIntegerType() const
getIntegerType - Return the integer type this enum decl corresponds to.
Definition: Decl.h:3054
Base for LValueReferenceType and RValueReferenceType.
Definition: Type.h:2287
void VisitNamespaceDecl(NamespaceDecl *D)
InitializationStyle getInitStyle() const
The style of initialization for this declaration.
Definition: Decl.h:1129
const ObjCProtocolList & getReferencedProtocols() const
Definition: DeclObjC.h:1016
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name of the namespace.
Definition: DeclCXX.h:2715
Represents a base class of a C++ class.
Definition: DeclCXX.h:157
void VisitUsingDirectiveDecl(UsingDirectiveDecl *D)
NestedNameSpecifier * getQualifier() const
Retrieve the nested-name-specifier that qualifies the name.
Definition: DeclCXX.h:2898
A template argument list.
Definition: DeclTemplate.h:172
ObjCPropertyDecl * getPropertyDecl() const
Definition: DeclObjC.h:2662
varlist_iterator varlist_end()
Definition: DeclOpenMP.h:81
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Call-style initialization (C++98)
Definition: Decl.h:710
NamedDecl * getTemplatedDecl() const
Get the underlying, templated declaration.
Definition: DeclTemplate.h:360
Represents a C++ struct/union/class.
Definition: DeclCXX.h:285
ObjCDeclQualifier
ObjCDeclQualifier - 'Qualifiers' written next to the return and parameter types in method declaration...
Definition: DeclBase.h:186
bool hasDynamicExceptionSpec() const
Return whether this function has a dynamic (throw) exception spec.
Definition: Type.h:3201
base_class_iterator bases_end()
Definition: DeclCXX.h:722
Declaration of a class template.
void dumpDeclContext() const
Stores a list of Objective-C type parameters for a parameterized class or a category/extension thereo...
Definition: DeclObjC.h:615
TemplateParameterList * getTemplateParameters() const
Get the list of template parameters.
Definition: DeclTemplate.h:355
StringLiteral - This represents a string literal expression, e.g.
Definition: Expr.h:1452
ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.cpp:289
TranslationUnitDecl - The top declaration context.
Definition: Decl.h:79
std::pair< uint64_t, uint64_t > VisitDeclContext(DeclContext *DC)
void VisitFunctionTemplateDecl(FunctionTemplateDecl *D)
StringRef getKindName() const
Definition: Decl.h:2843
bool isVolatile() const
Definition: Type.h:2988
NamedDecl - This represents a decl with a name.
Definition: Decl.h:145
DeclarationNameInfo getNameInfo() const
Definition: Decl.h:1668
Represents a C++ namespace alias.
Definition: DeclCXX.h:2649
Represents C++ using-directive.
Definition: DeclCXX.h:2546
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:642
TypeSourceInfo * getTypeSourceInfo() const
Definition: Decl.h:2561
llvm::StringRef getNullabilitySpelling(NullabilityKind kind, bool isContextSensitive=false)
Retrieve the spelling of the given nullability kind.
void VisitTranslationUnitDecl(TranslationUnitDecl *TU)
This represents '#pragma omp threadprivate ...' directive.
Definition: DeclOpenMP.h:36
ObjCCategoryImplDecl - An object of this class encapsulates a category @implementation declaration...
Definition: DeclObjC.h:2139
bool isModulePrivate() const
Whether this declaration was marked as being private to the module in which it was defined...
Definition: DeclBase.h:563
The parameter is invariant: must match exactly.
const ObjCObjectType * getSuperClassType() const
Retrieve the superclass type.
Definition: DeclObjC.h:1232
iterator end() const
Definition: DeclObjC.h:66
Declaration of a template function.
Definition: DeclTemplate.h:830
Represents a shadow declaration introduced into a scope by a (resolved) using declaration.
Definition: DeclCXX.h:2766
ObjCCompatibleAliasDecl - Represents alias of a class.
Definition: DeclObjC.h:2385
Expr * IgnoreParens() LLVM_READONLY
IgnoreParens - Ignore parentheses.
Definition: Expr.cpp:2433
StreamedQualTypeHelper stream(const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine()) const
Definition: Type.h:951
bool isMutable() const
isMutable - Determines whether this field is mutable (C++ only).
Definition: Decl.h:2274
bool isConst() const
Definition: Type.h:2987
unsigned getNumExceptions() const
Definition: Type.h:3220
const ObjCInterfaceDecl * getSuperClass() const
Definition: DeclObjC.h:2346
unsigned Indent
The current line's indent.
const StringLiteral * getAsmString() const
Definition: Decl.h:3357