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