13 #ifndef LLVM_CLANG_AST_DECLARATIONNAME_H
14 #define LLVM_CLANG_AST_DECLARATIONNAME_H
18 #include "llvm/Support/Compiler.h"
26 class CXXLiteralOperatorIdName;
27 class CXXOperatorIdName;
29 class DeclarationNameExtra;
31 class MultiKeywordSelector;
33 struct PrintingPolicy;
37 class UsingDirectiveDecl;
39 template <
typename>
class CanQual;
73 StoredObjCZeroArgSelector = 0x01,
74 StoredObjCOneArgSelector = 0x02,
75 StoredDeclarationNameExtra = 0x03,
103 StoredNameKind getStoredNameKind()
const {
104 return static_cast<StoredNameKind
>(Ptr & PtrMask);
109 DeclarationNameExtra *getExtra()
const {
110 assert(getStoredNameKind() == StoredDeclarationNameExtra &&
111 "Declaration name does not store an Extra structure");
112 return reinterpret_cast<DeclarationNameExtra *
>(Ptr & ~PtrMask);
118 CXXSpecialName *getAsCXXSpecialName()
const {
121 return reinterpret_cast<CXXSpecialName *
>(Ptr & ~PtrMask);
126 CXXOperatorIdName *getAsCXXOperatorIdName()
const {
128 return reinterpret_cast<CXXOperatorIdName *
>(Ptr & ~PtrMask);
132 CXXLiteralOperatorIdName *getAsCXXLiteralOperatorIdName()
const {
134 return reinterpret_cast<CXXLiteralOperatorIdName *
>(Ptr & ~PtrMask);
141 : Ptr(reinterpret_cast<
uintptr_t>(Name)) {
142 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned CXXSpecialName");
143 Ptr |= StoredDeclarationNameExtra;
149 : Ptr(reinterpret_cast<
uintptr_t>(Name)) {
150 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned CXXOperatorId");
151 Ptr |= StoredDeclarationNameExtra;
155 : Ptr(reinterpret_cast<
uintptr_t>(Name)) {
156 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned CXXLiteralOperatorId");
157 Ptr |= StoredDeclarationNameExtra;
168 void *getFETokenInfoAsVoidSlow()
const;
177 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned IdentifierInfo");
188 explicit operator bool()
const {
189 return ((Ptr & PtrMask) != 0) ||
199 bool isIdentifier()
const {
return getStoredNameKind() == StoredIdentifier; }
201 return getStoredNameKind() == StoredObjCZeroArgSelector;
204 return getStoredNameKind() == StoredObjCOneArgSelector;
270 Ptr == 0) &&
"Not a selector!");
281 return Info->getFETokenInfo<T>();
282 return static_cast<T*
>(getFETokenInfoAsVoidSlow());
289 return LHS.Ptr == RHS.Ptr;
294 return LHS.Ptr != RHS.Ptr;
312 raw_ostream &
operator<<(raw_ostream &OS, DeclarationName N);
346 void *CXXSpecialNamesImpl;
348 void *CXXLiteralOperatorNames;
447 : Name(Name), NameLoc(NameLoc), LocInfo(Name) {}
451 : Name(Name), NameLoc(NameLoc), LocInfo(LocInfo) {}
597 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.
class LLVM_ALIGNAS(8) DependentTemplateSpecializationType const IdentifierInfo * Name
Represents a template specialization type whose template cannot be resolved, e.g. ...
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.
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
Represents a canonical, potentially-qualified type.
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)
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()