clang  8.0.0svn
DeclarationName.h
Go to the documentation of this file.
1 //===- DeclarationName.h - Representation of declaration names --*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the DeclarationName and DeclarationNameTable classes.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_AST_DECLARATIONNAME_H
15 #define LLVM_CLANG_AST_DECLARATIONNAME_H
16 
17 #include "clang/AST/Type.h"
18 #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 CXXDeductionGuideNameExtra;
36 class CXXLiteralOperatorIdName;
37 class CXXOperatorIdName;
38 class CXXSpecialName;
39 class DeclarationNameExtra;
40 class IdentifierInfo;
41 class MultiKeywordSelector;
42 enum OverloadedOperatorKind : int;
43 struct PrintingPolicy;
44 class TemplateDecl;
45 class TypeSourceInfo;
46 class UsingDirectiveDecl;
47 
48 using CanQualType = CanQual<Type>;
49 
50 /// DeclarationName - The name of a declaration. In the common case,
51 /// this just stores an IdentifierInfo pointer to a normal
52 /// name. However, it also provides encodings for Objective-C
53 /// selectors (optimizing zero- and one-argument selectors, which make
54 /// up 78% percent of all selectors in Cocoa.h) and special C++ names
55 /// for constructors, destructors, and conversion functions.
57 public:
58  /// NameKind - The kind of name this object contains.
59  enum NameKind {
71  };
72 
73  static const unsigned NumNameKinds = CXXUsingDirective + 1;
74 
75 private:
76  friend class DeclarationNameTable;
77  friend class NamedDecl;
78 
79  /// StoredNameKind - The kind of name that is actually stored in the
80  /// upper bits of the Ptr field. This is only used internally.
81  ///
82  /// Note: The entries here are synchronized with the entries in Selector,
83  /// for efficient translation between the two.
84  enum StoredNameKind {
85  StoredIdentifier = 0,
86  StoredObjCZeroArgSelector = 0x01,
87  StoredObjCOneArgSelector = 0x02,
88  StoredDeclarationNameExtra = 0x03,
89  PtrMask = 0x03
90  };
91 
92  /// Ptr - The lowest two bits are used to express what kind of name
93  /// we're actually storing, using the values of NameKind. Depending
94  /// on the kind of name this is, the upper bits of Ptr may have one
95  /// of several different meanings:
96  ///
97  /// StoredIdentifier - The name is a normal identifier, and Ptr is
98  /// a normal IdentifierInfo pointer.
99  ///
100  /// StoredObjCZeroArgSelector - The name is an Objective-C
101  /// selector with zero arguments, and Ptr is an IdentifierInfo
102  /// pointer pointing to the selector name.
103  ///
104  /// StoredObjCOneArgSelector - The name is an Objective-C selector
105  /// with one argument, and Ptr is an IdentifierInfo pointer
106  /// pointing to the selector name.
107  ///
108  /// StoredDeclarationNameExtra - Ptr is actually a pointer to a
109  /// DeclarationNameExtra structure, whose first value will tell us
110  /// whether this is an Objective-C selector, C++ operator-id name,
111  /// or special C++ name.
112  uintptr_t Ptr = 0;
113 
114  // Construct a declaration name from the name of a C++ constructor,
115  // destructor, or conversion function.
117  : Ptr(reinterpret_cast<uintptr_t>(Name)) {
118  assert((Ptr & PtrMask) == 0 && "Improperly aligned DeclarationNameExtra");
119  Ptr |= StoredDeclarationNameExtra;
120  }
121 
122  /// Construct a declaration name from a raw pointer.
123  DeclarationName(uintptr_t Ptr) : Ptr(Ptr) {}
124 
125  /// getStoredNameKind - Return the kind of object that is stored in
126  /// Ptr.
127  StoredNameKind getStoredNameKind() const {
128  return static_cast<StoredNameKind>(Ptr & PtrMask);
129  }
130 
131  /// getExtra - Get the "extra" information associated with this
132  /// multi-argument selector or C++ special name.
133  DeclarationNameExtra *getExtra() const {
134  assert(getStoredNameKind() == StoredDeclarationNameExtra &&
135  "Declaration name does not store an Extra structure");
136  return reinterpret_cast<DeclarationNameExtra *>(Ptr & ~PtrMask);
137  }
138 
139  /// getAsCXXSpecialName - If the stored pointer is actually a
140  /// CXXSpecialName, returns a pointer to it. Otherwise, returns
141  /// a NULL pointer.
142  CXXSpecialName *getAsCXXSpecialName() const {
144  if (Kind >= CXXConstructorName && Kind <= CXXConversionFunctionName)
145  return reinterpret_cast<CXXSpecialName *>(getExtra());
146  return nullptr;
147  }
148 
149  /// If the stored pointer is actually a CXXDeductionGuideNameExtra, returns a
150  /// pointer to it. Otherwise, returns a NULL pointer.
151  CXXDeductionGuideNameExtra *getAsCXXDeductionGuideNameExtra() const {
153  return reinterpret_cast<CXXDeductionGuideNameExtra *>(getExtra());
154  return nullptr;
155  }
156 
157  /// getAsCXXOperatorIdName
158  CXXOperatorIdName *getAsCXXOperatorIdName() const {
159  if (getNameKind() == CXXOperatorName)
160  return reinterpret_cast<CXXOperatorIdName *>(getExtra());
161  return nullptr;
162  }
163 
164  CXXLiteralOperatorIdName *getAsCXXLiteralOperatorIdName() const {
166  return reinterpret_cast<CXXLiteralOperatorIdName *>(getExtra());
167  return nullptr;
168  }
169 
170  /// getFETokenInfoAsVoidSlow - Retrieves the front end-specified pointer
171  /// for this name as a void pointer if it's not an identifier.
172  void *getFETokenInfoAsVoidSlow() const;
173 
174 public:
175  /// DeclarationName - Used to create an empty selector.
176  DeclarationName() = default;
177 
178  // Construct a declaration name from an IdentifierInfo *.
180  : Ptr(reinterpret_cast<uintptr_t>(II)) {
181  assert((Ptr & PtrMask) == 0 && "Improperly aligned IdentifierInfo");
182  }
183 
184  // Construct a declaration name from an Objective-C selector.
185  DeclarationName(Selector Sel) : Ptr(Sel.InfoPtr) {}
186 
187  /// getUsingDirectiveName - Return name for all using-directives.
189 
190  // operator bool() - Evaluates true when this declaration name is
191  // non-empty.
192  explicit operator bool() const {
193  return ((Ptr & PtrMask) != 0) ||
194  (reinterpret_cast<IdentifierInfo *>(Ptr & ~PtrMask));
195  }
196 
197  /// Evaluates true when this declaration name is empty.
198  bool isEmpty() const {
199  return !*this;
200  }
201 
202  /// Predicate functions for querying what type of name this is.
203  bool isIdentifier() const { return getStoredNameKind() == StoredIdentifier; }
204  bool isObjCZeroArgSelector() const {
205  return getStoredNameKind() == StoredObjCZeroArgSelector;
206  }
207  bool isObjCOneArgSelector() const {
208  return getStoredNameKind() == StoredObjCOneArgSelector;
209  }
210 
211  /// getNameKind - Determine what kind of name this is.
212  NameKind getNameKind() const;
213 
214  /// Determines whether the name itself is dependent, e.g., because it
215  /// involves a C++ type that is itself dependent.
216  ///
217  /// Note that this does not capture all of the notions of "dependent name",
218  /// because an identifier can be a dependent name if it is used as the
219  /// callee in a call expression with dependent arguments.
220  bool isDependentName() const;
221 
222  /// getNameAsString - Retrieve the human-readable string for this name.
223  std::string getAsString() const;
224 
225  /// getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in
226  /// this declaration name, or NULL if this declaration name isn't a
227  /// simple identifier.
229  if (isIdentifier())
230  return reinterpret_cast<IdentifierInfo *>(Ptr);
231  return nullptr;
232  }
233 
234  /// getAsOpaqueInteger - Get the representation of this declaration
235  /// name as an opaque integer.
236  uintptr_t getAsOpaqueInteger() const { return Ptr; }
237 
238  /// getAsOpaquePtr - Get the representation of this declaration name as
239  /// an opaque pointer.
240  void *getAsOpaquePtr() const { return reinterpret_cast<void*>(Ptr); }
241 
243  DeclarationName N;
244  N.Ptr = reinterpret_cast<uintptr_t> (P);
245  return N;
246  }
247 
249  DeclarationName N;
250  N.Ptr = P;
251  return N;
252  }
253 
254  /// getCXXNameType - If this name is one of the C++ names (of a
255  /// constructor, destructor, or conversion function), return the
256  /// type associated with that name.
257  QualType getCXXNameType() const;
258 
259  /// If this name is the name of a C++ deduction guide, return the
260  /// template associated with that name.
262 
263  /// getCXXOverloadedOperator - If this name is the name of an
264  /// overloadable operator in C++ (e.g., @c operator+), retrieve the
265  /// kind of overloaded operator.
267 
268  /// getCXXLiteralIdentifier - If this name is the name of a literal
269  /// operator, retrieve the identifier associated with it.
271 
272  /// getObjCSelector - Get the Objective-C selector stored in this
273  /// declaration name.
275  assert((getNameKind() == ObjCZeroArgSelector ||
278  Ptr == 0) && "Not a selector!");
279  return Selector(Ptr);
280  }
281 
282  /// getFETokenInfo/setFETokenInfo - The language front-end is
283  /// allowed to associate arbitrary metadata with some kinds of
284  /// declaration names, including normal identifiers and C++
285  /// constructors, destructors, and conversion functions.
286  template<typename T>
287  T *getFETokenInfo() const {
288  if (const IdentifierInfo *Info = getAsIdentifierInfo())
289  return Info->getFETokenInfo<T>();
290  return static_cast<T*>(getFETokenInfoAsVoidSlow());
291  }
292 
293  void setFETokenInfo(void *T);
294 
295  /// operator== - Determine whether the specified names are identical..
297  return LHS.Ptr == RHS.Ptr;
298  }
299 
300  /// operator!= - Determine whether the specified names are different.
302  return LHS.Ptr != RHS.Ptr;
303  }
304 
306  return DeclarationName(uintptr_t(-1));
307  }
308 
310  return DeclarationName(uintptr_t(-2));
311  }
312 
313  static int compare(DeclarationName LHS, DeclarationName RHS);
314 
315  void print(raw_ostream &OS, const PrintingPolicy &Policy);
316 
317  void dump() const;
318 };
319 
320 raw_ostream &operator<<(raw_ostream &OS, DeclarationName N);
321 
322 /// Ordering on two declaration names. If both names are identifiers,
323 /// this provides a lexicographical ordering.
325  return DeclarationName::compare(LHS, RHS) < 0;
326 }
327 
328 /// Ordering on two declaration names. If both names are identifiers,
329 /// this provides a lexicographical ordering.
331  return DeclarationName::compare(LHS, RHS) > 0;
332 }
333 
334 /// Ordering on two declaration names. If both names are identifiers,
335 /// this provides a lexicographical ordering.
337  return DeclarationName::compare(LHS, RHS) <= 0;
338 }
339 
340 /// Ordering on two declaration names. If both names are identifiers,
341 /// this provides a lexicographical ordering.
343  return DeclarationName::compare(LHS, RHS) >= 0;
344 }
345 
346 /// CXXSpecialName - Records the type associated with one of the
347 /// "special" kinds of declaration names in C++, e.g., constructors,
348 /// destructors, and conversion functions.
350  public llvm::FoldingSetNode {
351 public:
352  /// Type - The type associated with this declaration name.
354 
355  /// FETokenInfo - Extra information associated with this declaration
356  /// name that can be used by the front end. All bits are really needed
357  /// so it is not possible to stash something in the low order bits.
358  void *FETokenInfo;
359 
360  void Profile(llvm::FoldingSetNodeID &ID) {
361  ID.AddInteger(ExtraKindOrNumArgs);
362  ID.AddPointer(Type.getAsOpaquePtr());
363  }
364 };
365 
366 /// Contains extra information for the name of a C++ deduction guide.
368  public llvm::FoldingSetNode {
369 public:
370  /// The template named by the deduction guide.
372 
373  /// FETokenInfo - Extra information associated with this operator
374  /// name that can be used by the front end. All bits are really needed
375  /// so it is not possible to stash something in the low order bits.
376  void *FETokenInfo;
377 
378  void Profile(llvm::FoldingSetNodeID &ID) { ID.AddPointer(Template); }
379 };
380 
381 /// CXXOperatorIdName - Contains extra information for the name of an
382 /// overloaded operator in C++, such as "operator+.
384 public:
385  /// FETokenInfo - Extra information associated with this operator
386  /// name that can be used by the front end. All bits are really needed
387  /// so it is not possible to stash something in the low order bits.
388  void *FETokenInfo;
389 };
390 
391 /// CXXLiteralOperatorName - Contains the actual identifier that makes up the
392 /// name.
393 ///
394 /// This identifier is stored here rather than directly in DeclarationName so as
395 /// to allow Objective-C selectors, which are about a million times more common,
396 /// to consume minimal memory.
398  public llvm::FoldingSetNode {
399 public:
401 
402  /// FETokenInfo - Extra information associated with this operator
403  /// name that can be used by the front end. All bits are really needed
404  /// so it is not possible to stash something in the low order bits.
405  void *FETokenInfo;
406 
407  void Profile(llvm::FoldingSetNodeID &FSID) { FSID.AddPointer(ID); }
408 };
409 
410 /// DeclarationNameTable - Used to store and retrieve DeclarationName
411 /// instances for the various kinds of declaration names, e.g., normal
412 /// identifiers, C++ constructor names, etc. This class contains
413 /// uniqued versions of each of the C++ special names, which can be
414 /// retrieved using its member functions (e.g., getCXXConstructorName).
416  /// Used to allocate elements in the FoldingSets and
417  /// in the array of CXXOperatorIdName below.
418  const ASTContext &Ctx;
419 
420  /// Manage the uniqued CXXSpecialName, which contain extra information
421  /// for the "special" kinds of declaration names in C++ such as constructors,
422  /// destructors and conversion functions. getCXXConstructorName,
423  /// getCXXDestructorName, getCXXConversionFunctionName, and getCXXSpecialName
424  /// can be used to obtain a DeclarationName from the corresponding type.
425  llvm::FoldingSet<CXXSpecialName> CXXSpecialNames;
426 
427  /// Manage the uniqued CXXOperatorIdName, which contain extra information
428  /// for the name of overloaded C++ operators. getCXXOperatorName
429  /// can be used to obtain a DeclarationName from the operator kind.
430  /// This points to the first element of an array of NUM_OVERLOADED_OPERATORS
431  /// CXXOperatorIdName which is constructed by DeclarationNameTable.
432  CXXOperatorIdName *CXXOperatorNames;
433 
434  /// Manage the uniqued CXXLiteralOperatorIdName, which contain extra
435  /// information for the name of C++ literal operators.
436  /// getCXXLiteralOperatorName can be used to obtain a DeclarationName
437  /// from the corresponding IdentifierInfo.
438  llvm::FoldingSet<CXXLiteralOperatorIdName> CXXLiteralOperatorNames;
439 
440  /// Manage the uniqued CXXDeductionGuideNameExtra, which contain
441  /// extra information for the name of a C++ deduction guide.
442  /// getCXXDeductionGuideName can be used to obtain a DeclarationName
443  /// from the corresponding template declaration.
444  llvm::FoldingSet<CXXDeductionGuideNameExtra> CXXDeductionGuideNames;
445 
446 public:
448  DeclarationNameTable(const DeclarationNameTable &) = delete;
449  DeclarationNameTable &operator=(const DeclarationNameTable &) = delete;
451  DeclarationNameTable &operator=(DeclarationNameTable &&) = delete;
452  ~DeclarationNameTable() = default;
453 
454  /// getIdentifier - Create a declaration name that is a simple
455  /// identifier.
457  return DeclarationName(ID);
458  }
459 
460  /// getCXXConstructorName - Returns the name of a C++ constructor
461  /// for the given Type.
462  DeclarationName getCXXConstructorName(CanQualType Ty);
463 
464  /// getCXXDestructorName - Returns the name of a C++ destructor
465  /// for the given Type.
466  DeclarationName getCXXDestructorName(CanQualType Ty);
467 
468  /// Returns the name of a C++ deduction guide for the given template.
469  DeclarationName getCXXDeductionGuideName(TemplateDecl *TD);
470 
471  /// getCXXConversionFunctionName - Returns the name of a C++
472  /// conversion function for the given Type.
473  DeclarationName getCXXConversionFunctionName(CanQualType Ty);
474 
475  /// getCXXSpecialName - Returns a declaration name for special kind
476  /// of C++ name, e.g., for a constructor, destructor, or conversion
477  /// function.
478  DeclarationName getCXXSpecialName(DeclarationName::NameKind Kind,
479  CanQualType Ty);
480 
481  /// getCXXOperatorName - Get the name of the overloadable C++
482  /// operator corresponding to Op.
483  DeclarationName getCXXOperatorName(OverloadedOperatorKind Op);
484 
485  /// getCXXLiteralOperatorName - Get the name of the literal operator function
486  /// with II as the identifier.
487  DeclarationName getCXXLiteralOperatorName(IdentifierInfo *II);
488 };
489 
490 /// DeclarationNameLoc - Additional source/type location info
491 /// for a declaration name. Needs a DeclarationName in order
492 /// to be interpreted correctly.
494  // The source location for identifier stored elsewhere.
495  // struct {} Identifier;
496 
497  // Type info for constructors, destructors and conversion functions.
498  // Locations (if any) for the tilde (destructor) or operator keyword
499  // (conversion) are stored elsewhere.
500  struct NT {
502  };
503 
504  // The location (if any) of the operator keyword is stored elsewhere.
505  struct CXXOpName {
506  unsigned BeginOpNameLoc;
507  unsigned EndOpNameLoc;
508  };
509 
510  // The location (if any) of the operator keyword is stored elsewhere.
511  struct CXXLitOpName {
512  unsigned OpNameLoc;
513  };
514 
515  // struct {} CXXUsingDirective;
516  // struct {} ObjCZeroArgSelector;
517  // struct {} ObjCOneArgSelector;
518  // struct {} ObjCMultiArgSelector;
519  union {
520  struct NT NamedType;
523  };
524 
526 
527  // FIXME: this should go away once all DNLocs are properly initialized.
528  DeclarationNameLoc() { memset((void*) this, 0, sizeof(*this)); }
529 };
530 
531 /// DeclarationNameInfo - A collector data type for bundling together
532 /// a DeclarationName and the correspnding source/type location info.
534 private:
535  /// Name - The declaration name, also encoding name kind.
536  DeclarationName Name;
537 
538  /// Loc - The main source location for the declaration name.
539  SourceLocation NameLoc;
540 
541  /// Info - Further source/type location info for special kinds of names.
542  DeclarationNameLoc LocInfo;
543 
544 public:
545  // FIXME: remove it.
546  DeclarationNameInfo() = default;
547 
549  : Name(Name), NameLoc(NameLoc), LocInfo(Name) {}
550 
552  DeclarationNameLoc LocInfo)
553  : Name(Name), NameLoc(NameLoc), LocInfo(LocInfo) {}
554 
555  /// getName - Returns the embedded declaration name.
556  DeclarationName getName() const { return Name; }
557 
558  /// setName - Sets the embedded declaration name.
559  void setName(DeclarationName N) { Name = N; }
560 
561  /// getLoc - Returns the main location of the declaration name.
562  SourceLocation getLoc() const { return NameLoc; }
563 
564  /// setLoc - Sets the main location of the declaration name.
565  void setLoc(SourceLocation L) { NameLoc = L; }
566 
567  const DeclarationNameLoc &getInfo() const { return LocInfo; }
568  DeclarationNameLoc &getInfo() { return LocInfo; }
569  void setInfo(const DeclarationNameLoc &Info) { LocInfo = Info; }
570 
571  /// getNamedTypeInfo - Returns the source type info associated to
572  /// the name. Assumes it is a constructor, destructor or conversion.
577  return LocInfo.NamedType.TInfo;
578  }
579 
580  /// setNamedTypeInfo - Sets the source type info associated to
581  /// the name. Assumes it is a constructor, destructor or conversion.
586  LocInfo.NamedType.TInfo = TInfo;
587  }
588 
589  /// getCXXOperatorNameRange - Gets the range of the operator name
590  /// (without the operator keyword). Assumes it is a (non-literal) operator.
593  return SourceRange(
596  );
597  }
598 
599  /// setCXXOperatorNameRange - Sets the range of the operator name
600  /// (without the operator keyword). Assumes it is a C++ operator.
605  }
606 
607  /// getCXXLiteralOperatorNameLoc - Returns the location of the literal
608  /// operator name (not the operator keyword).
609  /// Assumes it is a literal operator.
612  return SourceLocation::
614  }
615 
616  /// setCXXLiteralOperatorNameLoc - Sets the location of the literal
617  /// operator name (not the operator keyword).
618  /// Assumes it is a literal operator.
622  }
623 
624  /// Determine whether this name involves a template parameter.
625  bool isInstantiationDependent() const;
626 
627  /// Determine whether this name contains an unexpanded
628  /// parameter pack.
629  bool containsUnexpandedParameterPack() const;
630 
631  /// getAsString - Retrieve the human-readable string for this name.
632  std::string getAsString() const;
633 
634  /// printName - Print the human-readable name to a stream.
635  void printName(raw_ostream &OS) const;
636 
637  /// getBeginLoc - Retrieve the location of the first token.
638  SourceLocation getBeginLoc() const { return NameLoc; }
639 
640  /// getSourceRange - The range of the declaration name.
641  SourceRange getSourceRange() const LLVM_READONLY {
642  return SourceRange(getBeginLoc(), getEndLoc());
643  }
644 
645  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY,
646  "Use getBeginLoc instead") {
647  return getBeginLoc();
648  }
649 
650  LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY,
651  "Use getEndLoc instead") {
652  return getEndLoc();
653  }
654  SourceLocation getEndLoc() const LLVM_READONLY {
655  SourceLocation EndLoc = getEndLocPrivate();
656  return EndLoc.isValid() ? EndLoc : getBeginLoc();
657  }
658 
659 private:
660  SourceLocation getEndLocPrivate() const;
661 };
662 
663 /// Insertion operator for diagnostics. This allows sending DeclarationName's
664 /// into a diagnostic with <<.
666  DeclarationName N) {
669  return DB;
670 }
671 
672 /// Insertion operator for partial diagnostics. This allows binding
673 /// DeclarationName's into a partial diagnostic with <<.
675  DeclarationName N) {
678  return PD;
679 }
680 
681 inline raw_ostream &operator<<(raw_ostream &OS,
682  DeclarationNameInfo DNInfo) {
683  DNInfo.printName(OS);
684  return OS;
685 }
686 
687 } // namespace clang
688 
689 namespace llvm {
690 
691 /// Define DenseMapInfo so that DeclarationNames can be used as keys
692 /// in DenseMap and DenseSets.
693 template<>
697  }
698 
701  }
702 
703  static unsigned getHashValue(clang::DeclarationName Name) {
705  }
706 
707  static inline bool
709  return LHS == RHS;
710  }
711 };
712 
713 template <>
714 struct isPodLike<clang::DeclarationName> { static const bool value = true; };
715 
716 } // namespace llvm
717 
718 #endif // LLVM_CLANG_AST_DECLARATIONNAME_H
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
void setInfo(const DeclarationNameLoc &Info)
Smart pointer class that efficiently represents Objective-C method names.
CXXSpecialName - Records the type associated with one of the "special" kinds of declaration names in ...
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
A (possibly-)qualified type.
Definition: Type.h:640
static bool isEqual(clang::DeclarationName LHS, clang::DeclarationName RHS)
NameKind
NameKind - The kind of name this object contains.
SourceRange getCXXOperatorNameRange() const
getCXXOperatorNameRange - Gets the range of the operator name (without the operator keyword)...
const DeclarationNameLoc & getInfo() const
QualType Type
Type - The type associated with this declaration name.
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:30
C Language Family Type Representation.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
Selector getObjCSelector() const
getObjCSelector - Get the Objective-C selector stored in this declaration name.
StringRef P
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
Definition: Attr.h:322
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
SourceLocation getEndLoc() const LLVM_READONLY
A container of type source information.
Definition: Decl.h:86
bool isEmpty() const
Evaluates true when this declaration name is empty.
void setCXXLiteralOperatorNameLoc(SourceLocation Loc)
setCXXLiteralOperatorNameLoc - Sets the location of the literal operator name (not the operator keywo...
QualType getCXXNameType() const
getCXXNameType - If this name is one of the C++ names (of a constructor, destructor, or conversion function), return the type associated with that name.
void * getAsOpaquePtr() const
getAsOpaquePtr - Get the representation of this declaration name as an opaque pointer.
Describes how types, statements, expressions, and declarations should be printed. ...
Definition: PrettyPrinter.h:38
bool operator<=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
CXXOperatorIdName - Contains extra information for the name of an overloaded operator in C++...
void Profile(llvm::FoldingSetNodeID &ID)
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
Definition: Diagnostic.h:1155
One of these records is kept for each identifier that is lexed.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:153
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
static const unsigned NumNameKinds
friend bool operator==(DeclarationName LHS, DeclarationName RHS)
operator== - Determine whether the specified names are identical..
static DeclarationName getFromOpaquePtr(void *P)
bool operator>(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
bool isDependentName() const
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself ...
DeclarationNameExtra - Common base of the MultiKeywordSelector, CXXSpecialName, and CXXOperatorIdName...
void setCXXOperatorNameRange(SourceRange R)
setCXXOperatorNameRange - Sets the range of the operator name (without the operator keyword)...
uintptr_t getAsOpaqueInteger() const
getAsOpaqueInteger - Get the representation of this declaration name as an opaque integer...
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocStart() const LLVM_READONLY, "Use getBeginLoc instead")
DeclarationName(const IdentifierInfo *II)
Defines the Diagnostic-related interfaces.
static clang::DeclarationName getTombstoneKey()
__DEVICE__ void * memset(void *__a, int __b, size_t __c)
static unsigned getHashValue(clang::DeclarationName Name)
void * getAsOpaquePtr() const
Definition: Type.h:685
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:1042
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
Contains extra information for the name of a C++ deduction guide.
void Profile(llvm::FoldingSetNodeID &FSID)
friend bool operator!=(DeclarationName LHS, DeclarationName RHS)
operator!= - Determine whether the specified names are different.
DeclarationNameTable - Used to store and retrieve DeclarationName instances for the various kinds of ...
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
DeclarationName(Selector Sel)
#define bool
Definition: stdbool.h:31
static clang::DeclarationName getEmptyKey()
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
static DeclarationName getFromOpaqueInteger(uintptr_t P)
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn&#39;t a simple identifier.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isIdentifier() const
Predicate functions for querying what type of name this is.
SourceLocation getEnd() const
struct CXXOpName CXXOperatorName
__UINTPTR_TYPE__ uintptr_t
An unsigned integer type with the property that any valid pointer to void can be converted to this ty...
Definition: opencl-c.h:82
void * FETokenInfo
FETokenInfo - Extra information associated with this operator name that can be used by the front end...
LLVM_ATTRIBUTE_DEPRECATED(SourceLocation getLocEnd() const LLVM_READONLY, "Use getEndLoc instead")
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc)
T * getFETokenInfo() const
getFETokenInfo/setFETokenInfo - The language front-end is allowed to associate arbitrary metadata wit...
bool isObjCOneArgSelector() const
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
void * FETokenInfo
FETokenInfo - Extra information associated with this operator name that can be used by the front end...
Kind
Encodes a location in the source.
DeclarationName getName() const
getName - Returns the embedded declaration name.
DeclarationName getIdentifier(const IdentifierInfo *ID)
getIdentifier - Create a declaration name that is a simple identifier.
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
void * FETokenInfo
FETokenInfo - Extra information associated with this operator name that can be used by the front end...
bool operator>=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
bool operator<(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
TemplateDecl * Template
The template named by the deduction guide.
void printName(raw_ostream &OS) const
printName - Print the human-readable name to a stream.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
void Profile(llvm::FoldingSetNodeID &ID)
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc, DeclarationNameLoc LocInfo)
The base class of all kinds of template declarations (e.g., class, function, etc.).
Definition: DeclTemplate.h:399
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
DeclarationName - The name of a declaration.
DeclarationNameLoc & getInfo()
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
struct CXXLitOpName CXXLiteralOperatorName
SourceRange getSourceRange() const LLVM_READONLY
getSourceRange - The range of the declaration name.
static DeclarationName getTombstoneMarker()
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
CXXLiteralOperatorName - Contains the actual identifier that makes up the name.
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
SourceLocation getCXXLiteralOperatorNameLoc() const
getCXXLiteralOperatorNameLoc - Returns the location of the literal operator name (not the operator ke...
void setLoc(SourceLocation L)
setLoc - Sets the main location of the declaration name.
Defines the clang::SourceLocation class and associated facilities.
static int compare(DeclarationName LHS, DeclarationName RHS)
void print(raw_ostream &OS, const PrintingPolicy &Policy)
DeclarationName()=default
DeclarationName - Used to create an empty selector.
void * FETokenInfo
FETokenInfo - Extra information associated with this declaration name that can be used by the front e...
A trivial tuple used to represent a source range.
This represents a decl that may have a name.
Definition: Decl.h:248
static DeclarationName getUsingDirectiveName()
getUsingDirectiveName - Return name for all using-directives.
static DeclarationName getEmptyMarker()
SourceLocation getBegin() const
bool isObjCZeroArgSelector() const
friend class DeclarationNameTable