clang  3.9.0
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 #ifndef LLVM_CLANG_AST_DECLARATIONNAME_H
14 #define LLVM_CLANG_AST_DECLARATIONNAME_H
15 
18 #include "llvm/Support/Compiler.h"
19 
20 namespace llvm {
21  template <typename T> struct DenseMapInfo;
22 }
23 
24 namespace clang {
25  class ASTContext;
26  class CXXLiteralOperatorIdName;
27  class CXXOperatorIdName;
28  class CXXSpecialName;
29  class DeclarationNameExtra;
30  class IdentifierInfo;
31  class MultiKeywordSelector;
32  enum OverloadedOperatorKind : int;
33  struct PrintingPolicy;
34  class QualType;
35  class Type;
36  class TypeSourceInfo;
37  class UsingDirectiveDecl;
38 
39  template <typename> class CanQual;
40  typedef CanQual<Type> CanQualType;
41 
42 /// DeclarationName - The name of a declaration. In the common case,
43 /// this just stores an IdentifierInfo pointer to a normal
44 /// name. However, it also provides encodings for Objective-C
45 /// selectors (optimizing zero- and one-argument selectors, which make
46 /// up 78% percent of all selectors in Cocoa.h) and special C++ names
47 /// for constructors, destructors, and conversion functions.
49 public:
50  /// NameKind - The kind of name this object contains.
51  enum NameKind {
62  };
63  static const unsigned NumNameKinds = CXXUsingDirective + 1;
64 
65 private:
66  /// StoredNameKind - The kind of name that is actually stored in the
67  /// upper bits of the Ptr field. This is only used internally.
68  ///
69  /// Note: The entries here are synchronized with the entries in Selector,
70  /// for efficient translation between the two.
71  enum StoredNameKind {
72  StoredIdentifier = 0,
73  StoredObjCZeroArgSelector = 0x01,
74  StoredObjCOneArgSelector = 0x02,
75  StoredDeclarationNameExtra = 0x03,
76  PtrMask = 0x03
77  };
78 
79  /// Ptr - The lowest two bits are used to express what kind of name
80  /// we're actually storing, using the values of NameKind. Depending
81  /// on the kind of name this is, the upper bits of Ptr may have one
82  /// of several different meanings:
83  ///
84  /// StoredIdentifier - The name is a normal identifier, and Ptr is
85  /// a normal IdentifierInfo pointer.
86  ///
87  /// StoredObjCZeroArgSelector - The name is an Objective-C
88  /// selector with zero arguments, and Ptr is an IdentifierInfo
89  /// pointer pointing to the selector name.
90  ///
91  /// StoredObjCOneArgSelector - The name is an Objective-C selector
92  /// with one argument, and Ptr is an IdentifierInfo pointer
93  /// pointing to the selector name.
94  ///
95  /// StoredDeclarationNameExtra - Ptr is actually a pointer to a
96  /// DeclarationNameExtra structure, whose first value will tell us
97  /// whether this is an Objective-C selector, C++ operator-id name,
98  /// or special C++ name.
99  uintptr_t Ptr;
100 
101  /// getStoredNameKind - Return the kind of object that is stored in
102  /// Ptr.
103  StoredNameKind getStoredNameKind() const {
104  return static_cast<StoredNameKind>(Ptr & PtrMask);
105  }
106 
107  /// getExtra - Get the "extra" information associated with this
108  /// multi-argument selector or C++ special name.
109  DeclarationNameExtra *getExtra() const {
110  assert(getStoredNameKind() == StoredDeclarationNameExtra &&
111  "Declaration name does not store an Extra structure");
112  return reinterpret_cast<DeclarationNameExtra *>(Ptr & ~PtrMask);
113  }
114 
115  /// getAsCXXSpecialName - If the stored pointer is actually a
116  /// CXXSpecialName, returns a pointer to it. Otherwise, returns
117  /// a NULL pointer.
118  CXXSpecialName *getAsCXXSpecialName() const {
120  if (Kind >= CXXConstructorName && Kind <= CXXConversionFunctionName)
121  return reinterpret_cast<CXXSpecialName *>(Ptr & ~PtrMask);
122  return nullptr;
123  }
124 
125  /// getAsCXXOperatorIdName
126  CXXOperatorIdName *getAsCXXOperatorIdName() const {
127  if (getNameKind() == CXXOperatorName)
128  return reinterpret_cast<CXXOperatorIdName *>(Ptr & ~PtrMask);
129  return nullptr;
130  }
131 
132  CXXLiteralOperatorIdName *getAsCXXLiteralOperatorIdName() const {
134  return reinterpret_cast<CXXLiteralOperatorIdName *>(Ptr & ~PtrMask);
135  return nullptr;
136  }
137 
138  // Construct a declaration name from the name of a C++ constructor,
139  // destructor, or conversion function.
140  DeclarationName(CXXSpecialName *Name)
141  : Ptr(reinterpret_cast<uintptr_t>(Name)) {
142  assert((Ptr & PtrMask) == 0 && "Improperly aligned CXXSpecialName");
143  Ptr |= StoredDeclarationNameExtra;
144  }
145 
146  // Construct a declaration name from the name of a C++ overloaded
147  // operator.
148  DeclarationName(CXXOperatorIdName *Name)
149  : Ptr(reinterpret_cast<uintptr_t>(Name)) {
150  assert((Ptr & PtrMask) == 0 && "Improperly aligned CXXOperatorId");
151  Ptr |= StoredDeclarationNameExtra;
152  }
153 
154  DeclarationName(CXXLiteralOperatorIdName *Name)
155  : Ptr(reinterpret_cast<uintptr_t>(Name)) {
156  assert((Ptr & PtrMask) == 0 && "Improperly aligned CXXLiteralOperatorId");
157  Ptr |= StoredDeclarationNameExtra;
158  }
159 
160  /// Construct a declaration name from a raw pointer.
161  DeclarationName(uintptr_t Ptr) : Ptr(Ptr) { }
162 
163  friend class DeclarationNameTable;
164  friend class NamedDecl;
165 
166  /// getFETokenInfoAsVoidSlow - Retrieves the front end-specified pointer
167  /// for this name as a void pointer if it's not an identifier.
168  void *getFETokenInfoAsVoidSlow() const;
169 
170 public:
171  /// DeclarationName - Used to create an empty selector.
172  DeclarationName() : Ptr(0) { }
173 
174  // Construct a declaration name from an IdentifierInfo *.
176  : Ptr(reinterpret_cast<uintptr_t>(II)) {
177  assert((Ptr & PtrMask) == 0 && "Improperly aligned IdentifierInfo");
178  }
179 
180  // Construct a declaration name from an Objective-C selector.
181  DeclarationName(Selector Sel) : Ptr(Sel.InfoPtr) { }
182 
183  /// getUsingDirectiveName - Return name for all using-directives.
185 
186  // operator bool() - Evaluates true when this declaration name is
187  // non-empty.
188  explicit operator bool() const {
189  return ((Ptr & PtrMask) != 0) ||
190  (reinterpret_cast<IdentifierInfo *>(Ptr & ~PtrMask));
191  }
192 
193  /// \brief Evaluates true when this declaration name is empty.
194  bool isEmpty() const {
195  return !*this;
196  }
197 
198  /// Predicate functions for querying what type of name this is.
199  bool isIdentifier() const { return getStoredNameKind() == StoredIdentifier; }
200  bool isObjCZeroArgSelector() const {
201  return getStoredNameKind() == StoredObjCZeroArgSelector;
202  }
203  bool isObjCOneArgSelector() const {
204  return getStoredNameKind() == StoredObjCOneArgSelector;
205  }
206 
207  /// getNameKind - Determine what kind of name this is.
208  NameKind getNameKind() const;
209 
210  /// \brief Determines whether the name itself is dependent, e.g., because it
211  /// involves a C++ type that is itself dependent.
212  ///
213  /// Note that this does not capture all of the notions of "dependent name",
214  /// because an identifier can be a dependent name if it is used as the
215  /// callee in a call expression with dependent arguments.
216  bool isDependentName() const;
217 
218  /// getNameAsString - Retrieve the human-readable string for this name.
219  std::string getAsString() const;
220 
221  /// getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in
222  /// this declaration name, or NULL if this declaration name isn't a
223  /// simple identifier.
225  if (isIdentifier())
226  return reinterpret_cast<IdentifierInfo *>(Ptr);
227  return nullptr;
228  }
229 
230  /// getAsOpaqueInteger - Get the representation of this declaration
231  /// name as an opaque integer.
232  uintptr_t getAsOpaqueInteger() const { return Ptr; }
233 
234  /// getAsOpaquePtr - Get the representation of this declaration name as
235  /// an opaque pointer.
236  void *getAsOpaquePtr() const { return reinterpret_cast<void*>(Ptr); }
237 
239  DeclarationName N;
240  N.Ptr = reinterpret_cast<uintptr_t> (P);
241  return N;
242  }
243 
245  DeclarationName N;
246  N.Ptr = P;
247  return N;
248  }
249 
250  /// getCXXNameType - If this name is one of the C++ names (of a
251  /// constructor, destructor, or conversion function), return the
252  /// type associated with that name.
253  QualType getCXXNameType() const;
254 
255  /// getCXXOverloadedOperator - If this name is the name of an
256  /// overloadable operator in C++ (e.g., @c operator+), retrieve the
257  /// kind of overloaded operator.
259 
260  /// getCXXLiteralIdentifier - If this name is the name of a literal
261  /// operator, retrieve the identifier associated with it.
263 
264  /// getObjCSelector - Get the Objective-C selector stored in this
265  /// declaration name.
267  assert((getNameKind() == ObjCZeroArgSelector ||
270  Ptr == 0) && "Not a selector!");
271  return Selector(Ptr);
272  }
273 
274  /// getFETokenInfo/setFETokenInfo - The language front-end is
275  /// allowed to associate arbitrary metadata with some kinds of
276  /// declaration names, including normal identifiers and C++
277  /// constructors, destructors, and conversion functions.
278  template<typename T>
279  T *getFETokenInfo() const {
280  if (const IdentifierInfo *Info = getAsIdentifierInfo())
281  return Info->getFETokenInfo<T>();
282  return static_cast<T*>(getFETokenInfoAsVoidSlow());
283  }
284 
285  void setFETokenInfo(void *T);
286 
287  /// operator== - Determine whether the specified names are identical..
289  return LHS.Ptr == RHS.Ptr;
290  }
291 
292  /// operator!= - Determine whether the specified names are different.
294  return LHS.Ptr != RHS.Ptr;
295  }
296 
298  return DeclarationName(uintptr_t(-1));
299  }
300 
302  return DeclarationName(uintptr_t(-2));
303  }
304 
305  static int compare(DeclarationName LHS, DeclarationName RHS);
306 
307  void print(raw_ostream &OS, const PrintingPolicy &Policy);
308 
309  void dump() const;
310 };
311 
312 raw_ostream &operator<<(raw_ostream &OS, DeclarationName N);
313 
314 /// Ordering on two declaration names. If both names are identifiers,
315 /// this provides a lexicographical ordering.
317  return DeclarationName::compare(LHS, RHS) < 0;
318 }
319 
320 /// Ordering on two declaration names. If both names are identifiers,
321 /// this provides a lexicographical ordering.
323  return DeclarationName::compare(LHS, RHS) > 0;
324 }
325 
326 /// Ordering on two declaration names. If both names are identifiers,
327 /// this provides a lexicographical ordering.
329  return DeclarationName::compare(LHS, RHS) <= 0;
330 }
331 
332 /// Ordering on two declaration names. If both names are identifiers,
333 /// this provides a lexicographical ordering.
335  return DeclarationName::compare(LHS, RHS) >= 0;
336 }
337 
338 /// DeclarationNameTable - Used to store and retrieve DeclarationName
339 /// instances for the various kinds of declaration names, e.g., normal
340 /// identifiers, C++ constructor names, etc. This class contains
341 /// uniqued versions of each of the C++ special names, which can be
342 /// retrieved using its member functions (e.g.,
343 /// getCXXConstructorName).
345  const ASTContext &Ctx;
346  void *CXXSpecialNamesImpl; // Actually a FoldingSet<CXXSpecialName> *
347  CXXOperatorIdName *CXXOperatorNames; // Operator names
348  void *CXXLiteralOperatorNames; // Actually a CXXOperatorIdName*
349 
351  void operator=(const DeclarationNameTable&) = delete;
352 
353 public:
356 
357  /// getIdentifier - Create a declaration name that is a simple
358  /// identifier.
360  return DeclarationName(ID);
361  }
362 
363  /// getCXXConstructorName - Returns the name of a C++ constructor
364  /// for the given Type.
366 
367  /// getCXXDestructorName - Returns the name of a C++ destructor
368  /// for the given Type.
370 
371  /// getCXXConversionFunctionName - Returns the name of a C++
372  /// conversion function for the given Type.
374 
375  /// getCXXSpecialName - Returns a declaration name for special kind
376  /// of C++ name, e.g., for a constructor, destructor, or conversion
377  /// function.
379  CanQualType Ty);
380 
381  /// getCXXOperatorName - Get the name of the overloadable C++
382  /// operator corresponding to Op.
384 
385  /// getCXXLiteralOperatorName - Get the name of the literal operator function
386  /// with II as the identifier.
388 };
389 
390 /// DeclarationNameLoc - Additional source/type location info
391 /// for a declaration name. Needs a DeclarationName in order
392 /// to be interpreted correctly.
394  // The source location for identifier stored elsewhere.
395  // struct {} Identifier;
396 
397  // Type info for constructors, destructors and conversion functions.
398  // Locations (if any) for the tilde (destructor) or operator keyword
399  // (conversion) are stored elsewhere.
400  struct NT {
402  };
403 
404  // The location (if any) of the operator keyword is stored elsewhere.
405  struct CXXOpName {
406  unsigned BeginOpNameLoc;
407  unsigned EndOpNameLoc;
408  };
409 
410  // The location (if any) of the operator keyword is stored elsewhere.
411  struct CXXLitOpName {
412  unsigned OpNameLoc;
413  };
414 
415  // struct {} CXXUsingDirective;
416  // struct {} ObjCZeroArgSelector;
417  // struct {} ObjCOneArgSelector;
418  // struct {} ObjCMultiArgSelector;
419  union {
420  struct NT NamedType;
423  };
424 
426  // FIXME: this should go away once all DNLocs are properly initialized.
427  DeclarationNameLoc() { memset((void*) this, 0, sizeof(*this)); }
428 }; // struct DeclarationNameLoc
429 
430 
431 /// DeclarationNameInfo - A collector data type for bundling together
432 /// a DeclarationName and the correspnding source/type location info.
434 private:
435  /// Name - The declaration name, also encoding name kind.
436  DeclarationName Name;
437  /// Loc - The main source location for the declaration name.
438  SourceLocation NameLoc;
439  /// Info - Further source/type location info for special kinds of names.
440  DeclarationNameLoc LocInfo;
441 
442 public:
443  // FIXME: remove it.
445 
447  : Name(Name), NameLoc(NameLoc), LocInfo(Name) {}
448 
450  DeclarationNameLoc LocInfo)
451  : Name(Name), NameLoc(NameLoc), LocInfo(LocInfo) {}
452 
453  /// getName - Returns the embedded declaration name.
454  DeclarationName getName() const { return Name; }
455  /// setName - Sets the embedded declaration name.
456  void setName(DeclarationName N) { Name = N; }
457 
458  /// getLoc - Returns the main location of the declaration name.
459  SourceLocation getLoc() const { return NameLoc; }
460  /// setLoc - Sets the main location of the declaration name.
461  void setLoc(SourceLocation L) { NameLoc = L; }
462 
463  const DeclarationNameLoc &getInfo() const { return LocInfo; }
464  DeclarationNameLoc &getInfo() { return LocInfo; }
465  void setInfo(const DeclarationNameLoc &Info) { LocInfo = Info; }
466 
467  /// getNamedTypeInfo - Returns the source type info associated to
468  /// the name. Assumes it is a constructor, destructor or conversion.
470  assert(Name.getNameKind() == DeclarationName::CXXConstructorName ||
471  Name.getNameKind() == DeclarationName::CXXDestructorName ||
472  Name.getNameKind() == DeclarationName::CXXConversionFunctionName);
473  return LocInfo.NamedType.TInfo;
474  }
475  /// setNamedTypeInfo - Sets the source type info associated to
476  /// the name. Assumes it is a constructor, destructor or conversion.
478  assert(Name.getNameKind() == DeclarationName::CXXConstructorName ||
479  Name.getNameKind() == DeclarationName::CXXDestructorName ||
480  Name.getNameKind() == DeclarationName::CXXConversionFunctionName);
481  LocInfo.NamedType.TInfo = TInfo;
482  }
483 
484  /// getCXXOperatorNameRange - Gets the range of the operator name
485  /// (without the operator keyword). Assumes it is a (non-literal) operator.
487  assert(Name.getNameKind() == DeclarationName::CXXOperatorName);
488  return SourceRange(
491  );
492  }
493  /// setCXXOperatorNameRange - Sets the range of the operator name
494  /// (without the operator keyword). Assumes it is a C++ operator.
496  assert(Name.getNameKind() == DeclarationName::CXXOperatorName);
499  }
500 
501  /// getCXXLiteralOperatorNameLoc - Returns the location of the literal
502  /// operator name (not the operator keyword).
503  /// Assumes it is a literal operator.
505  assert(Name.getNameKind() == DeclarationName::CXXLiteralOperatorName);
506  return SourceLocation::
508  }
509  /// setCXXLiteralOperatorNameLoc - Sets the location of the literal
510  /// operator name (not the operator keyword).
511  /// Assumes it is a literal operator.
513  assert(Name.getNameKind() == DeclarationName::CXXLiteralOperatorName);
515  }
516 
517  /// \brief Determine whether this name involves a template parameter.
518  bool isInstantiationDependent() const;
519 
520  /// \brief Determine whether this name contains an unexpanded
521  /// parameter pack.
522  bool containsUnexpandedParameterPack() const;
523 
524  /// getAsString - Retrieve the human-readable string for this name.
525  std::string getAsString() const;
526 
527  /// printName - Print the human-readable name to a stream.
528  void printName(raw_ostream &OS) const;
529 
530  /// getBeginLoc - Retrieve the location of the first token.
531  SourceLocation getBeginLoc() const { return NameLoc; }
532  /// getEndLoc - Retrieve the location of the last token.
533  SourceLocation getEndLoc() const;
534  /// getSourceRange - The range of the declaration name.
535  SourceRange getSourceRange() const LLVM_READONLY {
536  return SourceRange(getLocStart(), getLocEnd());
537  }
538  SourceLocation getLocStart() const LLVM_READONLY {
539  return getBeginLoc();
540  }
541  SourceLocation getLocEnd() const LLVM_READONLY {
542  SourceLocation EndLoc = getEndLoc();
543  return EndLoc.isValid() ? EndLoc : getLocStart();
544  }
545 };
546 
547 /// Insertion operator for diagnostics. This allows sending DeclarationName's
548 /// into a diagnostic with <<.
550  DeclarationName N) {
553  return DB;
554 }
555 
556 /// Insertion operator for partial diagnostics. This allows binding
557 /// DeclarationName's into a partial diagnostic with <<.
559  DeclarationName N) {
562  return PD;
563 }
564 
565 inline raw_ostream &operator<<(raw_ostream &OS,
566  DeclarationNameInfo DNInfo) {
567  DNInfo.printName(OS);
568  return OS;
569 }
570 
571 } // end namespace clang
572 
573 namespace llvm {
574 /// Define DenseMapInfo so that DeclarationNames can be used as keys
575 /// in DenseMap and DenseSets.
576 template<>
577 struct DenseMapInfo<clang::DeclarationName> {
580  }
581 
584  }
585 
586  static unsigned getHashValue(clang::DeclarationName Name) {
588  }
589 
590  static inline bool
592  return LHS == RHS;
593  }
594 };
595 
596 template <>
597 struct isPodLike<clang::DeclarationName> { static const bool value = true; };
598 
599 } // end namespace llvm
600 
601 #endif
bool isDependentName() const
Determines whether the name itself is dependent, e.g., because it involves a C++ type that is itself ...
SourceLocation getEnd() const
bool isObjCOneArgSelector() const
void setInfo(const DeclarationNameLoc &Info)
Smart pointer class that efficiently represents Objective-C method names.
A (possibly-)qualified type.
Definition: Type.h:598
static bool isEqual(clang::DeclarationName LHS, clang::DeclarationName RHS)
NameKind
NameKind - The kind of name this object contains.
DeclarationName getCXXConstructorName(CanQualType Ty)
getCXXConstructorName - Returns the name of a C++ constructor for the given Type. ...
SourceLocation getCXXLiteralOperatorNameLoc() const
getCXXLiteralOperatorNameLoc - Returns the location of the literal operator name (not the operator ke...
SourceLocation getEndLoc() const
getEndLoc - Retrieve the location of the last token.
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
DeclarationName getCXXConversionFunctionName(CanQualType Ty)
getCXXConversionFunctionName - Returns the name of a C++ conversion function for the given Type...
StringRef P
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
Definition: Attr.h:198
IdentifierInfo * getAsIdentifierInfo() const
getAsIdentifierInfo - Retrieve the IdentifierInfo * stored in this declaration name, or NULL if this declaration name isn't a simple identifier.
A container of type source information.
Definition: Decl.h:62
unsigned getRawEncoding() const
When a SourceLocation itself cannot be used, this returns an (opaque) 32-bit integer encoding for it...
void setCXXLiteralOperatorNameLoc(SourceLocation Loc)
setCXXLiteralOperatorNameLoc - Sets the location of the literal operator name (not the operator keywo...
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 AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
Definition: Diagnostic.h:986
DeclarationName getName() const
getName - Returns the embedded declaration name.
One of these records is kept for each identifier that is lexed.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
Definition: Type.h:4549
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:92
static int compare(DeclarationName LHS, DeclarationName RHS)
bool isIdentifier() const
Predicate functions for querying what type of name this is.
static SourceLocation getFromRawEncoding(unsigned Encoding)
Turn a raw encoding of a SourceLocation object into a real SourceLocation.
void print(raw_ostream &OS, const PrintingPolicy &Policy)
void setName(DeclarationName N)
setName - Sets the embedded declaration name.
DeclarationName getCXXDestructorName(CanQualType Ty)
getCXXDestructorName - Returns the name of a C++ destructor for the given Type.
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.
TypeSourceInfo * getNamedTypeInfo() const
getNamedTypeInfo - Returns the source type info associated to the name.
void setCXXOperatorNameRange(SourceRange R)
setCXXOperatorNameRange - Sets the range of the operator name (without the operator keyword)...
DeclarationName(const IdentifierInfo *II)
static clang::DeclarationName getTombstoneKey()
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
static unsigned getHashValue(clang::DeclarationName Name)
SourceLocation getLoc() const
getLoc - Returns the main location of the declaration name.
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:873
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
friend class ASTContext
Definition: Type.h:4178
bool isEmpty() const
Evaluates true when this declaration name is empty.
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 ...
DeclarationName(Selector Sel)
#define bool
Definition: stdbool.h:31
static clang::DeclarationName getEmptyKey()
static DeclarationName getFromOpaqueInteger(uintptr_t P)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
SourceLocation getLocEnd() const LLVM_READONLY
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
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.
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:75
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc)
Kind
Encodes a location in the source.
bool isValid() const
Return true if this is a valid SourceLocation object.
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
const std::string ID
std::string getAsString() const
getAsString - Retrieve the human-readable string for this name.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
DeclarationName getIdentifier(const IdentifierInfo *ID)
getIdentifier - Create a declaration name that is a simple identifier.
Represents a canonical, potentially-qualified type.
Definition: CanonicalType.h:52
CanQual< Type > CanQualType
Represents a canonical, potentially-qualified type.
SourceLocation getBegin() const
bool operator>=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
bool operator<(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
DeclarationName getCXXSpecialName(DeclarationName::NameKind Kind, CanQualType Ty)
getCXXSpecialName - Returns a declaration name for special kind of C++ name, e.g., for a constructor, destructor, or conversion function.
DeclarationNameLoc - Additional source/type location info for a declaration name. ...
Selector getObjCSelector() const
getObjCSelector - Get the Objective-C selector stored in this declaration name.
SourceRange getCXXOperatorNameRange() const
getCXXOperatorNameRange - Gets the range of the operator name (without the operator keyword)...
SourceLocation getLocStart() const LLVM_READONLY
uintptr_t getAsOpaqueInteger() const
getAsOpaqueInteger - Get the representation of this declaration name as an opaque integer...
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc, DeclarationNameLoc LocInfo)
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
Definition: OperatorKinds.h:22
DeclarationName - The name of a declaration.
DeclarationNameLoc & getInfo()
void printName(raw_ostream &OS) const
printName - Print the human-readable name to a stream.
DeclarationNameInfo - A collector data type for bundling together a DeclarationName and the correspnd...
DeclarationName()
DeclarationName - Used to create an empty selector.
void * getAsOpaquePtr() const
getAsOpaquePtr - Get the representation of this declaration name as an opaque pointer.
struct CXXLitOpName CXXLiteralOperatorName
SourceRange getSourceRange() const LLVM_READONLY
getSourceRange - The range of the declaration name.
static DeclarationName getTombstoneMarker()
const DeclarationNameLoc & getInfo() const
bool isInstantiationDependent() const
Determine whether this name involves a template parameter.
Implements a partial diagnostic that can be emitted anwyhere in a DiagnosticBuilder stream...
bool isObjCZeroArgSelector() const
void setNamedTypeInfo(TypeSourceInfo *TInfo)
setNamedTypeInfo - Sets the source type info associated to the name.
void setLoc(SourceLocation L)
setLoc - Sets the main location of the declaration name.
DeclarationName getCXXLiteralOperatorName(IdentifierInfo *II)
getCXXLiteralOperatorName - Get the name of the literal operator function with II as the identifier...
bool containsUnexpandedParameterPack() const
Determine whether this name contains an unexpanded parameter pack.
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
Definition: Decl.h:213
static DeclarationName getUsingDirectiveName()
getUsingDirectiveName - Return name for all using-directives.
T * getFETokenInfo() const
getFETokenInfo/setFETokenInfo - The language front-end is allowed to associate arbitrary metadata wit...
static DeclarationName getEmptyMarker()
DeclarationName getCXXOperatorName(OverloadedOperatorKind Op)
getCXXOperatorName - Get the name of the overloadable C++ operator corresponding to Op...