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