clang  6.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/Basic/Diagnostic.h"
21 #include "llvm/ADT/DenseMapInfo.h"
22 #include "llvm/Support/Compiler.h"
23 #include "llvm/Support/type_traits.h"
24 #include <cassert>
25 #include <cstdint>
26 #include <cstring>
27 #include <string>
28 
29 namespace clang {
30 
31 class ASTContext;
32 template <typename> class CanQual;
33 class CXXDeductionGuideNameExtra;
34 class CXXLiteralOperatorIdName;
35 class CXXOperatorIdName;
36 class CXXSpecialName;
37 class DeclarationNameExtra;
38 class IdentifierInfo;
39 class MultiKeywordSelector;
40 enum OverloadedOperatorKind : int;
41 struct PrintingPolicy;
42 class QualType;
43 class TemplateDecl;
44 class Type;
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  /// \brief 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  /// \brief 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 /// DeclarationNameTable - Used to store and retrieve DeclarationName
347 /// instances for the various kinds of declaration names, e.g., normal
348 /// identifiers, C++ constructor names, etc. This class contains
349 /// uniqued versions of each of the C++ special names, which can be
350 /// retrieved using its member functions (e.g.,
351 /// getCXXConstructorName).
353  const ASTContext &Ctx;
354 
355  // Actually a FoldingSet<CXXSpecialName> *
356  void *CXXSpecialNamesImpl;
357 
358  // Operator names
359  CXXOperatorIdName *CXXOperatorNames;
360 
361  // Actually a CXXOperatorIdName*
362  void *CXXLiteralOperatorNames;
363 
364  // FoldingSet<CXXDeductionGuideNameExtra> *
365  void *CXXDeductionGuideNames;
366 
367 public:
369  DeclarationNameTable(const DeclarationNameTable &) = delete;
370  DeclarationNameTable &operator=(const DeclarationNameTable &) = delete;
371 
373 
374  /// getIdentifier - Create a declaration name that is a simple
375  /// identifier.
377  return DeclarationName(ID);
378  }
379 
380  /// getCXXConstructorName - Returns the name of a C++ constructor
381  /// for the given Type.
382  DeclarationName getCXXConstructorName(CanQualType Ty);
383 
384  /// getCXXDestructorName - Returns the name of a C++ destructor
385  /// for the given Type.
386  DeclarationName getCXXDestructorName(CanQualType Ty);
387 
388  /// Returns the name of a C++ deduction guide for the given template.
389  DeclarationName getCXXDeductionGuideName(TemplateDecl *TD);
390 
391  /// getCXXConversionFunctionName - Returns the name of a C++
392  /// conversion function for the given Type.
393  DeclarationName getCXXConversionFunctionName(CanQualType Ty);
394 
395  /// getCXXSpecialName - Returns a declaration name for special kind
396  /// of C++ name, e.g., for a constructor, destructor, or conversion
397  /// function.
398  DeclarationName getCXXSpecialName(DeclarationName::NameKind Kind,
399  CanQualType Ty);
400 
401  /// getCXXOperatorName - Get the name of the overloadable C++
402  /// operator corresponding to Op.
403  DeclarationName getCXXOperatorName(OverloadedOperatorKind Op);
404 
405  /// getCXXLiteralOperatorName - Get the name of the literal operator function
406  /// with II as the identifier.
407  DeclarationName getCXXLiteralOperatorName(IdentifierInfo *II);
408 };
409 
410 /// DeclarationNameLoc - Additional source/type location info
411 /// for a declaration name. Needs a DeclarationName in order
412 /// to be interpreted correctly.
414  // The source location for identifier stored elsewhere.
415  // struct {} Identifier;
416 
417  // Type info for constructors, destructors and conversion functions.
418  // Locations (if any) for the tilde (destructor) or operator keyword
419  // (conversion) are stored elsewhere.
420  struct NT {
422  };
423 
424  // The location (if any) of the operator keyword is stored elsewhere.
425  struct CXXOpName {
426  unsigned BeginOpNameLoc;
427  unsigned EndOpNameLoc;
428  };
429 
430  // The location (if any) of the operator keyword is stored elsewhere.
431  struct CXXLitOpName {
432  unsigned OpNameLoc;
433  };
434 
435  // struct {} CXXUsingDirective;
436  // struct {} ObjCZeroArgSelector;
437  // struct {} ObjCOneArgSelector;
438  // struct {} ObjCMultiArgSelector;
439  union {
440  struct NT NamedType;
443  };
444 
446 
447  // FIXME: this should go away once all DNLocs are properly initialized.
448  DeclarationNameLoc() { memset((void*) this, 0, sizeof(*this)); }
449 };
450 
451 /// DeclarationNameInfo - A collector data type for bundling together
452 /// a DeclarationName and the correspnding source/type location info.
454 private:
455  /// Name - The declaration name, also encoding name kind.
456  DeclarationName Name;
457 
458  /// Loc - The main source location for the declaration name.
459  SourceLocation NameLoc;
460 
461  /// Info - Further source/type location info for special kinds of names.
462  DeclarationNameLoc LocInfo;
463 
464 public:
465  // FIXME: remove it.
466  DeclarationNameInfo() = default;
467 
469  : Name(Name), NameLoc(NameLoc), LocInfo(Name) {}
470 
472  DeclarationNameLoc LocInfo)
473  : Name(Name), NameLoc(NameLoc), LocInfo(LocInfo) {}
474 
475  /// getName - Returns the embedded declaration name.
476  DeclarationName getName() const { return Name; }
477 
478  /// setName - Sets the embedded declaration name.
479  void setName(DeclarationName N) { Name = N; }
480 
481  /// getLoc - Returns the main location of the declaration name.
482  SourceLocation getLoc() const { return NameLoc; }
483 
484  /// setLoc - Sets the main location of the declaration name.
485  void setLoc(SourceLocation L) { NameLoc = L; }
486 
487  const DeclarationNameLoc &getInfo() const { return LocInfo; }
488  DeclarationNameLoc &getInfo() { return LocInfo; }
489  void setInfo(const DeclarationNameLoc &Info) { LocInfo = Info; }
490 
491  /// getNamedTypeInfo - Returns the source type info associated to
492  /// the name. Assumes it is a constructor, destructor or conversion.
497  return LocInfo.NamedType.TInfo;
498  }
499 
500  /// setNamedTypeInfo - Sets the source type info associated to
501  /// the name. Assumes it is a constructor, destructor or conversion.
506  LocInfo.NamedType.TInfo = TInfo;
507  }
508 
509  /// getCXXOperatorNameRange - Gets the range of the operator name
510  /// (without the operator keyword). Assumes it is a (non-literal) operator.
513  return SourceRange(
516  );
517  }
518 
519  /// setCXXOperatorNameRange - Sets the range of the operator name
520  /// (without the operator keyword). Assumes it is a C++ operator.
525  }
526 
527  /// getCXXLiteralOperatorNameLoc - Returns the location of the literal
528  /// operator name (not the operator keyword).
529  /// Assumes it is a literal operator.
532  return SourceLocation::
534  }
535 
536  /// setCXXLiteralOperatorNameLoc - Sets the location of the literal
537  /// operator name (not the operator keyword).
538  /// Assumes it is a literal operator.
542  }
543 
544  /// \brief Determine whether this name involves a template parameter.
545  bool isInstantiationDependent() const;
546 
547  /// \brief Determine whether this name contains an unexpanded
548  /// parameter pack.
549  bool containsUnexpandedParameterPack() const;
550 
551  /// getAsString - Retrieve the human-readable string for this name.
552  std::string getAsString() const;
553 
554  /// printName - Print the human-readable name to a stream.
555  void printName(raw_ostream &OS) const;
556 
557  /// getBeginLoc - Retrieve the location of the first token.
558  SourceLocation getBeginLoc() const { return NameLoc; }
559 
560  /// getEndLoc - Retrieve the location of the last token.
561  SourceLocation getEndLoc() const;
562 
563  /// getSourceRange - The range of the declaration name.
564  SourceRange getSourceRange() const LLVM_READONLY {
565  return SourceRange(getLocStart(), getLocEnd());
566  }
567 
568  SourceLocation getLocStart() const LLVM_READONLY {
569  return getBeginLoc();
570  }
571 
572  SourceLocation getLocEnd() const LLVM_READONLY {
573  SourceLocation EndLoc = getEndLoc();
574  return EndLoc.isValid() ? EndLoc : getLocStart();
575  }
576 };
577 
578 /// Insertion operator for diagnostics. This allows sending DeclarationName's
579 /// into a diagnostic with <<.
581  DeclarationName N) {
584  return DB;
585 }
586 
587 /// Insertion operator for partial diagnostics. This allows binding
588 /// DeclarationName's into a partial diagnostic with <<.
590  DeclarationName N) {
593  return PD;
594 }
595 
596 inline raw_ostream &operator<<(raw_ostream &OS,
597  DeclarationNameInfo DNInfo) {
598  DNInfo.printName(OS);
599  return OS;
600 }
601 
602 } // namespace clang
603 
604 namespace llvm {
605 
606 /// Define DenseMapInfo so that DeclarationNames can be used as keys
607 /// in DenseMap and DenseSets.
608 template<>
612  }
613 
616  }
617 
618  static unsigned getHashValue(clang::DeclarationName Name) {
620  }
621 
622  static inline bool
624  return LHS == RHS;
625  }
626 };
627 
628 template <>
629 struct isPodLike<clang::DeclarationName> { static const bool value = true; };
630 
631 } // namespace llvm
632 
633 #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:653
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
DominatorTree GraphTraits specialization so the DominatorTree can be iterable by generic graph iterat...
Definition: Dominators.h:26
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:195
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
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 AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
Definition: Diagnostic.h:1069
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:149
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...
DeclarationName(const IdentifierInfo *II)
Defines the Diagnostic-related interfaces.
static clang::DeclarationName getTombstoneKey()
static unsigned getHashValue(clang::DeclarationName Name)
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
A little helper class used to produce diagnostics.
Definition: Diagnostic.h:955
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.
const FunctionProtoType * T
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.
SourceLocation getLocEnd() const LLVM_READONLY
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
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc)
T * getFETokenInfo() const
getFETokenInfo/setFETokenInfo - The language front-end is allowed to associate arbitrary metadata wit...
bool isObjCOneArgSelector() const
The l-value was considered opaque, so the alignment was determined from a type.
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
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.
bool operator>=(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
bool operator<(DeclarationName LHS, DeclarationName RHS)
Ordering on two declaration names.
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. ...
Dataflow Directional Tag Classes.
bool isValid() const
Return true if this is a valid SourceLocation object.
SourceLocation getLocStart() const LLVM_READONLY
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.
A trivial tuple used to represent a source range.
NamedDecl - This represents a decl with a name.
Definition: Decl.h:245
static DeclarationName getUsingDirectiveName()
getUsingDirectiveName - Return name for all using-directives.
static DeclarationName getEmptyMarker()
SourceLocation getBegin() const
bool isObjCZeroArgSelector() const
friend class DeclarationNameTable