clang  6.0.0svn
DeclarationName.cpp
Go to the documentation of this file.
1 //===- DeclarationName.cpp - Declaration names implementation -------------===//
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 DeclarationName and DeclarationNameTable
11 // classes.
12 //
13 //===----------------------------------------------------------------------===//
14 
16 #include "clang/AST/ASTContext.h"
17 #include "clang/AST/Decl.h"
18 #include "clang/AST/DeclBase.h"
19 #include "clang/AST/DeclCXX.h"
20 #include "clang/AST/DeclTemplate.h"
22 #include "clang/AST/Type.h"
23 #include "clang/AST/TypeLoc.h"
24 #include "clang/AST/TypeOrdering.h"
26 #include "clang/Basic/LLVM.h"
30 #include "llvm/ADT/FoldingSet.h"
31 #include "llvm/Support/Casting.h"
32 #include "llvm/Support/Compiler.h"
33 #include "llvm/Support/ErrorHandling.h"
34 #include "llvm/Support/raw_ostream.h"
35 #include <algorithm>
36 #include <cassert>
37 #include <cstdint>
38 #include <string>
39 
40 using namespace clang;
41 
42 namespace clang {
43 
44 /// CXXSpecialName - Records the type associated with one of the
45 /// "special" kinds of declaration names in C++, e.g., constructors,
46 /// destructors, and conversion functions.
48  : public DeclarationNameExtra, public llvm::FoldingSetNode {
49 public:
50  /// Type - The type associated with this declaration name.
52 
53  /// FETokenInfo - Extra information associated with this declaration
54  /// name that can be used by the front end.
55  void *FETokenInfo;
56 
57  void Profile(llvm::FoldingSetNodeID &ID) {
58  ID.AddInteger(ExtraKindOrNumArgs);
59  ID.AddPointer(Type.getAsOpaquePtr());
60  }
61 };
62 
63 /// Contains extra information for the name of a C++ deduction guide.
65  public llvm::FoldingSetNode {
66 public:
67  /// The template named by the deduction guide.
69 
70  /// FETokenInfo - Extra information associated with this operator
71  /// name that can be used by the front end.
72  void *FETokenInfo;
73 
74  void Profile(llvm::FoldingSetNodeID &ID) {
75  ID.AddPointer(Template);
76  }
77 };
78 
79 /// CXXOperatorIdName - Contains extra information for the name of an
80 /// overloaded operator in C++, such as "operator+.
82 public:
83  /// FETokenInfo - Extra information associated with this operator
84  /// name that can be used by the front end.
85  void *FETokenInfo;
86 };
87 
88 /// CXXLiteralOperatorName - Contains the actual identifier that makes up the
89 /// name.
90 ///
91 /// This identifier is stored here rather than directly in DeclarationName so as
92 /// to allow Objective-C selectors, which are about a million times more common,
93 /// to consume minimal memory.
95  : public DeclarationNameExtra, public llvm::FoldingSetNode {
96 public:
98 
99  /// FETokenInfo - Extra information associated with this operator
100  /// name that can be used by the front end.
101  void *FETokenInfo;
102 
103  void Profile(llvm::FoldingSetNodeID &FSID) {
104  FSID.AddPointer(ID);
105  }
106 };
107 
108 } // namespace clang
109 
110 static int compareInt(unsigned A, unsigned B) {
111  return (A < B ? -1 : (A > B ? 1 : 0));
112 }
113 
115  if (LHS.getNameKind() != RHS.getNameKind())
116  return (LHS.getNameKind() < RHS.getNameKind() ? -1 : 1);
117 
118  switch (LHS.getNameKind()) {
120  IdentifierInfo *LII = LHS.getAsIdentifierInfo();
121  IdentifierInfo *RII = RHS.getAsIdentifierInfo();
122  if (!LII) return RII ? -1 : 0;
123  if (!RII) return 1;
124 
125  return LII->getName().compare(RII->getName());
126  }
127 
131  Selector LHSSelector = LHS.getObjCSelector();
132  Selector RHSSelector = RHS.getObjCSelector();
133  // getNumArgs for ZeroArgSelector returns 0, but we still need to compare.
136  return LHSSelector.getAsIdentifierInfo()->getName().compare(
137  RHSSelector.getAsIdentifierInfo()->getName());
138  }
139  unsigned LN = LHSSelector.getNumArgs(), RN = RHSSelector.getNumArgs();
140  for (unsigned I = 0, N = std::min(LN, RN); I != N; ++I) {
141  switch (LHSSelector.getNameForSlot(I).compare(
142  RHSSelector.getNameForSlot(I))) {
143  case -1: return -1;
144  case 1: return 1;
145  default: break;
146  }
147  }
148 
149  return compareInt(LN, RN);
150  }
151 
155  if (QualTypeOrdering()(LHS.getCXXNameType(), RHS.getCXXNameType()))
156  return -1;
157  if (QualTypeOrdering()(RHS.getCXXNameType(), LHS.getCXXNameType()))
158  return 1;
159  return 0;
160 
162  // We never want to compare deduction guide names for templates from
163  // different scopes, so just compare the template-name.
166 
170 
172  return LHS.getCXXLiteralIdentifier()->getName().compare(
174 
176  return 0;
177  }
178 
179  llvm_unreachable("Invalid DeclarationName Kind!");
180 }
181 
183  raw_ostream &OS,
184  PrintingPolicy Policy) {
185  // We know we're printing C++ here. Ensure we print types properly.
186  Policy.adjustForCPlusPlus();
187 
188  if (const RecordType *ClassRec = ClassType->getAs<RecordType>()) {
189  OS << *ClassRec->getDecl();
190  return;
191  }
193  if (auto *InjTy = ClassType->getAs<InjectedClassNameType>()) {
194  OS << *InjTy->getDecl();
195  return;
196  }
197  }
198  ClassType.print(OS, Policy);
199 }
200 
201 void DeclarationName::print(raw_ostream &OS, const PrintingPolicy &Policy) {
202  DeclarationName &N = *this;
203  switch (N.getNameKind()) {
205  if (const IdentifierInfo *II = N.getAsIdentifierInfo())
206  OS << II->getName();
207  return;
208 
212  N.getObjCSelector().print(OS);
213  return;
214 
216  return printCXXConstructorDestructorName(N.getCXXNameType(), OS, Policy);
217 
219  OS << '~';
220  return printCXXConstructorDestructorName(N.getCXXNameType(), OS, Policy);
221 
223  OS << "<deduction guide for ";
224  getCXXDeductionGuideTemplate()->getDeclName().print(OS, Policy);
225  OS << '>';
226  return;
227 
228  case DeclarationName::CXXOperatorName: {
229  static const char* const OperatorNames[NUM_OVERLOADED_OPERATORS] = {
230  nullptr,
231 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
232  Spelling,
233 #include "clang/Basic/OperatorKinds.def"
234  };
235  const char *OpName = OperatorNames[N.getCXXOverloadedOperator()];
236  assert(OpName && "not an overloaded operator");
237 
238  OS << "operator";
239  if (OpName[0] >= 'a' && OpName[0] <= 'z')
240  OS << ' ';
241  OS << OpName;
242  return;
243  }
244 
245  case DeclarationName::CXXLiteralOperatorName:
246  OS << "operator\"\"" << N.getCXXLiteralIdentifier()->getName();
247  return;
248 
249  case DeclarationName::CXXConversionFunctionName: {
250  OS << "operator ";
251  QualType Type = N.getCXXNameType();
252  if (const RecordType *Rec = Type->getAs<RecordType>()) {
253  OS << *Rec->getDecl();
254  return;
255  }
256  // We know we're printing C++ here, ensure we print 'bool' properly.
257  PrintingPolicy CXXPolicy = Policy;
258  CXXPolicy.adjustForCPlusPlus();
259  Type.print(OS, CXXPolicy);
260  return;
261  }
263  OS << "<using-directive>";
264  return;
265  }
266 
267  llvm_unreachable("Unexpected declaration name kind");
268 }
269 
270 namespace clang {
271 
272 raw_ostream &operator<<(raw_ostream &OS, DeclarationName N) {
273  LangOptions LO;
274  N.print(OS, PrintingPolicy(LO));
275  return OS;
276 }
277 
278 } // namespace clang
279 
281  switch (getStoredNameKind()) {
282  case StoredIdentifier: return Identifier;
283  case StoredObjCZeroArgSelector: return ObjCZeroArgSelector;
284  case StoredObjCOneArgSelector: return ObjCOneArgSelector;
285 
286  case StoredDeclarationNameExtra:
287  switch (getExtra()->ExtraKindOrNumArgs) {
289  return CXXConstructorName;
290 
292  return CXXDestructorName;
293 
295  return CXXDeductionGuideName;
296 
298  return CXXConversionFunctionName;
299 
301  return CXXLiteralOperatorName;
302 
304  return CXXUsingDirective;
305 
306  default:
307  // Check if we have one of the CXXOperator* enumeration values.
308  if (getExtra()->ExtraKindOrNumArgs <
310  return CXXOperatorName;
311 
312  return ObjCMultiArgSelector;
313  }
314  }
315 
316  // Can't actually get here.
317  llvm_unreachable("This should be unreachable!");
318 }
319 
321  QualType T = getCXXNameType();
322  if (!T.isNull() && T->isDependentType())
323  return true;
324 
325  // A class-scope deduction guide in a dependent context has a dependent name.
326  auto *TD = getCXXDeductionGuideTemplate();
327  if (TD && TD->getDeclContext()->isDependentContext())
328  return true;
329 
330  return false;
331 }
332 
333 std::string DeclarationName::getAsString() const {
334  std::string Result;
335  llvm::raw_string_ostream OS(Result);
336  OS << *this;
337  return OS.str();
338 }
339 
341  if (CXXSpecialName *CXXName = getAsCXXSpecialName())
342  return CXXName->Type;
343  else
344  return QualType();
345 }
346 
348  if (auto *Guide = getAsCXXDeductionGuideNameExtra())
349  return Guide->Template;
350  return nullptr;
351 }
352 
354  if (CXXOperatorIdName *CXXOp = getAsCXXOperatorIdName()) {
355  unsigned value
356  = CXXOp->ExtraKindOrNumArgs - DeclarationNameExtra::CXXConversionFunction;
357  return static_cast<OverloadedOperatorKind>(value);
358  } else {
359  return OO_None;
360  }
361 }
362 
364  if (CXXLiteralOperatorIdName *CXXLit = getAsCXXLiteralOperatorIdName())
365  return CXXLit->ID;
366  else
367  return nullptr;
368 }
369 
370 void *DeclarationName::getFETokenInfoAsVoidSlow() const {
371  switch (getNameKind()) {
372  case Identifier:
373  llvm_unreachable("Handled by getFETokenInfo()");
374 
375  case CXXConstructorName:
376  case CXXDestructorName:
377  case CXXConversionFunctionName:
378  return getAsCXXSpecialName()->FETokenInfo;
379 
380  case CXXDeductionGuideName:
381  return getAsCXXDeductionGuideNameExtra()->FETokenInfo;
382 
383  case CXXOperatorName:
384  return getAsCXXOperatorIdName()->FETokenInfo;
385 
386  case CXXLiteralOperatorName:
387  return getAsCXXLiteralOperatorIdName()->FETokenInfo;
388 
389  default:
390  llvm_unreachable("Declaration name has no FETokenInfo");
391  }
392 }
393 
395  switch (getNameKind()) {
396  case Identifier:
397  getAsIdentifierInfo()->setFETokenInfo(T);
398  break;
399 
400  case CXXConstructorName:
401  case CXXDestructorName:
402  case CXXConversionFunctionName:
403  getAsCXXSpecialName()->FETokenInfo = T;
404  break;
405 
406  case CXXDeductionGuideName:
407  getAsCXXDeductionGuideNameExtra()->FETokenInfo = T;
408  break;
409 
410  case CXXOperatorName:
411  getAsCXXOperatorIdName()->FETokenInfo = T;
412  break;
413 
414  case CXXLiteralOperatorName:
415  getAsCXXLiteralOperatorIdName()->FETokenInfo = T;
416  break;
417 
418  default:
419  llvm_unreachable("Declaration name has no FETokenInfo");
420  }
421 }
422 
424  // Single instance of DeclarationNameExtra for using-directive
425  static const DeclarationNameExtra UDirExtra =
427 
428  uintptr_t Ptr = reinterpret_cast<uintptr_t>(&UDirExtra);
429  Ptr |= StoredDeclarationNameExtra;
430 
431  return DeclarationName(Ptr);
432 }
433 
434 LLVM_DUMP_METHOD void DeclarationName::dump() const {
435  llvm::errs() << *this << '\n';
436 }
437 
439  CXXSpecialNamesImpl = new llvm::FoldingSet<CXXSpecialName>;
440  CXXLiteralOperatorNames = new llvm::FoldingSet<CXXLiteralOperatorIdName>;
441  CXXDeductionGuideNames = new llvm::FoldingSet<CXXDeductionGuideNameExtra>;
442 
443  // Initialize the overloaded operator names.
444  CXXOperatorNames = new (Ctx) CXXOperatorIdName[NUM_OVERLOADED_OPERATORS];
445  for (unsigned Op = 0; Op < NUM_OVERLOADED_OPERATORS; ++Op) {
446  CXXOperatorNames[Op].ExtraKindOrNumArgs
448  CXXOperatorNames[Op].FETokenInfo = nullptr;
449  }
450 }
451 
453  auto *SpecialNames =
454  static_cast<llvm::FoldingSet<CXXSpecialName> *>(CXXSpecialNamesImpl);
455  auto *LiteralNames =
456  static_cast<llvm::FoldingSet<CXXLiteralOperatorIdName> *>(
457  CXXLiteralOperatorNames);
458  auto *DeductionGuideNames =
459  static_cast<llvm::FoldingSet<CXXDeductionGuideNameExtra> *>(
460  CXXDeductionGuideNames);
461 
462  delete SpecialNames;
463  delete LiteralNames;
464  delete DeductionGuideNames;
465 }
466 
469  Ty.getUnqualifiedType());
470 }
471 
474  Ty.getUnqualifiedType());
475 }
476 
479  Template = cast<TemplateDecl>(Template->getCanonicalDecl());
480 
481  auto *DeductionGuideNames =
482  static_cast<llvm::FoldingSet<CXXDeductionGuideNameExtra> *>(
483  CXXDeductionGuideNames);
484 
485  llvm::FoldingSetNodeID ID;
486  ID.AddPointer(Template);
487 
488  void *InsertPos = nullptr;
489  if (auto *Name = DeductionGuideNames->FindNodeOrInsertPos(ID, InsertPos))
490  return DeclarationName(Name);
491 
492  auto *Name = new (Ctx) CXXDeductionGuideNameExtra;
493  Name->ExtraKindOrNumArgs = DeclarationNameExtra::CXXDeductionGuide;
494  Name->Template = Template;
495  Name->FETokenInfo = nullptr;
496 
497  DeductionGuideNames->InsertNode(Name, InsertPos);
498  return DeclarationName(Name);
499 }
500 
504 }
505 
508  CanQualType Ty) {
509  assert(Kind >= DeclarationName::CXXConstructorName &&
511  "Kind must be a C++ special name kind");
512  llvm::FoldingSet<CXXSpecialName> *SpecialNames
513  = static_cast<llvm::FoldingSet<CXXSpecialName>*>(CXXSpecialNamesImpl);
514 
516  switch (Kind) {
519  assert(!Ty.hasQualifiers() &&"Constructor type must be unqualified");
520  break;
523  assert(!Ty.hasQualifiers() && "Destructor type must be unqualified");
524  break;
527  break;
528  default:
529  return DeclarationName();
530  }
531 
532  // Unique selector, to guarantee there is one per name.
533  llvm::FoldingSetNodeID ID;
534  ID.AddInteger(EKind);
535  ID.AddPointer(Ty.getAsOpaquePtr());
536 
537  void *InsertPos = nullptr;
538  if (CXXSpecialName *Name = SpecialNames->FindNodeOrInsertPos(ID, InsertPos))
539  return DeclarationName(Name);
540 
541  CXXSpecialName *SpecialName = new (Ctx) CXXSpecialName;
542  SpecialName->ExtraKindOrNumArgs = EKind;
543  SpecialName->Type = Ty;
544  SpecialName->FETokenInfo = nullptr;
545 
546  SpecialNames->InsertNode(SpecialName, InsertPos);
547  return DeclarationName(SpecialName);
548 }
549 
552  return DeclarationName(&CXXOperatorNames[(unsigned)Op]);
553 }
554 
557  llvm::FoldingSet<CXXLiteralOperatorIdName> *LiteralNames
558  = static_cast<llvm::FoldingSet<CXXLiteralOperatorIdName>*>
559  (CXXLiteralOperatorNames);
560 
561  llvm::FoldingSetNodeID ID;
562  ID.AddPointer(II);
563 
564  void *InsertPos = nullptr;
565  if (CXXLiteralOperatorIdName *Name =
566  LiteralNames->FindNodeOrInsertPos(ID, InsertPos))
567  return DeclarationName (Name);
568 
569  CXXLiteralOperatorIdName *LiteralName = new (Ctx) CXXLiteralOperatorIdName;
571  LiteralName->ID = II;
572  LiteralName->FETokenInfo = nullptr;
573 
574  LiteralNames->InsertNode(LiteralName, InsertPos);
575  return DeclarationName(LiteralName);
576 }
577 
579  switch (Name.getNameKind()) {
582  break;
586  NamedType.TInfo = nullptr;
587  break;
589  CXXOperatorName.BeginOpNameLoc = SourceLocation().getRawEncoding();
590  CXXOperatorName.EndOpNameLoc = SourceLocation().getRawEncoding();
591  break;
593  CXXLiteralOperatorName.OpNameLoc = SourceLocation().getRawEncoding();
594  break;
598  // FIXME: ?
599  break;
601  break;
602  }
603 }
604 
606  switch (Name.getNameKind()) {
615  return false;
616 
620  if (TypeSourceInfo *TInfo = LocInfo.NamedType.TInfo)
621  return TInfo->getType()->containsUnexpandedParameterPack();
622 
623  return Name.getCXXNameType()->containsUnexpandedParameterPack();
624  }
625  llvm_unreachable("All name kinds handled.");
626 }
627 
629  switch (Name.getNameKind()) {
638  return false;
639 
643  if (TypeSourceInfo *TInfo = LocInfo.NamedType.TInfo)
644  return TInfo->getType()->isInstantiationDependentType();
645 
646  return Name.getCXXNameType()->isInstantiationDependentType();
647  }
648  llvm_unreachable("All name kinds handled.");
649 }
650 
651 std::string DeclarationNameInfo::getAsString() const {
652  std::string Result;
653  llvm::raw_string_ostream OS(Result);
654  printName(OS);
655  return OS.str();
656 }
657 
658 void DeclarationNameInfo::printName(raw_ostream &OS) const {
659  switch (Name.getNameKind()) {
668  OS << Name;
669  return;
670 
674  if (TypeSourceInfo *TInfo = LocInfo.NamedType.TInfo) {
675  if (Name.getNameKind() == DeclarationName::CXXDestructorName)
676  OS << '~';
677  else if (Name.getNameKind() == DeclarationName::CXXConversionFunctionName)
678  OS << "operator ";
679  LangOptions LO;
680  LO.CPlusPlus = true;
681  LO.Bool = true;
682  PrintingPolicy PP(LO);
683  PP.SuppressScope = true;
684  OS << TInfo->getType().getAsString(PP);
685  } else
686  OS << Name;
687  return;
688  }
689  llvm_unreachable("Unexpected declaration name kind");
690 }
691 
693  switch (Name.getNameKind()) {
696  return NameLoc;
697 
699  unsigned raw = LocInfo.CXXOperatorName.EndOpNameLoc;
701  }
702 
704  unsigned raw = LocInfo.CXXLiteralOperatorName.OpNameLoc;
706  }
707 
711  if (TypeSourceInfo *TInfo = LocInfo.NamedType.TInfo)
712  return TInfo->getTypeLoc().getEndLoc();
713  else
714  return NameLoc;
715 
716  // DNInfo work in progress: FIXME.
721  return NameLoc;
722  }
723  llvm_unreachable("Unexpected declaration name kind");
724 }
Defines the clang::ASTContext interface.
Smart pointer class that efficiently represents Objective-C method names.
CXXSpecialName - Records the type associated with one of the "special" kinds of declaration names in ...
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
A (possibly-)qualified type.
Definition: Type.h:653
NameKind
NameKind - The kind of name this object contains.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
Definition: Type.h:991
QualType Type
Type - The type associated with this declaration name.
DeclarationName getCXXConstructorName(CanQualType Ty)
getCXXConstructorName - Returns the name of a C++ constructor for the given Type. ...
C Language Family Type Representation.
DeclarationName getCXXConversionFunctionName(CanQualType Ty)
getCXXConversionFunctionName - Returns the name of a C++ conversion function for the given Type...
Selector getObjCSelector() const
getObjCSelector - Get the Objective-C selector stored in this declaration name.
Defines the C++ template declaration subclasses.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
Definition: Attr.h:195
The base class of the type hierarchy.
Definition: Type.h:1353
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
A container of type source information.
Definition: Decl.h:86
bool isInstantiationDependent() const
Determine whether this name involves a template parameter.
DeclarationName getCXXDeductionGuideName(TemplateDecl *TD)
Returns the name of a C++ deduction guide for the given template.
QualType getCXXNameType() const
getCXXNameType - If this name is one of the C++ names (of a constructor, destructor, or conversion function), return the type associated with that name.
const T * getAs() const
Member-template getAs<specific type>&#39;.
Definition: Type.h:6307
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
CXXOperatorIdName - Contains extra information for the name of an overloaded operator in C++...
void Profile(llvm::FoldingSetNodeID &ID)
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:291
One of these records is kept for each identifier that is lexed.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:149
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
DeclarationName getCXXDestructorName(CanQualType Ty)
getCXXDestructorName - Returns the name of a C++ destructor for the given Type.
static int compareInt(unsigned A, unsigned B)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
bool isDependentName() const
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself ...
DeclarationNameExtra - Common base of the MultiKeywordSelector, CXXSpecialName, and CXXOperatorIdName...
Type(TypeClass tc, QualType canon, bool Dependent, bool InstantiationDependent, bool VariablyModified, bool ContainsUnexpandedParameterPack)
Definition: Type.h:1574
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
SourceLocation getEndLoc() const
getEndLoc - Retrieve the location of the last token.
bool SuppressScope
Suppresses printing of scope specifiers.
void * getAsOpaquePtr() const
Definition: Type.h:699
bool containsUnexpandedParameterPack() const
Determine whether this name contains an unexpanded parameter pack.
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:865
unsigned SuppressTemplateArgsInCXXConstructors
When true, suppresses printing template arguments in names of C++ constructors.
Function object that provides a total ordering on QualType values.
Definition: TypeOrdering.h:29
unsigned ExtraKindOrNumArgs
ExtraKindOrNumArgs - Either the kind of C++ special name or operator-id (if the value is one of the C...
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
Allows QualTypes to be sorted and hence used in maps and sets.
Defines the clang::LangOptions interface.
Contains extra information for the name of a C++ deduction guide.
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
void Profile(llvm::FoldingSetNodeID &FSID)
const FunctionProtoType * T
bool hasQualifiers() const
Determines whether this type has any qualifiers.
static void printCXXConstructorDestructorName(QualType ClassType, raw_ostream &OS, PrintingPolicy Policy)
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
Defines an enumeration for C++ overloaded operators.
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
char __ovld __cnfn min(char x, char y)
Returns y if y < x, otherwise it returns x.
Defines the clang::TypeLoc interface and its subclasses.
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn&#39;t a simple identifier.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
unsigned getNumArgs() const
The result type of a method or function.
bool isNull() const
Return true if this QualType doesn&#39;t point to a type yet.
Definition: Type.h:719
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Definition: opencl-c.h:82
void * FETokenInfo
FETokenInfo - Extra information associated with this operator name that can be used by the front end...
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
ExtraKind
ExtraKind - The kind of "extra" information stored in the DeclarationName.
void * FETokenInfo
FETokenInfo - Extra information associated with this operator name that can be used by the front end...
Kind
Encodes a location in the source.
DeclarationNameTable(const ASTContext &C)
void * FETokenInfo
FETokenInfo - Extra information associated with this operator name that can be used by the front end...
DeclarationName getCXXSpecialName(DeclarationName::NameKind Kind, CanQualType Ty)
getCXXSpecialName - Returns a declaration name for special kind of C++ name, e.g., for a constructor, destructor, or conversion function.
TemplateDecl * Template
The template named by the deduction guide.
void printName(raw_ostream &OS) const
printName - Print the human-readable name to a stream.
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:4635
StringRef getName() const
Return the actual identifier string.
void Profile(llvm::FoldingSetNodeID &ID)
Dataflow Directional Tag Classes.
std::string getAsString() const
getAsString - Retrieve the human-readable string for this name.
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:399
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
DeclarationName - The name of a declaration.
void adjustForCPlusPlus()
Adjust this printing policy for cases where it&#39;s known that we&#39;re printing C++ code (for instance...
Definition: PrettyPrinter.h:61
Not an overloaded operator.
Definition: OperatorKinds.h:23
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:3978
void * getAsOpaquePtr() const
Retrieve the internal representation of this canonical type.
CXXLiteralOperatorName - Contains the actual identifier that makes up the name.
DeclarationName getCXXLiteralOperatorName(IdentifierInfo *II)
getCXXLiteralOperatorName - Get the name of the literal operator function with II as the identifier...
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
Defines the clang::SourceLocation class and associated facilities.
static int compare(DeclarationName LHS, DeclarationName RHS)
void print(raw_ostream &OS, const PrintingPolicy &Policy)
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:1860
void * FETokenInfo
FETokenInfo - Extra information associated with this declaration name that can be used by the front e...
static DeclarationName getUsingDirectiveName()
getUsingDirectiveName - Return name for all using-directives.
DeclarationName getCXXOperatorName(OverloadedOperatorKind Op)
getCXXOperatorName - Get the name of the overloadable C++ operator corresponding to Op...