clang  13.0.0git
DeclarationName.cpp
Go to the documentation of this file.
1 //===- DeclarationName.cpp - Declaration names implementation -------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file implements the DeclarationName and DeclarationNameTable
10 // classes.
11 //
12 //===----------------------------------------------------------------------===//
13 
15 #include "clang/AST/ASTContext.h"
16 #include "clang/AST/Decl.h"
17 #include "clang/AST/DeclBase.h"
18 #include "clang/AST/DeclCXX.h"
19 #include "clang/AST/DeclTemplate.h"
20 #include "clang/AST/OpenMPClause.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 static int compareInt(unsigned A, unsigned B) {
43  return (A < B ? -1 : (A > B ? 1 : 0));
44 }
45 
47  if (LHS.getNameKind() != RHS.getNameKind())
48  return (LHS.getNameKind() < RHS.getNameKind() ? -1 : 1);
49 
50  switch (LHS.getNameKind()) {
52  IdentifierInfo *LII = LHS.castAsIdentifierInfo();
53  IdentifierInfo *RII = RHS.castAsIdentifierInfo();
54  if (!LII)
55  return RII ? -1 : 0;
56  if (!RII)
57  return 1;
58 
59  return LII->getName().compare(RII->getName());
60  }
61 
65  Selector LHSSelector = LHS.getObjCSelector();
66  Selector RHSSelector = RHS.getObjCSelector();
67  // getNumArgs for ZeroArgSelector returns 0, but we still need to compare.
70  return LHSSelector.getAsIdentifierInfo()->getName().compare(
71  RHSSelector.getAsIdentifierInfo()->getName());
72  }
73  unsigned LN = LHSSelector.getNumArgs(), RN = RHSSelector.getNumArgs();
74  for (unsigned I = 0, N = std::min(LN, RN); I != N; ++I) {
75  switch (LHSSelector.getNameForSlot(I).compare(
76  RHSSelector.getNameForSlot(I))) {
77  case -1:
78  return -1;
79  case 1:
80  return 1;
81  default:
82  break;
83  }
84  }
85 
86  return compareInt(LN, RN);
87  }
88 
93  return -1;
95  return 1;
96  return 0;
97 
99  // We never want to compare deduction guide names for templates from
100  // different scopes, so just compare the template-name.
103 
107 
109  return LHS.getCXXLiteralIdentifier()->getName().compare(
111 
113  return 0;
114  }
115 
116  llvm_unreachable("Invalid DeclarationName Kind!");
117 }
118 
120  raw_ostream &OS,
121  PrintingPolicy Policy) {
122  // We know we're printing C++ here. Ensure we print types properly.
123  Policy.adjustForCPlusPlus();
124 
125  if (const RecordType *ClassRec = ClassType->getAs<RecordType>()) {
126  OS << *ClassRec->getDecl();
127  return;
128  }
130  if (auto *InjTy = ClassType->getAs<InjectedClassNameType>()) {
131  OS << *InjTy->getDecl();
132  return;
133  }
134  }
135  ClassType.print(OS, Policy);
136 }
137 
138 void DeclarationName::print(raw_ostream &OS,
139  const PrintingPolicy &Policy) const {
140  switch (getNameKind()) {
142  if (const IdentifierInfo *II = getAsIdentifierInfo()) {
143  StringRef Name = II->getName();
144  // If this is a mangled OpenMP variant name we strip off the mangling for
145  // printing. It should not be visible to the user at all.
146  if (II->isMangledOpenMPVariantName()) {
147  std::pair<StringRef, StringRef> NameContextPair =
149  OS << NameContextPair.first << "["
150  << OMPTraitInfo(NameContextPair.second) << "]";
151  } else {
152  OS << Name;
153  }
154  }
155  return;
156 
160  getObjCSelector().print(OS);
161  return;
162 
165 
167  OS << '~';
169 
171  OS << "<deduction guide for ";
173  OS << '>';
174  return;
175 
176  case DeclarationName::CXXOperatorName: {
177  const char *OpName = getOperatorSpelling(getCXXOverloadedOperator());
178  assert(OpName && "not an overloaded operator");
179 
180  OS << "operator";
181  if (OpName[0] >= 'a' && OpName[0] <= 'z')
182  OS << ' ';
183  OS << OpName;
184  return;
185  }
186 
187  case DeclarationName::CXXLiteralOperatorName:
188  OS << "operator\"\"" << getCXXLiteralIdentifier()->getName();
189  return;
190 
191  case DeclarationName::CXXConversionFunctionName: {
192  OS << "operator ";
193  QualType Type = getCXXNameType();
194  if (const RecordType *Rec = Type->getAs<RecordType>()) {
195  OS << *Rec->getDecl();
196  return;
197  }
198  // We know we're printing C++ here, ensure we print 'bool' properly.
199  PrintingPolicy CXXPolicy = Policy;
200  CXXPolicy.adjustForCPlusPlus();
201  Type.print(OS, CXXPolicy);
202  return;
203  }
205  OS << "<using-directive>";
206  return;
207  }
208 
209  llvm_unreachable("Unexpected declaration name kind");
210 }
211 
212 namespace clang {
213 
214 raw_ostream &operator<<(raw_ostream &OS, DeclarationName N) {
215  LangOptions LO;
216  N.print(OS, PrintingPolicy(LO));
217  return OS;
218 }
219 
220 } // namespace clang
221 
222 bool DeclarationName::isDependentName() const {
223  QualType T = getCXXNameType();
224  if (!T.isNull() && T->isDependentType())
225  return true;
226 
227  // A class-scope deduction guide in a dependent context has a dependent name.
228  auto *TD = getCXXDeductionGuideTemplate();
229  if (TD && TD->getDeclContext()->isDependentContext())
230  return true;
231 
232  return false;
233 }
234 
236  std::string Result;
237  llvm::raw_string_ostream OS(Result);
238  OS << *this;
239  return OS.str();
240 }
241 
242 void *DeclarationName::getFETokenInfoSlow() const {
243  switch (getNameKind()) {
244  case Identifier:
245  llvm_unreachable("case Identifier already handled by getFETokenInfo!");
246  case CXXConstructorName:
247  case CXXDestructorName:
249  return castAsCXXSpecialNameExtra()->FETokenInfo;
250  case CXXOperatorName:
251  return castAsCXXOperatorIdName()->FETokenInfo;
253  return castAsCXXDeductionGuideNameExtra()->FETokenInfo;
255  return castAsCXXLiteralOperatorIdName()->FETokenInfo;
256  default:
257  llvm_unreachable("DeclarationName has no FETokenInfo!");
258  }
259 }
260 
261 void DeclarationName::setFETokenInfoSlow(void *T) {
262  switch (getNameKind()) {
263  case Identifier:
264  llvm_unreachable("case Identifier already handled by setFETokenInfo!");
265  case CXXConstructorName:
266  case CXXDestructorName:
268  castAsCXXSpecialNameExtra()->FETokenInfo = T;
269  break;
270  case CXXOperatorName:
271  castAsCXXOperatorIdName()->FETokenInfo = T;
272  break;
274  castAsCXXDeductionGuideNameExtra()->FETokenInfo = T;
275  break;
277  castAsCXXLiteralOperatorIdName()->FETokenInfo = T;
278  break;
279  default:
280  llvm_unreachable("DeclarationName has no FETokenInfo!");
281  }
282 }
283 
284 LLVM_DUMP_METHOD void DeclarationName::dump() const {
285  llvm::errs() << *this << '\n';
286 }
287 
289  // Initialize the overloaded operator names.
290  for (unsigned Op = 0; Op < NUM_OVERLOADED_OPERATORS; ++Op)
291  CXXOperatorNames[Op].Kind = static_cast<OverloadedOperatorKind>(Op);
292 }
293 
296  Template = cast<TemplateDecl>(Template->getCanonicalDecl());
297 
298  llvm::FoldingSetNodeID ID;
299  ID.AddPointer(Template);
300 
301  void *InsertPos = nullptr;
302  if (auto *Name = CXXDeductionGuideNames.FindNodeOrInsertPos(ID, InsertPos))
303  return DeclarationName(Name);
304 
305  auto *Name = new (Ctx) detail::CXXDeductionGuideNameExtra(Template);
306  CXXDeductionGuideNames.InsertNode(Name, InsertPos);
307  return DeclarationName(Name);
308 }
309 
311  // The type of constructors is unqualified.
312  Ty = Ty.getUnqualifiedType();
313  // Do we already have this C++ constructor name ?
314  llvm::FoldingSetNodeID ID;
315  ID.AddPointer(Ty.getAsOpaquePtr());
316  void *InsertPos = nullptr;
317  if (auto *Name = CXXConstructorNames.FindNodeOrInsertPos(ID, InsertPos))
318  return {Name, DeclarationName::StoredCXXConstructorName};
319 
320  // We have to create it.
321  auto *SpecialName = new (Ctx) detail::CXXSpecialNameExtra(Ty);
322  CXXConstructorNames.InsertNode(SpecialName, InsertPos);
323  return {SpecialName, DeclarationName::StoredCXXConstructorName};
324 }
325 
327  // The type of destructors is unqualified.
328  Ty = Ty.getUnqualifiedType();
329  // Do we already have this C++ destructor name ?
330  llvm::FoldingSetNodeID ID;
331  ID.AddPointer(Ty.getAsOpaquePtr());
332  void *InsertPos = nullptr;
333  if (auto *Name = CXXDestructorNames.FindNodeOrInsertPos(ID, InsertPos))
334  return {Name, DeclarationName::StoredCXXDestructorName};
335 
336  // We have to create it.
337  auto *SpecialName = new (Ctx) detail::CXXSpecialNameExtra(Ty);
338  CXXDestructorNames.InsertNode(SpecialName, InsertPos);
339  return {SpecialName, DeclarationName::StoredCXXDestructorName};
340 }
341 
344  // Do we already have this C++ conversion function name ?
345  llvm::FoldingSetNodeID ID;
346  ID.AddPointer(Ty.getAsOpaquePtr());
347  void *InsertPos = nullptr;
348  if (auto *Name =
349  CXXConversionFunctionNames.FindNodeOrInsertPos(ID, InsertPos))
350  return {Name, DeclarationName::StoredCXXConversionFunctionName};
351 
352  // We have to create it.
353  auto *SpecialName = new (Ctx) detail::CXXSpecialNameExtra(Ty);
354  CXXConversionFunctionNames.InsertNode(SpecialName, InsertPos);
355  return {SpecialName, DeclarationName::StoredCXXConversionFunctionName};
356 }
357 
360  CanQualType Ty) {
361  switch (Kind) {
363  return getCXXConstructorName(Ty);
365  return getCXXDestructorName(Ty);
367  return getCXXConversionFunctionName(Ty);
368  default:
369  llvm_unreachable("Invalid kind in getCXXSpecialName!");
370  }
371 }
372 
375  llvm::FoldingSetNodeID ID;
376  ID.AddPointer(II);
377 
378  void *InsertPos = nullptr;
379  if (auto *Name = CXXLiteralOperatorNames.FindNodeOrInsertPos(ID, InsertPos))
380  return DeclarationName(Name);
381 
382  auto *LiteralName = new (Ctx) detail::CXXLiteralOperatorIdName(II);
383  CXXLiteralOperatorNames.InsertNode(LiteralName, InsertPos);
384  return DeclarationName(LiteralName);
385 }
386 
388  switch (Name.getNameKind()) {
391  break;
395  setNamedTypeLoc(nullptr);
396  break;
398  setCXXOperatorNameRange(SourceRange());
399  break;
401  setCXXLiteralOperatorNameLoc(SourceLocation());
402  break;
406  // FIXME: ?
407  break;
409  break;
410  }
411 }
412 
414  switch (Name.getNameKind()) {
423  return false;
424 
428  if (TypeSourceInfo *TInfo = LocInfo.getNamedTypeInfo())
429  return TInfo->getType()->containsUnexpandedParameterPack();
430 
432  }
433  llvm_unreachable("All name kinds handled.");
434 }
435 
437  switch (Name.getNameKind()) {
446  return false;
447 
451  if (TypeSourceInfo *TInfo = LocInfo.getNamedTypeInfo())
452  return TInfo->getType()->isInstantiationDependentType();
453 
455  }
456  llvm_unreachable("All name kinds handled.");
457 }
458 
460  std::string Result;
461  llvm::raw_string_ostream OS(Result);
462  OS << *this;
463  return OS.str();
464 }
465 
466 raw_ostream &clang::operator<<(raw_ostream &OS, DeclarationNameInfo DNInfo) {
467  LangOptions LO;
468  DNInfo.printName(OS, PrintingPolicy(LangOptions()));
469  return OS;
470 }
471 
472 void DeclarationNameInfo::printName(raw_ostream &OS, PrintingPolicy Policy) const {
473  switch (Name.getNameKind()) {
482  Name.print(OS, Policy);
483  return;
484 
488  if (TypeSourceInfo *TInfo = LocInfo.getNamedTypeInfo()) {
490  OS << '~';
492  OS << "operator ";
493  LangOptions LO;
494  Policy.adjustForCPlusPlus();
495  Policy.SuppressScope = true;
496  OS << TInfo->getType().getAsString(Policy);
497  } else
498  Name.print(OS, Policy);
499  return;
500  }
501  llvm_unreachable("Unexpected declaration name kind");
502 }
503 
504 SourceLocation DeclarationNameInfo::getEndLocPrivate() const {
505  switch (Name.getNameKind()) {
508  return NameLoc;
509 
511  return LocInfo.getCXXOperatorNameEndLoc();
512 
514  return LocInfo.getCXXLiteralOperatorNameLoc();
515 
519  if (TypeSourceInfo *TInfo = LocInfo.getNamedTypeInfo())
520  return TInfo->getTypeLoc().getEndLoc();
521  else
522  return NameLoc;
523 
524  // DNInfo work in progress: FIXME.
529  return NameLoc;
530  }
531  llvm_unreachable("Unexpected declaration name kind");
532 }
clang::DeclarationNameLoc::getCXXOperatorNameEndLoc
SourceLocation getCXXOperatorNameEndLoc() const
Return the end location of the getCXXOperatorNameRange() range.
Definition: DeclarationName.h:708
clang::PrintingPolicy::SuppressScope
unsigned SuppressScope
Suppresses printing of scope specifiers.
Definition: PrettyPrinter.h:129
clang::DeclarationName::Identifier
@ Identifier
Definition: DeclarationName.h:203
clang::DeclarationName::CXXLiteralOperatorName
@ CXXLiteralOperatorName
Definition: DeclarationName.h:212
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:212
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::DeclarationName::CXXConstructorName
@ CXXConstructorName
Definition: DeclarationName.h:206
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:88
clang::OMPTraitInfo
Helper data structure representing the traits in a match clause of an declare variant or metadirectiv...
Definition: OpenMPClause.h:8489
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:668
AttributeLangSupport::C
@ C
Definition: SemaDeclAttr.cpp:54
DeclCXX.h
clang::DeclarationNameTable::getCXXConversionFunctionName
DeclarationName getCXXConversionFunctionName(CanQualType Ty)
Returns the name of a C++ conversion function for the given Type.
Definition: DeclarationName.cpp:343
clang::DeclarationName::dump
void dump() const
Definition: DeclarationName.cpp:284
clang::DeclarationName::CXXDeductionGuideName
@ CXXDeductionGuideName
Definition: DeclarationName.h:210
clang::Type::containsUnexpandedParameterPack
bool containsUnexpandedParameterPack() const
Whether this type is or contains an unexpanded parameter pack, used to support C++0x variadic templat...
Definition: Type.h:1873
clang::DeclarationNameTable::getCXXDestructorName
DeclarationName getCXXDestructorName(CanQualType Ty)
Returns the name of a C++ destructor for the given Type.
Definition: DeclarationName.cpp:326
clang::PrintingPolicy::SuppressTemplateArgsInCXXConstructors
unsigned SuppressTemplateArgsInCXXConstructors
When true, suppresses printing template arguments in names of C++ constructors.
Definition: PrettyPrinter.h:184
clang::DeclarationNameTable::getCXXDeductionGuideName
DeclarationName getCXXDeductionGuideName(TemplateDecl *TD)
Returns the name of a C++ deduction guide for the given template.
Definition: DeclarationName.cpp:295
clang::DeclarationNameInfo::containsUnexpandedParameterPack
bool containsUnexpandedParameterPack() const
Determine whether this name contains an unexpanded parameter pack.
Definition: DeclarationName.cpp:413
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:59
clang::DeclarationName::getAsIdentifierInfo
IdentifierInfo * getAsIdentifierInfo() const
Retrieve the IdentifierInfo * stored in this declaration name, or null if this declaration name isn't...
Definition: DeclarationName.h:410
clang::DeclarationName::getCXXDeductionGuideTemplate
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name.
Definition: DeclarationName.h:451
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:145
clang::DeclarationNameLoc::getNamedTypeInfo
TypeSourceInfo * getNamedTypeInfo() const
Returns the source type info.
Definition: DeclarationName.h:700
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1485
Decl.h
PrettyPrinter.h
clang::DeclarationNameInfo::isInstantiationDependent
bool isInstantiationDependent() const
Determine whether this name involves a template parameter.
Definition: DeclarationName.cpp:436
clang::DeclarationName::compare
static int compare(DeclarationName LHS, DeclarationName RHS)
Definition: DeclarationName.cpp:46
min
__DEVICE__ int min(int __a, int __b)
Definition: __clang_cuda_math.h:197
clang::RecordType
A helper class that allows the use of isa/cast/dyncast to detect TagType objects of structs/unions/cl...
Definition: Type.h:4615
clang::DeclarationName::getObjCSelector
Selector getObjCSelector() const
Get the Objective-C selector stored in this declaration name.
Definition: DeclarationName.h:481
DeclTemplate.h
clang::DeclarationName::getCXXOverloadedOperator
OverloadedOperatorKind getCXXOverloadedOperator() const
If this name is the name of an overloadable operator in C++ (e.g., operator+), retrieve the kind of o...
Definition: DeclarationName.h:462
clang::Selector::getNameForSlot
StringRef getNameForSlot(unsigned argIndex) const
Retrieve the name at a given position in the selector.
Definition: IdentifierTable.cpp:502
DeclBase.h
clang::CanQual::getAsOpaquePtr
void * getAsOpaquePtr() const
Retrieve the internal representation of this canonical type.
Definition: CanonicalType.h:182
OperatorKinds.h
clang::DeclarationName::CXXDestructorName
@ CXXDestructorName
Definition: DeclarationName.h:207
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:189
LangOptions.h
clang::DeclarationName::getAsString
std::string getAsString() const
Retrieve the human-readable string for this name.
Definition: DeclarationName.cpp:235
clang::DeclarationNameLoc::getCXXLiteralOperatorNameLoc
SourceLocation getCXXLiteralOperatorNameLoc() const
Return the location of the literal operator name (without the operator keyword).
Definition: DeclarationName.h:723
clang::Selector::getNumArgs
unsigned getNumArgs() const
Definition: IdentifierTable.cpp:480
clang::Type::getAs
const T * getAs() const
Member-template getAs<specific type>'.
Definition: Type.h:7160
clang::DeclarationName::CXXOperatorName
@ CXXOperatorName
Definition: DeclarationName.h:209
clang::Decl::getCanonicalDecl
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
Definition: DeclBase.h:901
IdentifierTable.h
compareInt
static int compareInt(unsigned A, unsigned B)
Definition: DeclarationName.cpp:42
clang::Selector::print
void print(llvm::raw_ostream &OS) const
Prints the full selector name (e.g. "foo:bar:").
Definition: IdentifierTable.cpp:542
Type.h
ASTContext.h
clang::NUM_OVERLOADED_OPERATORS
@ NUM_OVERLOADED_OPERATORS
Definition: OperatorKinds.h:26
clang::DeclarationNameLoc::DeclarationNameLoc
DeclarationNameLoc()
Definition: DeclarationName.h:696
clang::DeclarationName::CXXUsingDirective
@ CXXUsingDirective
Definition: DeclarationName.h:215
clang::CanQual< Type >
clang::operator<<
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
Definition: ASTContext.cpp:11681
clang::detail::CXXDeductionGuideNameExtra
Contains extra information for the name of a C++ deduction guide.
Definition: DeclarationName.h:75
clang::OverloadedOperatorKind
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
clang::DeclarationName::CXXConversionFunctionName
@ CXXConversionFunctionName
Definition: DeclarationName.h:208
clang::getOpenMPVariantManglingSeparatorStr
static constexpr StringRef getOpenMPVariantManglingSeparatorStr()
OpenMP variants are mangled early based on their OpenMP context selector.
Definition: Decl.h:4641
SourceLocation.h
clang::DeclarationNameInfo::printName
void printName(raw_ostream &OS, PrintingPolicy Policy) const
printName - Print the human-readable name to a stream.
Definition: DeclarationName.cpp:472
clang::Type::isDependentType
bool isDependentType() const
Whether this type is a dependent type, meaning that its definition somehow depends on a template para...
Definition: Type.h:2168
clang::Type::isInstantiationDependentType
bool isInstantiationDependentType() const
Determine whether this type is an instantiation-dependent type, meaning that the type involves a temp...
Definition: Type.h:2176
clang::TemplateDecl
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:399
TypeOrdering.h
clang::QualType::isNull
bool isNull() const
Return true if this QualType doesn't point to a type yet.
Definition: Type.h:733
OpenMPClause.h
clang::DeclarationName::ObjCZeroArgSelector
@ ObjCZeroArgSelector
Definition: DeclarationName.h:204
clang::detail::CXXSpecialNameExtra
CXXSpecialNameExtra records the type associated with one of the "special" kinds of declaration names ...
Definition: DeclarationName.h:53
clang::DeclarationName::ObjCOneArgSelector
@ ObjCOneArgSelector
Definition: DeclarationName.h:205
LLVM.h
clang::DeclarationName::NameKind
NameKind
The kind of the name stored in this DeclarationName.
Definition: DeclarationName.h:202
clang::InjectedClassNameType
The injected class name of a C++ class template or class template partial specialization.
Definition: Type.h:5258
clang::PrintingPolicy::adjustForCPlusPlus
void adjustForCPlusPlus()
Adjust this printing policy for cases where it's known that we're printing C++ code (for instance,...
Definition: PrettyPrinter.h:83
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:67
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:58
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::DeclarationNameTable::DeclarationNameTable
DeclarationNameTable(const ASTContext &C)
Definition: DeclarationName.cpp:288
clang::DeclarationNameTable::getCXXSpecialName
DeclarationName getCXXSpecialName(DeclarationName::NameKind Kind, CanQualType Ty)
Returns a declaration name for special kind of C++ name, e.g., for a constructor, destructor,...
Definition: DeclarationName.cpp:359
DeclarationName.h
clang::CanQual::getUnqualifiedType
CanQual< T > getUnqualifiedType() const
Retrieve the unqualified form of this type.
Definition: CanonicalType.h:620
clang::DeclarationName::getNameKind
NameKind getNameKind() const
Determine what kind of name this is.
Definition: DeclarationName.h:384
clang::IdentifierInfo::getName
StringRef getName() const
Return the actual identifier string.
Definition: IdentifierTable.h:168
clang::Builtin::ID
ID
Definition: Builtins.h:48
clang
Definition: CalledOnceCheck.h:17
clang::DeclarationNameInfo::getAsString
std::string getAsString() const
getAsString - Retrieve the human-readable string for this name.
Definition: DeclarationName.cpp:459
clang::Selector
Smart pointer class that efficiently represents Objective-C method names.
Definition: IdentifierTable.h:685
printCXXConstructorDestructorName
static void printCXXConstructorDestructorName(QualType ClassType, raw_ostream &OS, PrintingPolicy Policy)
Definition: DeclarationName.cpp:119
clang::DeclarationName::print
void print(raw_ostream &OS, const PrintingPolicy &Policy) const
Definition: DeclarationName.cpp:138
clang::TypeSourceInfo
A container of type source information.
Definition: Type.h:6398
clang::NamedDecl::getDeclName
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Definition: Decl.h:313
clang::DeclarationName::getCXXLiteralIdentifier
IdentifierInfo * getCXXLiteralIdentifier() const
If this name is the name of a literal operator, retrieve the identifier associated with it.
Definition: DeclarationName.h:472
clang::QualTypeOrdering
Function object that provides a total ordering on QualType values.
Definition: TypeOrdering.h:28
clang::QualType::print
void print(raw_ostream &OS, const PrintingPolicy &Policy, const Twine &PlaceHolder=Twine(), unsigned Indentation=0) const
Definition: TypePrinter.cpp:2245
clang::detail::CXXLiteralOperatorIdName
Contains the actual identifier that makes up the name of a C++ literal operator.
Definition: DeclarationName.h:116
clang::DeclarationName::ObjCMultiArgSelector
@ ObjCMultiArgSelector
Definition: DeclarationName.h:217
clang::DeclarationName::getCXXNameType
QualType getCXXNameType() const
If this name is one of the C++ names (of a constructor, destructor, or conversion function),...
Definition: DeclarationName.h:439
clang::DeclarationNameInfo
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Definition: DeclarationName.h:758
clang::DeclarationNameTable::getCXXConstructorName
DeclarationName getCXXConstructorName(CanQualType Ty)
Returns the name of a C++ constructor for the given Type.
Definition: DeclarationName.cpp:310
clang::DeclarationNameTable::getCXXLiteralOperatorName
DeclarationName getCXXLiteralOperatorName(IdentifierInfo *II)
Get the name of the literal operator function with II as the identifier.
Definition: DeclarationName.cpp:374
TypeLoc.h