13 #ifndef LLVM_CLANG_AST_DECLARATIONNAME_H
14 #define LLVM_CLANG_AST_DECLARATIONNAME_H
18 #include "llvm/Support/Compiler.h"
26 class CXXDeductionGuideNameExtra;
27 class CXXLiteralOperatorIdName;
28 class CXXOperatorIdName;
30 class DeclarationNameExtra;
32 class MultiKeywordSelector;
34 struct PrintingPolicy;
39 class UsingDirectiveDecl;
41 template <
typename>
class CanQual;
76 StoredObjCZeroArgSelector = 0x01,
77 StoredObjCOneArgSelector = 0x02,
78 StoredDeclarationNameExtra = 0x03,
106 StoredNameKind getStoredNameKind()
const {
107 return static_cast<StoredNameKind
>(Ptr & PtrMask);
112 DeclarationNameExtra *getExtra()
const {
113 assert(getStoredNameKind() == StoredDeclarationNameExtra &&
114 "Declaration name does not store an Extra structure");
115 return reinterpret_cast<DeclarationNameExtra *
>(Ptr & ~PtrMask);
121 CXXSpecialName *getAsCXXSpecialName()
const {
124 return reinterpret_cast<CXXSpecialName *
>(getExtra());
130 CXXDeductionGuideNameExtra *getAsCXXDeductionGuideNameExtra()
const {
132 return reinterpret_cast<CXXDeductionGuideNameExtra *
>(getExtra());
137 CXXOperatorIdName *getAsCXXOperatorIdName()
const {
139 return reinterpret_cast<CXXOperatorIdName *
>(getExtra());
143 CXXLiteralOperatorIdName *getAsCXXLiteralOperatorIdName()
const {
145 return reinterpret_cast<CXXLiteralOperatorIdName *
>(getExtra());
152 : Ptr(reinterpret_cast<
uintptr_t>(Name)) {
153 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned DeclarationNameExtra");
154 Ptr |= StoredDeclarationNameExtra;
165 void *getFETokenInfoAsVoidSlow()
const;
174 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned IdentifierInfo");
185 explicit operator bool()
const {
186 return ((Ptr & PtrMask) != 0) ||
196 bool isIdentifier()
const {
return getStoredNameKind() == StoredIdentifier; }
198 return getStoredNameKind() == StoredObjCZeroArgSelector;
201 return getStoredNameKind() == StoredObjCOneArgSelector;
271 Ptr == 0) &&
"Not a selector!");
282 return Info->getFETokenInfo<T>();
283 return static_cast<T*
>(getFETokenInfoAsVoidSlow());
290 return LHS.Ptr == RHS.Ptr;
295 return LHS.Ptr != RHS.Ptr;
313 raw_ostream &
operator<<(raw_ostream &OS, DeclarationName N);
347 void *CXXSpecialNamesImpl;
349 void *CXXLiteralOperatorNames;
350 void *CXXDeductionGuideNames;
452 : Name(Name), NameLoc(NameLoc), LocInfo(Name) {}
456 : Name(Name), NameLoc(NameLoc), LocInfo(LocInfo) {}
602 struct isPodLike<clang::DeclarationName> {
static const bool value =
true; };
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.
static bool isEqual(clang::DeclarationName LHS, clang::DeclarationName RHS)
NameKind
NameKind - The kind of name this object contains.
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...
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
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.
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. ...
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
DeclarationName getName() const
getName - Returns the embedded declaration name.
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 ...
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.
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.
NameKind getNameKind() const
getNameKind - Determine what kind of name this is.
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.
TemplateDecl * getCXXDeductionGuideTemplate() const
If this name is the name of a C++ deduction guide, return the template associated with that name...
DeclarationName(Selector Sel)
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...
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc)
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...
std::string getAsString() const
getAsString - Retrieve the human-readable string for this name.
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
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.
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)
The base class of all kinds of template declarations (e.g., class, function, etc.).
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
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.
void setFETokenInfo(void *T)
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.
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()