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;
36 class UsingDirectiveDecl;
38 template <
typename>
class CanQual;
72 StoredObjCZeroArgSelector = 0x01,
73 StoredObjCOneArgSelector = 0x02,
74 StoredDeclarationNameExtra = 0x03,
102 StoredNameKind getStoredNameKind()
const {
103 return static_cast<StoredNameKind
>(Ptr & PtrMask);
108 DeclarationNameExtra *getExtra()
const {
109 assert(getStoredNameKind() == StoredDeclarationNameExtra &&
110 "Declaration name does not store an Extra structure");
111 return reinterpret_cast<DeclarationNameExtra *
>(Ptr & ~PtrMask);
117 CXXSpecialName *getAsCXXSpecialName()
const {
120 return reinterpret_cast<CXXSpecialName *
>(Ptr & ~PtrMask);
125 CXXOperatorIdName *getAsCXXOperatorIdName()
const {
127 return reinterpret_cast<CXXOperatorIdName *
>(Ptr & ~PtrMask);
131 CXXLiteralOperatorIdName *getAsCXXLiteralOperatorIdName()
const {
133 return reinterpret_cast<CXXLiteralOperatorIdName *
>(Ptr & ~PtrMask);
140 : Ptr(reinterpret_cast<uintptr_t>(Name)) {
141 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned CXXSpecialName");
142 Ptr |= StoredDeclarationNameExtra;
148 : Ptr(reinterpret_cast<uintptr_t>(Name)) {
149 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned CXXOperatorId");
150 Ptr |= StoredDeclarationNameExtra;
154 : Ptr(reinterpret_cast<uintptr_t>(Name)) {
155 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned CXXLiteralOperatorId");
156 Ptr |= StoredDeclarationNameExtra;
167 void *getFETokenInfoAsVoidSlow()
const;
175 : Ptr(reinterpret_cast<uintptr_t>(II)) {
176 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned IdentifierInfo");
187 explicit operator bool()
const {
188 return ((Ptr & PtrMask) != 0) ||
198 bool isIdentifier()
const {
return getStoredNameKind() == StoredIdentifier; }
200 return getStoredNameKind() == StoredObjCZeroArgSelector;
203 return getStoredNameKind() == StoredObjCOneArgSelector;
239 N.Ptr =
reinterpret_cast<uintptr_t
> (
P);
269 Ptr == 0) &&
"Not a selector!");
280 return Info->getFETokenInfo<T>();
281 return static_cast<T*
>(getFETokenInfoAsVoidSlow());
288 return LHS.Ptr == RHS.Ptr;
293 return LHS.Ptr != RHS.Ptr;
309 raw_ostream &
operator<<(raw_ostream &OS, DeclarationName N);
343 void *CXXSpecialNamesImpl;
345 void *CXXLiteralOperatorNames;
444 : Name(Name), NameLoc(NameLoc), LocInfo(Name) {}
448 : Name(Name), NameLoc(NameLoc), LocInfo(LocInfo) {}
594 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.
static bool isEqual(clang::DeclarationName LHS, clang::DeclarationName RHS)
NameKind
NameKind - The kind of name this object contains.
SourceLocation getCXXLiteralOperatorNameLoc() const
SourceLocation getEndLoc() const
getEndLoc - Retrieve the location of the last token.
IdentifierInfo * getCXXLiteralIdentifier() const
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
IdentifierInfo * getAsIdentifierInfo() const
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)
bool operator<=(DeclarationName LHS, DeclarationName RHS)
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
DeclarationName getName() const
getName - Returns the embedded declaration name.
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 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)
TypeSourceInfo * getNamedTypeInfo() const
void setCXXOperatorNameRange(SourceRange R)
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.
ID
Defines the set of possible language-specific address spaces.
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
struct CXXOpName CXXOperatorName
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc)
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
bool isValid() const
Return true if this is a valid SourceLocation object.
OverloadedOperatorKind getCXXOverloadedOperator() const
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)
bool operator<(DeclarationName LHS, DeclarationName RHS)
Selector getObjCSelector() const
SourceRange getCXXOperatorNameRange() const
SourceLocation getLocStart() const LLVM_READONLY
uintptr_t getAsOpaqueInteger() const
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc, DeclarationNameLoc LocInfo)
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
DeclarationNameLoc & getInfo()
void printName(raw_ostream &OS) const
printName - Print the human-readable name to a stream.
DeclarationName()
DeclarationName - Used to create an empty selector.
void * getAsOpaquePtr() const
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)
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.
static DeclarationName getUsingDirectiveName()
getUsingDirectiveName - Return name for all using-directives.
T * getFETokenInfo() const
static DeclarationName getEmptyMarker()