clang  5.0.0
DeclarationName.cpp
Go to the documentation of this file.
1 //===-- DeclarationName.cpp - Declaration names implementation --*- C++ -*-===//
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 //===----------------------------------------------------------------------===//
15 #include "clang/AST/ASTContext.h"
16 #include "clang/AST/DeclCXX.h"
17 #include "clang/AST/DeclTemplate.h"
18 #include "clang/AST/Type.h"
19 #include "clang/AST/TypeLoc.h"
20 #include "clang/AST/TypeOrdering.h"
22 #include "llvm/ADT/FoldingSet.h"
23 #include "llvm/Support/ErrorHandling.h"
24 #include "llvm/Support/raw_ostream.h"
25 using namespace clang;
26 
27 namespace clang {
28 /// CXXSpecialName - Records the type associated with one of the
29 /// "special" kinds of declaration names in C++, e.g., constructors,
30 /// destructors, and conversion functions.
32  : public DeclarationNameExtra, public llvm::FoldingSetNode {
33 public:
34  /// Type - The type associated with this declaration name.
36 
37  /// FETokenInfo - Extra information associated with this declaration
38  /// name that can be used by the front end.
39  void *FETokenInfo;
40 
41  void Profile(llvm::FoldingSetNodeID &ID) {
42  ID.AddInteger(ExtraKindOrNumArgs);
43  ID.AddPointer(Type.getAsOpaquePtr());
44  }
45 };
46 
47 /// Contains extra information for the name of a C++ deduction guide.
49  public llvm::FoldingSetNode {
50 public:
51  /// The template named by the deduction guide.
53 
54  /// FETokenInfo - Extra information associated with this operator
55  /// name that can be used by the front end.
56  void *FETokenInfo;
57 
58  void Profile(llvm::FoldingSetNodeID &ID) {
59  ID.AddPointer(Template);
60  }
61 };
62 
63 /// CXXOperatorIdName - Contains extra information for the name of an
64 /// overloaded operator in C++, such as "operator+.
66 public:
67  /// FETokenInfo - Extra information associated with this operator
68  /// name that can be used by the front end.
69  void *FETokenInfo;
70 };
71 
72 /// CXXLiteralOperatorName - Contains the actual identifier that makes up the
73 /// name.
74 ///
75 /// This identifier is stored here rather than directly in DeclarationName so as
76 /// to allow Objective-C selectors, which are about a million times more common,
77 /// to consume minimal memory.
79  : public DeclarationNameExtra, public llvm::FoldingSetNode {
80 public:
82 
83  /// FETokenInfo - Extra information associated with this operator
84  /// name that can be used by the front end.
85  void *FETokenInfo;
86 
87  void Profile(llvm::FoldingSetNodeID &FSID) {
88  FSID.AddPointer(ID);
89  }
90 };
91 
92 static int compareInt(unsigned A, unsigned B) {
93  return (A < B ? -1 : (A > B ? 1 : 0));
94 }
95 
97  if (LHS.getNameKind() != RHS.getNameKind())
98  return (LHS.getNameKind() < RHS.getNameKind() ? -1 : 1);
99 
100  switch (LHS.getNameKind()) {
102  IdentifierInfo *LII = LHS.getAsIdentifierInfo();
103  IdentifierInfo *RII = RHS.getAsIdentifierInfo();
104  if (!LII) return RII ? -1 : 0;
105  if (!RII) return 1;
106 
107  return LII->getName().compare(RII->getName());
108  }
109 
113  Selector LHSSelector = LHS.getObjCSelector();
114  Selector RHSSelector = RHS.getObjCSelector();
115  // getNumArgs for ZeroArgSelector returns 0, but we still need to compare.
118  return LHSSelector.getAsIdentifierInfo()->getName().compare(
119  RHSSelector.getAsIdentifierInfo()->getName());
120  }
121  unsigned LN = LHSSelector.getNumArgs(), RN = RHSSelector.getNumArgs();
122  for (unsigned I = 0, N = std::min(LN, RN); I != N; ++I) {
123  switch (LHSSelector.getNameForSlot(I).compare(
124  RHSSelector.getNameForSlot(I))) {
125  case -1: return -1;
126  case 1: return 1;
127  default: break;
128  }
129  }
130 
131  return compareInt(LN, RN);
132  }
133 
137  if (QualTypeOrdering()(LHS.getCXXNameType(), RHS.getCXXNameType()))
138  return -1;
139  if (QualTypeOrdering()(RHS.getCXXNameType(), LHS.getCXXNameType()))
140  return 1;
141  return 0;
142 
144  // We never want to compare deduction guide names for templates from
145  // different scopes, so just compare the template-name.
148 
152 
154  return LHS.getCXXLiteralIdentifier()->getName().compare(
156 
158  return 0;
159  }
160 
161  llvm_unreachable("Invalid DeclarationName Kind!");
162 }
163 
165  raw_ostream &OS,
166  PrintingPolicy Policy) {
167  // We know we're printing C++ here. Ensure we print types properly.
168  Policy.adjustForCPlusPlus();
169 
170  if (const RecordType *ClassRec = ClassType->getAs<RecordType>()) {
171  OS << *ClassRec->getDecl();
172  return;
173  }
175  if (auto *InjTy = ClassType->getAs<InjectedClassNameType>()) {
176  OS << *InjTy->getDecl();
177  return;
178  }
179  }
180  ClassType.print(OS, Policy);
181 }
182 
183 void DeclarationName::print(raw_ostream &OS, const PrintingPolicy &Policy) {
184  DeclarationName &N = *this;
185  switch (N.getNameKind()) {
187  if (const IdentifierInfo *II = N.getAsIdentifierInfo())
188  OS << II->getName();
189  return;
190 
194  N.getObjCSelector().print(OS);
195  return;
196 
198  return printCXXConstructorDestructorName(N.getCXXNameType(), OS, Policy);
199 
201  OS << '~';
202  return printCXXConstructorDestructorName(N.getCXXNameType(), OS, Policy);
203  }
204 
206  OS << "<deduction guide for ";
208  OS << '>';
209  return;
210 
211  case DeclarationName::CXXOperatorName: {
212  static const char* const OperatorNames[NUM_OVERLOADED_OPERATORS] = {
213  nullptr,
214 #define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
215  Spelling,
216 #include "clang/Basic/OperatorKinds.def"
217  };
218  const char *OpName = OperatorNames[N.getCXXOverloadedOperator()];
219  assert(OpName && "not an overloaded operator");
220 
221  OS << "operator";
222  if (OpName[0] >= 'a' && OpName[0] <= 'z')
223  OS << ' ';
224  OS << OpName;
225  return;
226  }
227 
228  case DeclarationName::CXXLiteralOperatorName:
229  OS << "operator\"\"" << N.getCXXLiteralIdentifier()->getName();
230  return;
231 
232  case DeclarationName::CXXConversionFunctionName: {
233  OS << "operator ";
234  QualType Type = N.getCXXNameType();
235  if (const RecordType *Rec = Type->getAs<RecordType>()) {
236  OS << *Rec->getDecl();
237  return;
238  }
239  // We know we're printing C++ here, ensure we print 'bool' properly.
240  PrintingPolicy CXXPolicy = Policy;
241  CXXPolicy.adjustForCPlusPlus();
242  Type.print(OS, CXXPolicy);
243  return;
244  }
246  OS << "<using-directive>";
247  return;
248  }
249 
250  llvm_unreachable("Unexpected declaration name kind");
251 }
252 
253 raw_ostream &operator<<(raw_ostream &OS, DeclarationName N) {
254  LangOptions LO;
255  N.print(OS, PrintingPolicy(LO));
256  return OS;
257 }
258 
259 } // end namespace clang
260 
261 DeclarationName::NameKind DeclarationName::getNameKind() const {
262  switch (getStoredNameKind()) {
263  case StoredIdentifier: return Identifier;
264  case StoredObjCZeroArgSelector: return ObjCZeroArgSelector;
265  case StoredObjCOneArgSelector: return ObjCOneArgSelector;
266 
267  case StoredDeclarationNameExtra:
268  switch (getExtra()->ExtraKindOrNumArgs) {
270  return CXXConstructorName;
271 
273  return CXXDestructorName;
274 
276  return CXXDeductionGuideName;
277 
280 
282  return CXXLiteralOperatorName;
283 
285  return CXXUsingDirective;
286 
287  default:
288  // Check if we have one of the CXXOperator* enumeration values.
289  if (getExtra()->ExtraKindOrNumArgs <
291  return CXXOperatorName;
292 
293  return ObjCMultiArgSelector;
294  }
295  }
296 
297  // Can't actually get here.
298  llvm_unreachable("This should be unreachable!");
299 }
300 
302  QualType T = getCXXNameType();
303  if (!T.isNull() && T->isDependentType())
304  return true;
305 
306  // A class-scope deduction guide in a dependent context has a dependent name.
307  auto *TD = getCXXDeductionGuideTemplate();
308  if (TD && TD->getDeclContext()->isDependentContext())
309  return true;
310 
311  return false;
312 }
313 
314 std::string DeclarationName::getAsString() const {
315  std::string Result;
316  llvm::raw_string_ostream OS(Result);
317  OS << *this;
318  return OS.str();
319 }
320 
322  if (CXXSpecialName *CXXName = getAsCXXSpecialName())
323  return CXXName->Type;
324  else
325  return QualType();
326 }
327 
329  if (auto *Guide = getAsCXXDeductionGuideNameExtra())
330  return Guide->Template;
331  return nullptr;
332 }
333 
335  if (CXXOperatorIdName *CXXOp = getAsCXXOperatorIdName()) {
336  unsigned value
337  = CXXOp->ExtraKindOrNumArgs - DeclarationNameExtra::CXXConversionFunction;
338  return static_cast<OverloadedOperatorKind>(value);
339  } else {
340  return OO_None;
341  }
342 }
343 
345  if (CXXLiteralOperatorIdName *CXXLit = getAsCXXLiteralOperatorIdName())
346  return CXXLit->ID;
347  else
348  return nullptr;
349 }
350 
351 void *DeclarationName::getFETokenInfoAsVoidSlow() const {
352  switch (getNameKind()) {
353  case Identifier:
354  llvm_unreachable("Handled by getFETokenInfo()");
355 
356  case CXXConstructorName:
357  case CXXDestructorName:
359  return getAsCXXSpecialName()->FETokenInfo;
360 
362  return getAsCXXDeductionGuideNameExtra()->FETokenInfo;
363 
364  case CXXOperatorName:
365  return getAsCXXOperatorIdName()->FETokenInfo;
366 
368  return getAsCXXLiteralOperatorIdName()->FETokenInfo;
369 
370  default:
371  llvm_unreachable("Declaration name has no FETokenInfo");
372  }
373 }
374 
376  switch (getNameKind()) {
377  case Identifier:
379  break;
380 
381  case CXXConstructorName:
382  case CXXDestructorName:
384  getAsCXXSpecialName()->FETokenInfo = T;
385  break;
386 
388  getAsCXXDeductionGuideNameExtra()->FETokenInfo = T;
389  break;
390 
391  case CXXOperatorName:
392  getAsCXXOperatorIdName()->FETokenInfo = T;
393  break;
394 
396  getAsCXXLiteralOperatorIdName()->FETokenInfo = T;
397  break;
398 
399  default:
400  llvm_unreachable("Declaration name has no FETokenInfo");
401  }
402 }
403 
405  // Single instance of DeclarationNameExtra for using-directive
406  static const DeclarationNameExtra UDirExtra =
408 
409  uintptr_t Ptr = reinterpret_cast<uintptr_t>(&UDirExtra);
410  Ptr |= StoredDeclarationNameExtra;
411 
412  return DeclarationName(Ptr);
413 }
414 
415 LLVM_DUMP_METHOD void DeclarationName::dump() const {
416  llvm::errs() << *this << '\n';
417 }
418 
419 DeclarationNameTable::DeclarationNameTable(const ASTContext &C) : Ctx(C) {
420  CXXSpecialNamesImpl = new llvm::FoldingSet<CXXSpecialName>;
421  CXXLiteralOperatorNames = new llvm::FoldingSet<CXXLiteralOperatorIdName>;
422  CXXDeductionGuideNames = new llvm::FoldingSet<CXXDeductionGuideNameExtra>;
423 
424  // Initialize the overloaded operator names.
425  CXXOperatorNames = new (Ctx) CXXOperatorIdName[NUM_OVERLOADED_OPERATORS];
426  for (unsigned Op = 0; Op < NUM_OVERLOADED_OPERATORS; ++Op) {
427  CXXOperatorNames[Op].ExtraKindOrNumArgs
429  CXXOperatorNames[Op].FETokenInfo = nullptr;
430  }
431 }
432 
434  auto *SpecialNames =
435  static_cast<llvm::FoldingSet<CXXSpecialName> *>(CXXSpecialNamesImpl);
436  auto *LiteralNames =
437  static_cast<llvm::FoldingSet<CXXLiteralOperatorIdName> *>(
438  CXXLiteralOperatorNames);
439  auto *DeductionGuideNames =
440  static_cast<llvm::FoldingSet<CXXDeductionGuideNameExtra> *>(
441  CXXDeductionGuideNames);
442 
443  delete SpecialNames;
444  delete LiteralNames;
445  delete DeductionGuideNames;
446 }
447 
450  Ty.getUnqualifiedType());
451 }
452 
455  Ty.getUnqualifiedType());
456 }
457 
460  Template = cast<TemplateDecl>(Template->getCanonicalDecl());
461 
462  auto *DeductionGuideNames =
463  static_cast<llvm::FoldingSet<CXXDeductionGuideNameExtra> *>(
464  CXXDeductionGuideNames);
465 
466  llvm::FoldingSetNodeID ID;
467  ID.AddPointer(Template);
468 
469  void *InsertPos = nullptr;
470  if (auto *Name = DeductionGuideNames->FindNodeOrInsertPos(ID, InsertPos))
471  return DeclarationName(Name);
472 
473  auto *Name = new (Ctx) CXXDeductionGuideNameExtra;
474  Name->ExtraKindOrNumArgs = DeclarationNameExtra::CXXDeductionGuide;
475  Name->Template = Template;
476  Name->FETokenInfo = nullptr;
477 
478  DeductionGuideNames->InsertNode(Name, InsertPos);
479  return DeclarationName(Name);
480 }
481 
485 }
486 
489  CanQualType Ty) {
490  assert(Kind >= DeclarationName::CXXConstructorName &&
492  "Kind must be a C++ special name kind");
493  llvm::FoldingSet<CXXSpecialName> *SpecialNames
494  = static_cast<llvm::FoldingSet<CXXSpecialName>*>(CXXSpecialNamesImpl);
495 
497  switch (Kind) {
500  assert(!Ty.hasQualifiers() &&"Constructor type must be unqualified");
501  break;
504  assert(!Ty.hasQualifiers() && "Destructor type must be unqualified");
505  break;
508  break;
509  default:
510  return DeclarationName();
511  }
512 
513  // Unique selector, to guarantee there is one per name.
514  llvm::FoldingSetNodeID ID;
515  ID.AddInteger(EKind);
516  ID.AddPointer(Ty.getAsOpaquePtr());
517 
518  void *InsertPos = nullptr;
519  if (CXXSpecialName *Name = SpecialNames->FindNodeOrInsertPos(ID, InsertPos))
520  return DeclarationName(Name);
521 
522  CXXSpecialName *SpecialName = new (Ctx) CXXSpecialName;
523  SpecialName->ExtraKindOrNumArgs = EKind;
524  SpecialName->Type = Ty;
525  SpecialName->FETokenInfo = nullptr;
526 
527  SpecialNames->InsertNode(SpecialName, InsertPos);
528  return DeclarationName(SpecialName);
529 }
530 
533  return DeclarationName(&CXXOperatorNames[(unsigned)Op]);
534 }
535 
538  llvm::FoldingSet<CXXLiteralOperatorIdName> *LiteralNames
539  = static_cast<llvm::FoldingSet<CXXLiteralOperatorIdName>*>
540  (CXXLiteralOperatorNames);
541 
542  llvm::FoldingSetNodeID ID;
543  ID.AddPointer(II);
544 
545  void *InsertPos = nullptr;
547  LiteralNames->FindNodeOrInsertPos(ID, InsertPos))
548  return DeclarationName (Name);
549 
550  CXXLiteralOperatorIdName *LiteralName = new (Ctx) CXXLiteralOperatorIdName;
552  LiteralName->ID = II;
553  LiteralName->FETokenInfo = nullptr;
554 
555  LiteralNames->InsertNode(LiteralName, InsertPos);
556  return DeclarationName(LiteralName);
557 }
558 
560  switch (Name.getNameKind()) {
563  break;
567  NamedType.TInfo = nullptr;
568  break;
572  break;
575  break;
579  // FIXME: ?
580  break;
582  break;
583  }
584 }
585 
587  switch (Name.getNameKind()) {
596  return false;
597 
601  if (TypeSourceInfo *TInfo = LocInfo.NamedType.TInfo)
602  return TInfo->getType()->containsUnexpandedParameterPack();
603 
605  }
606  llvm_unreachable("All name kinds handled.");
607 }
608 
610  switch (Name.getNameKind()) {
619  return false;
620 
624  if (TypeSourceInfo *TInfo = LocInfo.NamedType.TInfo)
625  return TInfo->getType()->isInstantiationDependentType();
626 
628  }
629  llvm_unreachable("All name kinds handled.");
630 }
631 
632 std::string DeclarationNameInfo::getAsString() const {
633  std::string Result;
634  llvm::raw_string_ostream OS(Result);
635  printName(OS);
636  return OS.str();
637 }
638 
639 void DeclarationNameInfo::printName(raw_ostream &OS) const {
640  switch (Name.getNameKind()) {
649  OS << Name;
650  return;
651 
655  if (TypeSourceInfo *TInfo = LocInfo.NamedType.TInfo) {
656  if (Name.getNameKind() == DeclarationName::CXXDestructorName)
657  OS << '~';
658  else if (Name.getNameKind() == DeclarationName::CXXConversionFunctionName)
659  OS << "operator ";
660  LangOptions LO;
661  LO.CPlusPlus = true;
662  LO.Bool = true;
663  PrintingPolicy PP(LO);
664  PP.SuppressScope = true;
665  OS << TInfo->getType().getAsString(PP);
666  } else
667  OS << Name;
668  return;
669  }
670  llvm_unreachable("Unexpected declaration name kind");
671 }
672 
674  switch (Name.getNameKind()) {
677  return NameLoc;
678 
680  unsigned raw = LocInfo.CXXOperatorName.EndOpNameLoc;
682  }
683 
685  unsigned raw = LocInfo.CXXLiteralOperatorName.OpNameLoc;
687  }
688 
692  if (TypeSourceInfo *TInfo = LocInfo.NamedType.TInfo)
693  return TInfo->getTypeLoc().getEndLoc();
694  else
695  return NameLoc;
696 
697  // DNInfo work in progress: FIXME.
702  return NameLoc;
703  }
704  llvm_unreachable("Unexpected declaration name kind");
705 }
bool isDependentName() const
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself ...
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 ...
A (possibly-)qualified type.
Definition: Type.h:616
NameKind
NameKind - The kind of name this object contains.
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. ...
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:1803
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
SourceLocation getEndLoc() const
getEndLoc - Retrieve the location of the last token.
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
C Language Family Type Representation.
DeclarationName getCXXConversionFunctionName(CanQualType Ty)
getCXXConversionFunctionName - Returns the name of a C++ conversion function for the given Type...
Defines the C++ template declaration subclasses.
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
The base class of the type hierarchy.
Definition: Type.h:1303
A container of type source information.
Definition: Decl.h:62
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
DeclarationName getCXXDeductionGuideName(TemplateDecl *TD)
Returns the name of a C++ deduction guide for the given template.
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1575
CXXOperatorIdName - Contains extra information for the name of an overloaded operator in C++...
void Profile(llvm::FoldingSetNodeID &ID)
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:128
static int compare(DeclarationName LHS, DeclarationName RHS)
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
static int compareInt(unsigned A, unsigned B)
void print(raw_ostream &OS, const PrintingPolicy &Policy)
DeclarationName getCXXDestructorName(CanQualType Ty)
getCXXDestructorName - Returns the name of a C++ destructor for the given Type.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:48
DeclarationNameExtra - Common base of the MultiKeywordSelector, CXXSpecialName, and CXXOperatorIdName...
bool SuppressScope
Suppresses printing of scope specifiers.
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
Definition: Type.h:952
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
detail::InMemoryDirectory::const_iterator I
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:841
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...
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
Allows QualTypes to be sorted and hence used in maps and sets.
void * getAsOpaquePtr() const
Retrieve the internal representation of this canonical type.
StringRef getName() const
Return the actual identifier string.
Contains extra information for the name of a C++ deduction guide.
void Profile(llvm::FoldingSetNodeID &FSID)
unsigned getNumArgs() const
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
void setFETokenInfo(void *T)
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.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:1797
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.
struct CXXOpName CXXOperatorName
DeclarationName getDeclName() const
getDeclName - Get the actual, stored name of the declaration, which may be a special name...
Definition: Decl.h:258
The result type of a method or function.
__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...
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.
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
const std::string ID
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
std::string getAsString() const
getAsString - Retrieve the human-readable string for this name.
std::ostream & operator<<(std::ostream &ss, const StringRef str)
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.
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:4437
void Profile(llvm::FoldingSetNodeID &ID)
Selector getObjCSelector() const
getObjCSelector - Get the Objective-C selector stored in this declaration name.
StringRef Name
Definition: USRFinder.cpp:123
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:378
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's known that we're printing C++ code (for instance...
Definition: PrettyPrinter.h:59
void printName(raw_ostream &OS) const
printName - Print the human-readable name to a stream.
bool hasQualifiers() const
Determines whether this type has any qualifiers.
DeclarationName()
DeclarationName - Used to create an empty selector.
Not an overloaded operator.
Definition: OperatorKinds.h:23
struct CXXLitOpName CXXLiteralOperatorName
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:3784
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:6042
bool isInstantiationDependent() const
Determine whether this name involves a template parameter.
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).
bool containsUnexpandedParameterPack() const
Determine whether this name contains an unexpanded parameter pack.
static void printCXXConstructorDestructorName(QualType ClassType, raw_ostream &OS, PrintingPolicy Policy)
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.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:683
DeclarationName getCXXOperatorName(OverloadedOperatorKind Op)
getCXXOperatorName - Get the name of the overloadable C++ operator corresponding to Op...