14 #ifndef LLVM_CLANG_AST_DECLARATIONNAME_H 15 #define LLVM_CLANG_AST_DECLARATIONNAME_H 21 #include "llvm/ADT/DenseMapInfo.h" 22 #include "llvm/Support/Compiler.h" 23 #include "llvm/Support/type_traits.h" 32 template <
typename>
class CanQual;
33 class CXXDeductionGuideNameExtra;
34 class CXXLiteralOperatorIdName;
35 class CXXOperatorIdName;
37 class DeclarationNameExtra;
39 class MultiKeywordSelector;
41 struct PrintingPolicy;
46 class UsingDirectiveDecl;
86 StoredObjCZeroArgSelector = 0x01,
87 StoredObjCOneArgSelector = 0x02,
88 StoredDeclarationNameExtra = 0x03,
117 : Ptr(reinterpret_cast<
uintptr_t>(Name)) {
118 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned DeclarationNameExtra");
119 Ptr |= StoredDeclarationNameExtra;
127 StoredNameKind getStoredNameKind()
const {
128 return static_cast<StoredNameKind
>(Ptr & PtrMask);
134 assert(getStoredNameKind() == StoredDeclarationNameExtra &&
135 "Declaration name does not store an Extra structure");
172 void *getFETokenInfoAsVoidSlow()
const;
181 assert((Ptr & PtrMask) == 0 &&
"Improperly aligned IdentifierInfo");
192 explicit operator bool()
const {
193 return ((Ptr & PtrMask) != 0) ||
203 bool isIdentifier()
const {
return getStoredNameKind() == StoredIdentifier; }
205 return getStoredNameKind() == StoredObjCZeroArgSelector;
208 return getStoredNameKind() == StoredObjCOneArgSelector;
278 Ptr == 0) &&
"Not a selector!");
289 return Info->getFETokenInfo<T>();
290 return static_cast<T*
>(getFETokenInfoAsVoidSlow());
297 return LHS.Ptr == RHS.Ptr;
302 return LHS.Ptr != RHS.Ptr;
356 void *CXXSpecialNamesImpl;
362 void *CXXLiteralOperatorNames;
365 void *CXXDeductionGuideNames;
469 : Name(Name), NameLoc(NameLoc), LocInfo(Name) {}
473 : Name(Name), NameLoc(NameLoc), LocInfo(LocInfo) {}
545 bool isInstantiationDependent()
const;
549 bool containsUnexpandedParameterPack()
const;
555 void printName(raw_ostream &OS)
const;
570 return EndLoc.
isValid() ? EndLoc : getLocStart();
632 #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.
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...
void AddTaggedVal(intptr_t V, DiagnosticsEngine::ArgumentKind Kind) const
Selector getObjCSelector() const
getObjCSelector - Get the Objective-C selector stored in this declaration name.
const DiagnosticBuilder & operator<<(const DiagnosticBuilder &DB, const Attr *At)
SourceLocation getBeginLoc() const
getBeginLoc - Retrieve the location of the first token.
SourceLocation getEndLoc() const LLVM_READONLY
A container of type source information.
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. ...
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
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 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 ...
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()
__DEVICE__ void * memset(void *__a, int __b, size_t __c)
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.
OverloadedOperatorKind getCXXOverloadedOperator() const
getCXXOverloadedOperator - If this name is the name of an overloadable operator in C++ (e...
friend bool operator!=(DeclarationName LHS, DeclarationName RHS)
operator!= - Determine whether the specified names are different.
std::string getAsString() const
getNameAsString - Retrieve the human-readable string for this name.
DeclarationName(Selector Sel)
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'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...
DeclarationNameInfo(DeclarationName Name, SourceLocation NameLoc)
T * getFETokenInfo() const
getFETokenInfo/setFETokenInfo - The language front-end is allowed to associate arbitrary metadata wit...
bool isObjCOneArgSelector() const
IdentifierInfo * getCXXLiteralIdentifier() const
getCXXLiteralIdentifier - If this name is the name of a literal operator, retrieve the identifier ass...
Encodes a location in the source.
DeclarationName getName() const
getName - Returns the embedded declaration name.
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.).
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
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.
void setFETokenInfo(void *T)
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.
This represents a decl that may have a name.
static DeclarationName getUsingDirectiveName()
getUsingDirectiveName - Return name for all using-directives.
static DeclarationName getEmptyMarker()
SourceLocation getBegin() const
bool isObjCZeroArgSelector() const
friend class DeclarationNameTable