clang  15.0.0git
DeclarationName.h
Go to the documentation of this file.
1 //===- DeclarationName.h - Representation of declaration names --*- C++ -*-===//
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 declares the DeclarationName and DeclarationNameTable classes.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_CLANG_AST_DECLARATIONNAME_H
14 #define LLVM_CLANG_AST_DECLARATIONNAME_H
15 
16 #include "clang/AST/Type.h"
17 #include "clang/Basic/Diagnostic.h"
22 #include "llvm/ADT/DenseMapInfo.h"
23 #include "llvm/ADT/FoldingSet.h"
24 #include "llvm/ADT/STLExtras.h"
25 #include "llvm/Support/Compiler.h"
26 #include "llvm/Support/type_traits.h"
27 #include <cassert>
28 #include <cstdint>
29 #include <cstring>
30 #include <string>
31 
32 namespace clang {
33 
34 class ASTContext;
35 template <typename> class CanQual;
36 class DeclarationName;
37 class DeclarationNameTable;
38 struct PrintingPolicy;
39 class TemplateDecl;
40 class TypeSourceInfo;
41 
42 using CanQualType = CanQual<Type>;
43 
44 namespace detail {
45 
46 /// CXXSpecialNameExtra records the type associated with one of the "special"
47 /// kinds of declaration names in C++, e.g., constructors, destructors, and
48 /// conversion functions. Note that CXXSpecialName is used for C++ constructor,
49 /// destructor and conversion functions, but the actual kind is not stored in
50 /// CXXSpecialName. Instead we use three different FoldingSet<CXXSpecialName>
51 /// in DeclarationNameTable.
52 class alignas(IdentifierInfoAlignment) CXXSpecialNameExtra
53  : public llvm::FoldingSetNode {
54  friend class clang::DeclarationName;
56 
57  /// The type associated with this declaration name.
58  QualType Type;
59 
60  /// Extra information associated with this declaration name that
61  /// can be used by the front end. All bits are really needed
62  /// so it is not possible to stash something in the low order bits.
63  void *FETokenInfo;
64 
65  CXXSpecialNameExtra(QualType QT) : Type(QT), FETokenInfo(nullptr) {}
66 
67 public:
68  void Profile(llvm::FoldingSetNodeID &ID) {
69  ID.AddPointer(Type.getAsOpaquePtr());
70  }
71 };
72 
73 /// Contains extra information for the name of a C++ deduction guide.
74 class alignas(IdentifierInfoAlignment) CXXDeductionGuideNameExtra
76  public llvm::FoldingSetNode {
77  friend class clang::DeclarationName;
79 
80  /// The template named by the deduction guide.
81  TemplateDecl *Template;
82 
83  /// Extra information associated with this operator name that
84  /// can be used by the front end. All bits are really needed
85  /// so it is not possible to stash something in the low order bits.
86  void *FETokenInfo;
87 
89  : DeclarationNameExtra(CXXDeductionGuideName), Template(TD),
90  FETokenInfo(nullptr) {}
91 
92 public:
93  void Profile(llvm::FoldingSetNodeID &ID) { ID.AddPointer(Template); }
94 };
95 
96 /// Contains extra information for the name of an overloaded operator
97 /// in C++, such as "operator+. This do not includes literal or conversion
98 /// operators. For literal operators see CXXLiteralOperatorIdName and for
99 /// conversion operators see CXXSpecialNameExtra.
100 class alignas(IdentifierInfoAlignment) CXXOperatorIdName {
103 
104  /// The kind of this operator.
106 
107  /// Extra information associated with this operator name that
108  /// can be used by the front end. All bits are really needed
109  /// so it is not possible to stash something in the low order bits.
110  void *FETokenInfo = nullptr;
111 };
112 
113 /// Contains the actual identifier that makes up the
114 /// name of a C++ literal operator.
115 class alignas(IdentifierInfoAlignment) CXXLiteralOperatorIdName
117  public llvm::FoldingSetNode {
120 
122 
123  /// Extra information associated with this operator name that
124  /// can be used by the front end. All bits are really needed
125  /// so it is not possible to stash something in the low order bits.
126  void *FETokenInfo;
127 
129  : DeclarationNameExtra(CXXLiteralOperatorName), ID(II),
130  FETokenInfo(nullptr) {}
131 
132 public:
133  void Profile(llvm::FoldingSetNodeID &FSID) { FSID.AddPointer(ID); }
134 };
135 
136 } // namespace detail
137 
138 /// The name of a declaration. In the common case, this just stores
139 /// an IdentifierInfo pointer to a normal name. However, it also provides
140 /// encodings for Objective-C selectors (optimizing zero- and one-argument
141 /// selectors, which make up 78% percent of all selectors in Cocoa.h),
142 /// special C++ names for constructors, destructors, and conversion functions,
143 /// and C++ overloaded operators.
145  friend class DeclarationNameTable;
146  friend class NamedDecl;
147 
148  /// StoredNameKind represent the kind of name that is actually stored in the
149  /// upper bits of the Ptr field. This is only used internally.
150  ///
151  /// NameKind, StoredNameKind, and DeclarationNameExtra::ExtraKind
152  /// must satisfy the following properties. These properties enable
153  /// efficient conversion between the various kinds.
154  ///
155  /// * The first seven enumerators of StoredNameKind must have the same
156  /// numerical value as the first seven enumerators of NameKind.
157  /// This enable efficient conversion between the two enumerations
158  /// in the usual case.
159  ///
160  /// * The enumerations values of DeclarationNameExtra::ExtraKind must start
161  /// at zero, and correspond to the numerical value of the first non-inline
162  /// enumeration values of NameKind minus an offset. This makes conversion
163  /// between DeclarationNameExtra::ExtraKind and NameKind possible with
164  /// a single addition/substraction.
165  ///
166  /// * The enumeration values of Selector::IdentifierInfoFlag must correspond
167  /// to the relevant enumeration values of StoredNameKind.
168  /// More specifically:
169  /// * ZeroArg == StoredObjCZeroArgSelector,
170  /// * OneArg == StoredObjCOneArgSelector,
171  /// * MultiArg == StoredDeclarationNameExtra
172  ///
173  /// * PtrMask must mask the low 3 bits of Ptr.
174  enum StoredNameKind {
175  StoredIdentifier = 0,
176  StoredObjCZeroArgSelector = Selector::ZeroArg,
177  StoredObjCOneArgSelector = Selector::OneArg,
178  StoredCXXConstructorName = 3,
179  StoredCXXDestructorName = 4,
180  StoredCXXConversionFunctionName = 5,
181  StoredCXXOperatorName = 6,
182  StoredDeclarationNameExtra = Selector::MultiArg,
183  PtrMask = 7,
184  UncommonNameKindOffset = 8
185  };
186 
187  static_assert(alignof(IdentifierInfo) >= 8 &&
188  alignof(detail::DeclarationNameExtra) >= 8 &&
189  alignof(detail::CXXSpecialNameExtra) >= 8 &&
190  alignof(detail::CXXOperatorIdName) >= 8 &&
191  alignof(detail::CXXDeductionGuideNameExtra) >= 8 &&
192  alignof(detail::CXXLiteralOperatorIdName) >= 8,
193  "The various classes that DeclarationName::Ptr can point to"
194  " must be at least aligned to 8 bytes!");
195 
196  static_assert(
197  std::is_same<std::underlying_type_t<StoredNameKind>,
198  std::underlying_type_t<
200  "The various enums used to compute values for NameKind should "
201  "all have the same underlying type");
202 
203 public:
204  /// The kind of the name stored in this DeclarationName.
205  /// The first 7 enumeration values are stored inline and correspond
206  /// to frequently used kinds. The rest is stored in DeclarationNameExtra
207  /// and correspond to infrequently used kinds.
208  enum NameKind {
209  Identifier = StoredIdentifier,
210  ObjCZeroArgSelector = StoredObjCZeroArgSelector,
211  ObjCOneArgSelector = StoredObjCOneArgSelector,
212  CXXConstructorName = StoredCXXConstructorName,
213  CXXDestructorName = StoredCXXDestructorName,
214  CXXConversionFunctionName = StoredCXXConversionFunctionName,
215  CXXOperatorName = StoredCXXOperatorName,
216  CXXDeductionGuideName = llvm::addEnumValues(
217  UncommonNameKindOffset,
219  CXXLiteralOperatorName = llvm::addEnumValues(
220  UncommonNameKindOffset,
222  CXXUsingDirective =
223  llvm::addEnumValues(UncommonNameKindOffset,
225  ObjCMultiArgSelector =
226  llvm::addEnumValues(UncommonNameKindOffset,
228  };
229 
230 private:
231  /// The lowest three bits of Ptr are used to express what kind of name
232  /// we're actually storing, using the values of StoredNameKind. Depending
233  /// on the kind of name this is, the upper bits of Ptr may have one
234  /// of several different meanings:
235  ///
236  /// StoredIdentifier - The name is a normal identifier, and Ptr is
237  /// a normal IdentifierInfo pointer.
238  ///
239  /// StoredObjCZeroArgSelector - The name is an Objective-C
240  /// selector with zero arguments, and Ptr is an IdentifierInfo
241  /// pointer pointing to the selector name.
242  ///
243  /// StoredObjCOneArgSelector - The name is an Objective-C selector
244  /// with one argument, and Ptr is an IdentifierInfo pointer
245  /// pointing to the selector name.
246  ///
247  /// StoredCXXConstructorName - The name of a C++ constructor,
248  /// Ptr points to a CXXSpecialNameExtra.
249  ///
250  /// StoredCXXDestructorName - The name of a C++ destructor,
251  /// Ptr points to a CXXSpecialNameExtra.
252  ///
253  /// StoredCXXConversionFunctionName - The name of a C++ conversion function,
254  /// Ptr points to a CXXSpecialNameExtra.
255  ///
256  /// StoredCXXOperatorName - The name of an overloaded C++ operator,
257  /// Ptr points to a CXXOperatorIdName.
258  ///
259  /// StoredDeclarationNameExtra - Ptr is actually a pointer to a
260  /// DeclarationNameExtra structure, whose first value will tell us
261  /// whether this is an Objective-C selector, C++ deduction guide,
262  /// C++ literal operator, or C++ using directive.
263  uintptr_t Ptr = 0;
264 
265  StoredNameKind getStoredNameKind() const {
266  return static_cast<StoredNameKind>(Ptr & PtrMask);
267  }
268 
269  void *getPtr() const { return reinterpret_cast<void *>(Ptr & ~PtrMask); }
270 
271  void setPtrAndKind(const void *P, StoredNameKind Kind) {
272  uintptr_t PAsInteger = reinterpret_cast<uintptr_t>(P);
273  assert((Kind & ~PtrMask) == 0 &&
274  "Invalid StoredNameKind in setPtrAndKind!");
275  assert((PAsInteger & PtrMask) == 0 &&
276  "Improperly aligned pointer in setPtrAndKind!");
277  Ptr = PAsInteger | Kind;
278  }
279 
280  /// Construct a declaration name from a DeclarationNameExtra.
281  DeclarationName(detail::DeclarationNameExtra *Name) {
282  setPtrAndKind(Name, StoredDeclarationNameExtra);
283  }
284 
285  /// Construct a declaration name from a CXXSpecialNameExtra.
286  DeclarationName(detail::CXXSpecialNameExtra *Name,
287  StoredNameKind StoredKind) {
288  assert((StoredKind == StoredCXXConstructorName ||
289  StoredKind == StoredCXXDestructorName ||
290  StoredKind == StoredCXXConversionFunctionName) &&
291  "Invalid StoredNameKind when constructing a DeclarationName"
292  " from a CXXSpecialNameExtra!");
293  setPtrAndKind(Name, StoredKind);
294  }
295 
296  /// Construct a DeclarationName from a CXXOperatorIdName.
297  DeclarationName(detail::CXXOperatorIdName *Name) {
298  setPtrAndKind(Name, StoredCXXOperatorName);
299  }
300 
301  /// Assert that the stored pointer points to an IdentifierInfo and return it.
302  IdentifierInfo *castAsIdentifierInfo() const {
303  assert((getStoredNameKind() == StoredIdentifier) &&
304  "DeclarationName does not store an IdentifierInfo!");
305  return static_cast<IdentifierInfo *>(getPtr());
306  }
307 
308  /// Assert that the stored pointer points to a DeclarationNameExtra
309  /// and return it.
310  detail::DeclarationNameExtra *castAsExtra() const {
311  assert((getStoredNameKind() == StoredDeclarationNameExtra) &&
312  "DeclarationName does not store an Extra structure!");
313  return static_cast<detail::DeclarationNameExtra *>(getPtr());
314  }
315 
316  /// Assert that the stored pointer points to a CXXSpecialNameExtra
317  /// and return it.
318  detail::CXXSpecialNameExtra *castAsCXXSpecialNameExtra() const {
319  assert((getStoredNameKind() == StoredCXXConstructorName ||
320  getStoredNameKind() == StoredCXXDestructorName ||
321  getStoredNameKind() == StoredCXXConversionFunctionName) &&
322  "DeclarationName does not store a CXXSpecialNameExtra!");
323  return static_cast<detail::CXXSpecialNameExtra *>(getPtr());
324  }
325 
326  /// Assert that the stored pointer points to a CXXOperatorIdName
327  /// and return it.
328  detail::CXXOperatorIdName *castAsCXXOperatorIdName() const {
329  assert((getStoredNameKind() == StoredCXXOperatorName) &&
330  "DeclarationName does not store a CXXOperatorIdName!");
331  return static_cast<detail::CXXOperatorIdName *>(getPtr());
332  }
333 
334  /// Assert that the stored pointer points to a CXXDeductionGuideNameExtra
335  /// and return it.
336  detail::CXXDeductionGuideNameExtra *castAsCXXDeductionGuideNameExtra() const {
337  assert(getNameKind() == CXXDeductionGuideName &&
338  "DeclarationName does not store a CXXDeductionGuideNameExtra!");
339  return static_cast<detail::CXXDeductionGuideNameExtra *>(getPtr());
340  }
341 
342  /// Assert that the stored pointer points to a CXXLiteralOperatorIdName
343  /// and return it.
344  detail::CXXLiteralOperatorIdName *castAsCXXLiteralOperatorIdName() const {
345  assert(getNameKind() == CXXLiteralOperatorName &&
346  "DeclarationName does not store a CXXLiteralOperatorIdName!");
347  return static_cast<detail::CXXLiteralOperatorIdName *>(getPtr());
348  }
349 
350  /// Get and set the FETokenInfo in the less common cases where the
351  /// declaration name do not point to an identifier.
352  void *getFETokenInfoSlow() const;
353  void setFETokenInfoSlow(void *T);
354 
355 public:
356  /// Construct an empty declaration name.
357  DeclarationName() { setPtrAndKind(nullptr, StoredIdentifier); }
358 
359  /// Construct a declaration name from an IdentifierInfo *.
361  setPtrAndKind(II, StoredIdentifier);
362  }
363 
364  /// Construct a declaration name from an Objective-C selector.
365  DeclarationName(Selector Sel) : Ptr(Sel.InfoPtr) {}
366 
367  /// Returns the name for all C++ using-directives.
369  // Single instance of DeclarationNameExtra for using-directive
370  static detail::DeclarationNameExtra UDirExtra(
372  return DeclarationName(&UDirExtra);
373  }
374 
375  /// Evaluates true when this declaration name is non-empty.
376  explicit operator bool() const {
377  return getPtr() || (getStoredNameKind() != StoredIdentifier);
378  }
379 
380  /// Evaluates true when this declaration name is empty.
381  bool isEmpty() const { return !*this; }
382 
383  /// Predicate functions for querying what type of name this is.
384  bool isIdentifier() const { return getStoredNameKind() == StoredIdentifier; }
385  bool isObjCZeroArgSelector() const {
386  return getStoredNameKind() == StoredObjCZeroArgSelector;
387  }
388  bool isObjCOneArgSelector() const {
389  return getStoredNameKind() == StoredObjCOneArgSelector;
390  }
391 
392  /// Determine what kind of name this is.
394  // We rely on the fact that the first 7 NameKind and StoredNameKind
395  // have the same numerical value. This makes the usual case efficient.
396  StoredNameKind StoredKind = getStoredNameKind();
397  if (StoredKind != StoredDeclarationNameExtra)
398  return static_cast<NameKind>(StoredKind);
399  // We have to consult DeclarationNameExtra. We rely on the fact that the
400  // enumeration values of ExtraKind correspond to the enumeration values of
401  // NameKind minus an offset of UncommonNameKindOffset.
402  unsigned ExtraKind = castAsExtra()->getKind();
403  return static_cast<NameKind>(UncommonNameKindOffset + ExtraKind);
404  }
405 
406  /// Determines whether the name itself is dependent, e.g., because it
407  /// involves a C++ type that is itself dependent.
408  ///
409  /// Note that this does not capture all of the notions of "dependent name",
410  /// because an identifier can be a dependent name if it is used as the
411  /// callee in a call expression with dependent arguments.
412  bool isDependentName() const;
413 
414  /// Retrieve the human-readable string for this name.
415  std::string getAsString() const;
416 
417  /// Retrieve the IdentifierInfo * stored in this declaration name,
418  /// or null if this declaration name isn't a simple identifier.
420  if (isIdentifier())
421  return castAsIdentifierInfo();
422  return nullptr;
423  }
424 
425  /// Get the representation of this declaration name as an opaque integer.
426  uintptr_t getAsOpaqueInteger() const { return Ptr; }
427 
428  /// Get the representation of this declaration name as an opaque pointer.
429  void *getAsOpaquePtr() const { return reinterpret_cast<void *>(Ptr); }
430 
431  /// Get a declaration name from an opaque pointer returned by getAsOpaquePtr.
433  DeclarationName N;
434  N.Ptr = reinterpret_cast<uintptr_t>(P);
435  return N;
436  }
437 
438  /// Get a declaration name from an opaque integer
439  /// returned by getAsOpaqueInteger.
441  DeclarationName N;
442  N.Ptr = P;
443  return N;
444  }
445 
446  /// If this name is one of the C++ names (of a constructor, destructor,
447  /// or conversion function), return the type associated with that name.
449  if (getStoredNameKind() == StoredCXXConstructorName ||
450  getStoredNameKind() == StoredCXXDestructorName ||
451  getStoredNameKind() == StoredCXXConversionFunctionName) {
452  assert(getPtr() && "getCXXNameType on a null DeclarationName!");
453  return castAsCXXSpecialNameExtra()->Type;
454  }
455  return QualType();
456  }
457 
458  /// If this name is the name of a C++ deduction guide, return the
459  /// template associated with that name.
461  if (getNameKind() == CXXDeductionGuideName) {
462  assert(getPtr() &&
463  "getCXXDeductionGuideTemplate on a null DeclarationName!");
464  return castAsCXXDeductionGuideNameExtra()->Template;
465  }
466  return nullptr;
467  }
468 
469  /// If this name is the name of an overloadable operator in C++
470  /// (e.g., @c operator+), retrieve the kind of overloaded operator.
472  if (getStoredNameKind() == StoredCXXOperatorName) {
473  assert(getPtr() && "getCXXOverloadedOperator on a null DeclarationName!");
474  return castAsCXXOperatorIdName()->Kind;
475  }
476  return OO_None;
477  }
478 
479  /// If this name is the name of a literal operator,
480  /// retrieve the identifier associated with it.
482  if (getNameKind() == CXXLiteralOperatorName) {
483  assert(getPtr() && "getCXXLiteralIdentifier on a null DeclarationName!");
484  return castAsCXXLiteralOperatorIdName()->ID;
485  }
486  return nullptr;
487  }
488 
489  /// Get the Objective-C selector stored in this declaration name.
491  assert((getNameKind() == ObjCZeroArgSelector ||
492  getNameKind() == ObjCOneArgSelector ||
493  getNameKind() == ObjCMultiArgSelector || !getPtr()) &&
494  "Not a selector!");
495  return Selector(Ptr);
496  }
497 
498  /// Get and set FETokenInfo. The language front-end is allowed to associate
499  /// arbitrary metadata with some kinds of declaration names, including normal
500  /// identifiers and C++ constructors, destructors, and conversion functions.
501  void *getFETokenInfo() const {
502  assert(getPtr() && "getFETokenInfo on an empty DeclarationName!");
503  if (getStoredNameKind() == StoredIdentifier)
504  return castAsIdentifierInfo()->getFETokenInfo();
505  return getFETokenInfoSlow();
506  }
507 
508  void setFETokenInfo(void *T) {
509  assert(getPtr() && "setFETokenInfo on an empty DeclarationName!");
510  if (getStoredNameKind() == StoredIdentifier)
511  castAsIdentifierInfo()->setFETokenInfo(T);
512  else
513  setFETokenInfoSlow(T);
514  }
515 
516  /// Determine whether the specified names are identical.
518  return LHS.Ptr == RHS.Ptr;
519  }
520 
521  /// Determine whether the specified names are different.
523  return LHS.Ptr != RHS.Ptr;
524  }
525 
527  DeclarationName Name;
528  Name.Ptr = uintptr_t(-1);
529  return Name;
530  }
531 
533  DeclarationName Name;
534  Name.Ptr = uintptr_t(-2);
535  return Name;
536  }
537 
538  static int compare(DeclarationName LHS, DeclarationName RHS);
539 
540  void print(raw_ostream &OS, const PrintingPolicy &Policy) const;
541 
542  void dump() const;
543 };
544 
545 raw_ostream &operator<<(raw_ostream &OS, DeclarationName N);
546 
547 /// Ordering on two declaration names. If both names are identifiers,
548 /// this provides a lexicographical ordering.
550  return DeclarationName::compare(LHS, RHS) < 0;
551 }
552 
553 /// Ordering on two declaration names. If both names are identifiers,
554 /// this provides a lexicographical ordering.
556  return DeclarationName::compare(LHS, RHS) > 0;
557 }
558 
559 /// Ordering on two declaration names. If both names are identifiers,
560 /// this provides a lexicographical ordering.
562  return DeclarationName::compare(LHS, RHS) <= 0;
563 }
564 
565 /// Ordering on two declaration names. If both names are identifiers,
566 /// this provides a lexicographical ordering.
568  return DeclarationName::compare(LHS, RHS) >= 0;
569 }
570 
571 /// DeclarationNameTable is used to store and retrieve DeclarationName
572 /// instances for the various kinds of declaration names, e.g., normal
573 /// identifiers, C++ constructor names, etc. This class contains
574 /// uniqued versions of each of the C++ special names, which can be
575 /// retrieved using its member functions (e.g., getCXXConstructorName).
577  /// Used to allocate elements in the FoldingSets below.
578  const ASTContext &Ctx;
579 
580  /// Manage the uniqued CXXSpecialNameExtra representing C++ constructors.
581  /// getCXXConstructorName and getCXXSpecialName can be used to obtain
582  /// a DeclarationName from the corresponding type of the constructor.
583  llvm::FoldingSet<detail::CXXSpecialNameExtra> CXXConstructorNames;
584 
585  /// Manage the uniqued CXXSpecialNameExtra representing C++ destructors.
586  /// getCXXDestructorName and getCXXSpecialName can be used to obtain
587  /// a DeclarationName from the corresponding type of the destructor.
588  llvm::FoldingSet<detail::CXXSpecialNameExtra> CXXDestructorNames;
589 
590  /// Manage the uniqued CXXSpecialNameExtra representing C++ conversion
591  /// functions. getCXXConversionFunctionName and getCXXSpecialName can be
592  /// used to obtain a DeclarationName from the corresponding type of the
593  /// conversion function.
594  llvm::FoldingSet<detail::CXXSpecialNameExtra> CXXConversionFunctionNames;
595 
596  /// Manage the uniqued CXXOperatorIdName, which contain extra information
597  /// for the name of overloaded C++ operators. getCXXOperatorName
598  /// can be used to obtain a DeclarationName from the operator kind.
600 
601  /// Manage the uniqued CXXLiteralOperatorIdName, which contain extra
602  /// information for the name of C++ literal operators.
603  /// getCXXLiteralOperatorName can be used to obtain a DeclarationName
604  /// from the corresponding IdentifierInfo.
605  llvm::FoldingSet<detail::CXXLiteralOperatorIdName> CXXLiteralOperatorNames;
606 
607  /// Manage the uniqued CXXDeductionGuideNameExtra, which contain
608  /// extra information for the name of a C++ deduction guide.
609  /// getCXXDeductionGuideName can be used to obtain a DeclarationName
610  /// from the corresponding template declaration.
611  llvm::FoldingSet<detail::CXXDeductionGuideNameExtra> CXXDeductionGuideNames;
612 
613 public:
615  DeclarationNameTable(const DeclarationNameTable &) = delete;
616  DeclarationNameTable &operator=(const DeclarationNameTable &) = delete;
618  DeclarationNameTable &operator=(DeclarationNameTable &&) = delete;
619  ~DeclarationNameTable() = default;
620 
621  /// Create a declaration name that is a simple identifier.
623  return DeclarationName(ID);
624  }
625 
626  /// Returns the name of a C++ constructor for the given Type.
627  DeclarationName getCXXConstructorName(CanQualType Ty);
628 
629  /// Returns the name of a C++ destructor for the given Type.
630  DeclarationName getCXXDestructorName(CanQualType Ty);
631 
632  /// Returns the name of a C++ deduction guide for the given template.
633  DeclarationName getCXXDeductionGuideName(TemplateDecl *TD);
634 
635  /// Returns the name of a C++ conversion function for the given Type.
636  DeclarationName getCXXConversionFunctionName(CanQualType Ty);
637 
638  /// Returns a declaration name for special kind of C++ name,
639  /// e.g., for a constructor, destructor, or conversion function.
640  /// Kind must be one of:
641  /// * DeclarationName::CXXConstructorName,
642  /// * DeclarationName::CXXDestructorName or
643  /// * DeclarationName::CXXConversionFunctionName
645  CanQualType Ty);
646 
647  /// Get the name of the overloadable C++ operator corresponding to Op.
649  return DeclarationName(&CXXOperatorNames[Op]);
650  }
651 
652  /// Get the name of the literal operator function with II as the identifier.
653  DeclarationName getCXXLiteralOperatorName(IdentifierInfo *II);
654 };
655 
656 /// DeclarationNameLoc - Additional source/type location info
657 /// for a declaration name. Needs a DeclarationName in order
658 /// to be interpreted correctly.
660  // The source location for identifier stored elsewhere.
661  // struct {} Identifier;
662 
663  // Type info for constructors, destructors and conversion functions.
664  // Locations (if any) for the tilde (destructor) or operator keyword
665  // (conversion) are stored elsewhere.
666  struct NT {
667  TypeSourceInfo *TInfo;
668  };
669 
670  // The location (if any) of the operator keyword is stored elsewhere.
671  struct CXXOpName {
672  SourceLocation::UIntTy BeginOpNameLoc;
673  SourceLocation::UIntTy EndOpNameLoc;
674  };
675 
676  // The location (if any) of the operator keyword is stored elsewhere.
677  struct CXXLitOpName {
678  SourceLocation::UIntTy OpNameLoc;
679  };
680 
681  // struct {} CXXUsingDirective;
682  // struct {} ObjCZeroArgSelector;
683  // struct {} ObjCOneArgSelector;
684  // struct {} ObjCMultiArgSelector;
685  union {
686  struct NT NamedType;
687  struct CXXOpName CXXOperatorName;
688  struct CXXLitOpName CXXLiteralOperatorName;
689  };
690 
691  void setNamedTypeLoc(TypeSourceInfo *TInfo) { NamedType.TInfo = TInfo; }
692 
693  void setCXXOperatorNameRange(SourceRange Range) {
694  CXXOperatorName.BeginOpNameLoc = Range.getBegin().getRawEncoding();
695  CXXOperatorName.EndOpNameLoc = Range.getEnd().getRawEncoding();
696  }
697 
698  void setCXXLiteralOperatorNameLoc(SourceLocation Loc) {
699  CXXLiteralOperatorName.OpNameLoc = Loc.getRawEncoding();
700  }
701 
702 public:
703  DeclarationNameLoc(DeclarationName Name);
704  // FIXME: this should go away once all DNLocs are properly initialized.
705  DeclarationNameLoc() { memset((void*) this, 0, sizeof(*this)); }
706 
707  /// Returns the source type info. Assumes that the object stores location
708  /// information of a constructor, destructor or conversion operator.
709  TypeSourceInfo *getNamedTypeInfo() const { return NamedType.TInfo; }
710 
711  /// Return the beginning location of the getCXXOperatorNameRange() range.
713  return SourceLocation::getFromRawEncoding(CXXOperatorName.BeginOpNameLoc);
714  }
715 
716  /// Return the end location of the getCXXOperatorNameRange() range.
718  return SourceLocation::getFromRawEncoding(CXXOperatorName.EndOpNameLoc);
719  }
720 
721  /// Return the range of the operator name (without the operator keyword).
722  /// Assumes that the object stores location information of a (non-literal)
723  /// operator.
725  return SourceRange(getCXXOperatorNameBeginLoc(),
726  getCXXOperatorNameEndLoc());
727  }
728 
729  /// Return the location of the literal operator name (without the operator
730  /// keyword). Assumes that the object stores location information of a literal
731  /// operator.
733  return SourceLocation::getFromRawEncoding(CXXLiteralOperatorName.OpNameLoc);
734  }
735 
736  /// Construct location information for a constructor, destructor or conversion
737  /// operator.
739  DeclarationNameLoc DNL;
740  DNL.setNamedTypeLoc(TInfo);
741  return DNL;
742  }
743 
744  /// Construct location information for a non-literal C++ operator.
746  SourceLocation EndLoc) {
747  return makeCXXOperatorNameLoc(SourceRange(BeginLoc, EndLoc));
748  }
749 
750  /// Construct location information for a non-literal C++ operator.
752  DeclarationNameLoc DNL;
753  DNL.setCXXOperatorNameRange(Range);
754  return DNL;
755  }
756 
757  /// Construct location information for a literal C++ operator.
759  DeclarationNameLoc DNL;
760  DNL.setCXXLiteralOperatorNameLoc(Loc);
761  return DNL;
762  }
763 };
764 
765 /// DeclarationNameInfo - A collector data type for bundling together
766 /// a DeclarationName and the correspnding source/type location info.
768 private:
769  /// Name - The declaration name, also encoding name kind.
770  DeclarationName Name;
771 
772  /// Loc - The main source location for the declaration name.
773  SourceLocation NameLoc;
774 
775  /// Info - Further source/type location info for special kinds of names.
776  DeclarationNameLoc LocInfo;
777 
778 public:
779  // FIXME: remove it.
780  DeclarationNameInfo() = default;
781 
783  : Name(Name), NameLoc(NameLoc), LocInfo(Name) {}
784 
786  DeclarationNameLoc LocInfo)
787  : Name(Name), NameLoc(NameLoc), LocInfo(LocInfo) {}
788 
789  /// getName - Returns the embedded declaration name.
790  DeclarationName getName() const { return Name; }
791 
792  /// setName - Sets the embedded declaration name.
793  void setName(DeclarationName N) { Name = N; }
794 
795  /// getLoc - Returns the main location of the declaration name.
796  SourceLocation getLoc() const { return NameLoc; }
797 
798  /// setLoc - Sets the main location of the declaration name.
799  void setLoc(SourceLocation L) { NameLoc = L; }
800 
801  const DeclarationNameLoc &getInfo() const { return LocInfo; }
802  void setInfo(const DeclarationNameLoc &Info) { LocInfo = Info; }
803 
804  /// getNamedTypeInfo - Returns the source type info associated to
805  /// the name. Assumes it is a constructor, destructor or conversion.
807  if (Name.getNameKind() != DeclarationName::CXXConstructorName &&
808  Name.getNameKind() != DeclarationName::CXXDestructorName &&
809  Name.getNameKind() != DeclarationName::CXXConversionFunctionName)
810  return nullptr;
811  return LocInfo.getNamedTypeInfo();
812  }
813 
814  /// setNamedTypeInfo - Sets the source type info associated to
815  /// the name. Assumes it is a constructor, destructor or conversion.
817  assert(Name.getNameKind() == DeclarationName::CXXConstructorName ||
818  Name.getNameKind() == DeclarationName::CXXDestructorName ||
819  Name.getNameKind() == DeclarationName::CXXConversionFunctionName);
820  LocInfo = DeclarationNameLoc::makeNamedTypeLoc(TInfo);
821  }
822 
823  /// getCXXOperatorNameRange - Gets the range of the operator name
824  /// (without the operator keyword). Assumes it is a (non-literal) operator.
826  if (Name.getNameKind() != DeclarationName::CXXOperatorName)
827  return SourceRange();
828  return LocInfo.getCXXOperatorNameRange();
829  }
830 
831  /// setCXXOperatorNameRange - Sets the range of the operator name
832  /// (without the operator keyword). Assumes it is a C++ operator.
834  assert(Name.getNameKind() == DeclarationName::CXXOperatorName);
836  }
837 
838  /// getCXXLiteralOperatorNameLoc - Returns the location of the literal
839  /// operator name (not the operator keyword).
840  /// Assumes it is a literal operator.
842  if (Name.getNameKind() != DeclarationName::CXXLiteralOperatorName)
843  return SourceLocation();
844  return LocInfo.getCXXLiteralOperatorNameLoc();
845  }
846 
847  /// setCXXLiteralOperatorNameLoc - Sets the location of the literal
848  /// operator name (not the operator keyword).
849  /// Assumes it is a literal operator.
851  assert(Name.getNameKind() == DeclarationName::CXXLiteralOperatorName);
853  }
854 
855  /// Determine whether this name involves a template parameter.
856  bool isInstantiationDependent() const;
857 
858  /// Determine whether this name contains an unexpanded
859  /// parameter pack.
860  bool containsUnexpandedParameterPack() const;
861 
862  /// getAsString - Retrieve the human-readable string for this name.
863  std::string getAsString() const;
864 
865  /// printName - Print the human-readable name to a stream.
866  void printName(raw_ostream &OS, PrintingPolicy Policy) const;
867 
868  /// getBeginLoc - Retrieve the location of the first token.
869  SourceLocation getBeginLoc() const { return NameLoc; }
870 
871  /// getSourceRange - The range of the declaration name.
872  SourceRange getSourceRange() const LLVM_READONLY {
873  return SourceRange(getBeginLoc(), getEndLoc());
874  }
875 
876  SourceLocation getEndLoc() const LLVM_READONLY {
877  SourceLocation EndLoc = getEndLocPrivate();
878  return EndLoc.isValid() ? EndLoc : getBeginLoc();
879  }
880 
881 private:
882  SourceLocation getEndLocPrivate() const;
883 };
884 
885 /// Insertion operator for partial diagnostics. This allows binding
886 /// DeclarationName's into a partial diagnostic with <<.
888  DeclarationName N) {
891  return PD;
892 }
893 
894 raw_ostream &operator<<(raw_ostream &OS, DeclarationNameInfo DNInfo);
895 
896 } // namespace clang
897 
898 namespace llvm {
899 
900 /// Define DenseMapInfo so that DeclarationNames can be used as keys
901 /// in DenseMap and DenseSets.
902 template<>
903 struct DenseMapInfo<clang::DeclarationName> {
906  }
907 
910  }
911 
912  static unsigned getHashValue(clang::DeclarationName Name) {
913  return DenseMapInfo<void*>::getHashValue(Name.getAsOpaquePtr());
914  }
915 
916  static inline bool
918  return LHS == RHS;
919  }
920 };
921 
922 template <> struct PointerLikeTypeTraits<clang::DeclarationName> {
924  return P.getAsOpaquePtr();
925  }
928  }
929  static constexpr int NumLowBitsAvailable = 0;
930 };
931 
932 } // namespace llvm
933 
934 // The definition of AssumedTemplateStorage is factored out of TemplateName to
935 // resolve a cyclic dependency between it and DeclarationName (via Type).
936 namespace clang {
937 
938 /// A structure for storing the information associated with a name that has
939 /// been assumed to be a template name (despite finding no TemplateDecls).
941  friend class ASTContext;
942 
944  : UncommonTemplateNameStorage(Assumed, 0), Name(Name) {}
945  DeclarationName Name;
946 
947 public:
948  /// Get the name of the template.
949  DeclarationName getDeclName() const { return Name; }
950 };
951 
952 } // namespace clang
953 
954 #endif // LLVM_CLANG_AST_DECLARATIONNAME_H
clang::DeclarationNameLoc::makeCXXOperatorNameLoc
static DeclarationNameLoc makeCXXOperatorNameLoc(SourceLocation BeginLoc, SourceLocation EndLoc)
Construct location information for a non-literal C++ operator.
Definition: DeclarationName.h:745
clang::DeclarationNameInfo::setCXXLiteralOperatorNameLoc
void setCXXLiteralOperatorNameLoc(SourceLocation Loc)
setCXXLiteralOperatorNameLoc - Sets the location of the literal operator name (not the operator keywo...
Definition: DeclarationName.h:850
clang::DeclarationNameInfo::getInfo
const DeclarationNameLoc & getInfo() const
Definition: DeclarationName.h:801
clang::DeclarationNameLoc::getCXXOperatorNameEndLoc
SourceLocation getCXXOperatorNameEndLoc() const
Return the end location of the getCXXOperatorNameRange() range.
Definition: DeclarationName.h:717
clang::detail::CXXSpecialNameExtra::Profile
void Profile(llvm::FoldingSetNodeID &ID)
Definition: DeclarationName.h:68
clang::detail::DeclarationNameExtra::CXXUsingDirective
@ CXXUsingDirective
Definition: IdentifierTable.h:965
llvm
YAML serialization mapping.
Definition: Dominators.h:30
clang::DeclarationName::getAsOpaquePtr
void * getAsOpaquePtr() const
Get the representation of this declaration name as an opaque pointer.
Definition: DeclarationName.h:429
clang::DeclarationName::DeclarationName
DeclarationName(Selector Sel)
Construct a declaration name from an Objective-C selector.
Definition: DeclarationName.h:365
clang::DeclarationName::CXXLiteralOperatorName
@ CXXLiteralOperatorName
Definition: DeclarationName.h:219
clang::DeclarationNameLoc
DeclarationNameLoc - Additional source/type location info for a declaration name.
Definition: DeclarationName.h:659
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
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:212
clang::DeclarationNameLoc::getCXXOperatorNameBeginLoc
SourceLocation getCXXOperatorNameBeginLoc() const
Return the beginning location of the getCXXOperatorNameRange() range.
Definition: DeclarationName.h:712
clang::DeclarationName::operator==
friend bool operator==(DeclarationName LHS, DeclarationName RHS)
Determine whether the specified names are identical.
Definition: DeclarationName.h:517
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::NamedDecl
This represents a decl that may have a name.
Definition: Decl.h:247
clang::DeclarationNameLoc::makeCXXOperatorNameLoc
static DeclarationNameLoc makeCXXOperatorNameLoc(SourceRange Range)
Construct location information for a non-literal C++ operator.
Definition: DeclarationName.h:751
clang::QualType
A (possibly-)qualified type.
Definition: Type.h:731
clang::DeclarationName::isObjCZeroArgSelector
bool isObjCZeroArgSelector() const
Definition: DeclarationName.h:385
clang::DeclarationNameInfo::getEndLoc
SourceLocation getEndLoc() const LLVM_READONLY
Definition: DeclarationName.h:876
clang::DeclarationName::getAsOpaqueInteger
uintptr_t getAsOpaqueInteger() const
Get the representation of this declaration name as an opaque integer.
Definition: DeclarationName.h:426
clang::detail::DeclarationNameExtra::ObjCMultiArgSelector
@ ObjCMultiArgSelector
Definition: IdentifierTable.h:966
clang::DeclarationNameInfo::setCXXOperatorNameRange
void setCXXOperatorNameRange(SourceRange R)
setCXXOperatorNameRange - Sets the range of the operator name (without the operator keyword).
Definition: DeclarationName.h:833
clang::DeclarationName::getTombstoneMarker
static DeclarationName getTombstoneMarker()
Definition: DeclarationName.h:532
clang::DeclarationNameInfo::getCXXOperatorNameRange
SourceRange getCXXOperatorNameRange() const
getCXXOperatorNameRange - Gets the range of the operator name (without the operator keyword).
Definition: DeclarationName.h:825
clang::PrintingPolicy
Describes how types, statements, expressions, and declarations should be printed.
Definition: PrettyPrinter.h:57
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:419
print
void print(llvm::raw_ostream &OS, const Pointer &P, ASTContext &Ctx, QualType Ty)
Definition: InterpFrame.cpp:62
Identifier
StringRef Identifier
Definition: Format.cpp:2580
llvm::PointerLikeTypeTraits< clang::DeclarationName >::getAsVoidPointer
static void * getAsVoidPointer(clang::DeclarationName P)
Definition: DeclarationName.h:923
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:460
clang::DeclarationName
The name of a declaration.
Definition: DeclarationName.h:144
clang::DeclarationNameLoc::getNamedTypeInfo
TypeSourceInfo * getNamedTypeInfo() const
Returns the source type info.
Definition: DeclarationName.h:709
clang::StreamingDiagnostic::AddTaggedVal
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
Definition: Diagnostic.h:1184
clang::Type
The base class of the type hierarchy.
Definition: Type.h:1556
clang::detail::CXXDeductionGuideNameExtra::Profile
void Profile(llvm::FoldingSetNodeID &ID)
Definition: DeclarationName.h:93
llvm::DenseMapInfo< clang::DeclarationName >::isEqual
static bool isEqual(clang::DeclarationName LHS, clang::DeclarationName RHS)
Definition: DeclarationName.h:917
clang::DeclarationNameLoc::makeNamedTypeLoc
static DeclarationNameLoc makeNamedTypeLoc(TypeSourceInfo *TInfo)
Construct location information for a constructor, destructor or conversion operator.
Definition: DeclarationName.h:738
clang::DeclarationName::getFromOpaquePtr
static DeclarationName getFromOpaquePtr(void *P)
Get a declaration name from an opaque pointer returned by getAsOpaquePtr.
Definition: DeclarationName.h:432
clang::DeclarationName::compare
static int compare(DeclarationName LHS, DeclarationName RHS)
Definition: DeclarationName.cpp:46
clang::getAsString
llvm::StringRef getAsString(SyncScope S)
Definition: SyncScope.h:55
clang::operator>
bool operator>(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
Definition: DeclarationName.h:555
clang::DeclarationName::getObjCSelector
Selector getObjCSelector() const
Get the Objective-C selector stored in this declaration name.
Definition: DeclarationName.h:490
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:471
compare
static bool compare(const PathDiagnostic &X, const PathDiagnostic &Y)
Definition: PathDiagnostic.cpp:351
OperatorKinds.h
clang::DeclarationName::CXXDestructorName
@ CXXDestructorName
Definition: DeclarationName.h:213
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:208
clang::StreamingDiagnostic
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
Definition: Diagnostic.h:1110
clang::DeclarationNameTable::getCXXOperatorName
DeclarationName getCXXOperatorName(OverloadedOperatorKind Op)
Get the name of the overloadable C++ operator corresponding to Op.
Definition: DeclarationName.h:648
Diagnostic.h
clang::DeclarationNameLoc::getCXXLiteralOperatorNameLoc
SourceLocation getCXXLiteralOperatorNameLoc() const
Return the location of the literal operator name (without the operator keyword).
Definition: DeclarationName.h:732
clang::detail::DeclarationNameExtra
DeclarationNameExtra is used as a base of various uncommon special names.
Definition: IdentifierTable.h:952
clang::DeclarationName::CXXOperatorName
@ CXXOperatorName
Definition: DeclarationName.h:215
clang::DeclarationNameInfo::getNamedTypeInfo
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
Definition: DeclarationName.h:806
clang::DeclarationNameInfo::setName
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
Definition: DeclarationName.h:793
clang::CanQualType
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
Definition: CanonicalType.h:212
clang::detail::DeclarationNameExtra::CXXLiteralOperatorName
@ CXXLiteralOperatorName
Definition: IdentifierTable.h:964
uintptr_t
__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-base.h:140
IdentifierTable.h
clang::AssumedTemplateStorage::getDeclName
DeclarationName getDeclName() const
Get the name of the template.
Definition: DeclarationName.h:949
llvm::PointerLikeTypeTraits< clang::DeclarationName >::getFromVoidPointer
static clang::DeclarationName getFromVoidPointer(void *P)
Definition: DeclarationName.h:926
Type.h
bool
#define bool
Definition: stdbool.h:20
clang::DeclarationName::operator!=
friend bool operator!=(DeclarationName LHS, DeclarationName RHS)
Determine whether the specified names are different.
Definition: DeclarationName.h:522
clang::NUM_OVERLOADED_OPERATORS
@ NUM_OVERLOADED_OPERATORS
Definition: OperatorKinds.h:26
clang::DeclarationNameLoc::DeclarationNameLoc
DeclarationNameLoc()
Definition: DeclarationName.h:705
clang::detail::CXXLiteralOperatorIdName::Profile
void Profile(llvm::FoldingSetNodeID &FSID)
Definition: DeclarationName.h:133
clang::CanQual< Type >
clang::operator<<
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
Definition: ASTContext.cpp:12325
clang::detail::CXXDeductionGuideNameExtra
Contains extra information for the name of a C++ deduction guide.
Definition: DeclarationName.h:74
clang::OverloadedOperatorKind
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:21
clang::DeclarationNameInfo::getName
DeclarationName getName() const
getName - Returns the embedded declaration name.
Definition: DeclarationName.h:790
clang::UncommonTemplateNameStorage
Implementation class used to describe either a set of overloaded template names or an already-substit...
Definition: TemplateName.h:47
clang::DeclarationName::CXXConversionFunctionName
@ CXXConversionFunctionName
Definition: DeclarationName.h:214
clang::DiagnosticsEngine::ak_declarationname
@ ak_declarationname
DeclarationName.
Definition: Diagnostic.h:233
SourceLocation.h
clang::OO_None
@ OO_None
Not an overloaded operator.
Definition: OperatorKinds.h:22
P
StringRef P
Definition: ASTMatchersInternal.cpp:563
clang::operator<=
bool operator<=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
Definition: DeclarationName.h:561
clang::DeclarationName::getFromOpaqueInteger
static DeclarationName getFromOpaqueInteger(uintptr_t P)
Get a declaration name from an opaque integer returned by getAsOpaqueInteger.
Definition: DeclarationName.h:440
clang::detail::DeclarationNameExtra::CXXDeductionGuideName
@ CXXDeductionGuideName
Definition: IdentifierTable.h:963
dump
static void dump(llvm::raw_ostream &OS, StringRef FunctionName, ArrayRef< CounterExpression > Expressions, ArrayRef< CounterMappingRegion > Regions)
Definition: CoverageMappingGen.cpp:1533
clang::TemplateDecl
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:400
clang::DeclarationName::isIdentifier
bool isIdentifier() const
Predicate functions for querying what type of name this is.
Definition: DeclarationName.h:384
clang::detail::CXXOperatorIdName
Contains extra information for the name of an overloaded operator in C++, such as "operator+.
Definition: DeclarationName.h:100
clang::DeclarationNameInfo::setNamedTypeInfo
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
Definition: DeclarationName.h:816
clang::detail::CXXSpecialNameExtra
CXXSpecialNameExtra records the type associated with one of the "special" kinds of declaration names ...
Definition: DeclarationName.h:52
clang::DeclarationName::getFETokenInfo
void * getFETokenInfo() const
Get and set FETokenInfo.
Definition: DeclarationName.h:501
clang::DeclarationNameInfo::getCXXLiteralOperatorNameLoc
SourceLocation getCXXLiteralOperatorNameLoc() const
getCXXLiteralOperatorNameLoc - Returns the location of the literal operator name (not the operator ke...
Definition: DeclarationName.h:841
clang::DeclarationName::NameKind
NameKind
The kind of the name stored in this DeclarationName.
Definition: DeclarationName.h:208
clang::DeclarationName::getEmptyMarker
static DeclarationName getEmptyMarker()
Definition: DeclarationName.h:526
clang::DeclarationName::DeclarationName
DeclarationName(const IdentifierInfo *II)
Construct a declaration name from an IdentifierInfo *.
Definition: DeclarationName.h:360
clang::detail::DeclarationNameExtra::ExtraKind
ExtraKind
The kind of "extra" information stored in the DeclarationName.
Definition: IdentifierTable.h:962
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:84
clang::SourceLocation::getFromRawEncoding
static SourceLocation getFromRawEncoding(UIntTy Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
Definition: SourceLocation.h:152
clang::DeclarationNameTable::getIdentifier
DeclarationName getIdentifier(const IdentifierInfo *ID)
Create a declaration name that is a simple identifier.
Definition: DeclarationName.h:622
clang::DeclarationNameInfo::DeclarationNameInfo
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc)
Definition: DeclarationName.h:782
clang::ObjCPropertyAttribute::Kind
Kind
Definition: DeclObjCCommon.h:22
clang::DeclarationNameLoc::makeCXXLiteralOperatorNameLoc
static DeclarationNameLoc makeCXXLiteralOperatorNameLoc(SourceLocation Loc)
Construct location information for a literal C++ operator.
Definition: DeclarationName.h:758
clang::DeclarationName::getNameKind
NameKind getNameKind() const
Determine what kind of name this is.
Definition: DeclarationName.h:393
clang::Builtin::ID
ID
Definition: Builtins.h:52
PartialDiagnostic.h
clang
Definition: CalledOnceCheck.h:17
memset
__DEVICE__ void * memset(void *__a, int __b, size_t __c)
Definition: __clang_cuda_device_functions.h:1552
clang::DeclarationNameInfo::setLoc
void setLoc(SourceLocation L)
setLoc - Sets the main location of the declaration name.
Definition: DeclarationName.h:799
clang::Selector
Smart pointer class that efficiently represents Objective-C method names.
Definition: IdentifierTable.h:752
clang::operator<
bool operator<(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
Definition: DeclarationName.h:549
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:110
clang::TypeSourceInfo
A container of type source information.
Definition: Type.h:6530
llvm::DenseMapInfo< clang::DeclarationName >::getHashValue
static unsigned getHashValue(clang::DeclarationName Name)
Definition: DeclarationName.h:912
clang::DeclarationNameLoc::getCXXOperatorNameRange
SourceRange getCXXOperatorNameRange() const
Return the range of the operator name (without the operator keyword).
Definition: DeclarationName.h:724
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:481
clang::DeclarationNameInfo::getSourceRange
SourceRange getSourceRange() const LLVM_READONLY
getSourceRange - The range of the declaration name.
Definition: DeclarationName.h:872
llvm::PointerLikeTypeTraits
Definition: DeclGroup.h:139
clang::DeclarationNameInfo::DeclarationNameInfo
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc, DeclarationNameLoc LocInfo)
Definition: DeclarationName.h:785
llvm::DenseMapInfo< clang::DeclarationName >::getEmptyKey
static clang::DeclarationName getEmptyKey()
Definition: DeclarationName.h:904
clang::AssumedTemplateStorage
A structure for storing the information associated with a name that has been assumed to be a template...
Definition: DeclarationName.h:940
clang::detail::CXXLiteralOperatorIdName
Contains the actual identifier that makes up the name of a C++ literal operator.
Definition: DeclarationName.h:115
clang::DeclarationName::isEmpty
bool isEmpty() const
Evaluates true when this declaration name is empty.
Definition: DeclarationName.h:381
clang::operator>=
bool operator>=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
Definition: DeclarationName.h:567
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:448
clang::DeclarationNameInfo::getLoc
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
Definition: DeclarationName.h:796
clang::DeclarationNameInfo
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
Definition: DeclarationName.h:767
clang::DeclarationName::DeclarationName
DeclarationName()
Construct an empty declaration name.
Definition: DeclarationName.h:357
clang::DeclarationNameInfo::setInfo
void setInfo(const DeclarationNameLoc &Info)
Definition: DeclarationName.h:802
clang::DeclarationNameInfo::getBeginLoc
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
Definition: DeclarationName.h:869
clang::DeclarationName::setFETokenInfo
void setFETokenInfo(void *T)
Definition: DeclarationName.h:508
clang::SourceLocation::UIntTy
uint32_t UIntTy
Definition: SourceLocation.h:93
clang::DeclarationNameTable
DeclarationNameTable is used to store and retrieve DeclarationName instances for the various kinds of...
Definition: DeclarationName.h:576
llvm::DenseMapInfo< clang::DeclarationName >::getTombstoneKey
static clang::DeclarationName getTombstoneKey()
Definition: DeclarationName.h:908
clang::DeclarationName::isObjCOneArgSelector
bool isObjCOneArgSelector() const
Definition: DeclarationName.h:388
clang::DeclarationName::getUsingDirectiveName
static DeclarationName getUsingDirectiveName()
Returns the name for all C++ using-directives.
Definition: DeclarationName.h:368