clang API Documentation

Classes | Public Types | Public Member Functions | Public Attributes
clang::UnqualifiedId Class Reference

Represents a C++ unqualified-id that has been parsed. More...

#include <DeclSpec.h>

Collaboration diagram for clang::UnqualifiedId:
Collaboration graph
[legend]

List of all members.

Classes

struct  OFI

Public Types

enum  IdKind {
  IK_Identifier, IK_OperatorFunctionId, IK_ConversionFunctionId, IK_LiteralOperatorId,
  IK_ConstructorName, IK_ConstructorTemplateId, IK_DestructorName, IK_TemplateId,
  IK_ImplicitSelfParam
}
 Describes the kind of unqualified-id parsed. More...

Public Member Functions

 UnqualifiedId ()
void clear ()
 Clear out this unqualified-id, setting it to default (invalid) state.
bool isValid () const
 Determine whether this unqualified-id refers to a valid name.
bool isInvalid () const
 Determine whether this unqualified-id refers to an invalid name.
IdKind getKind () const
 Determine what kind of name we have.
void setKind (IdKind kind)
void setIdentifier (const IdentifierInfo *Id, SourceLocation IdLoc)
 Specify that this unqualified-id was parsed as an identifier.
void setOperatorFunctionId (SourceLocation OperatorLoc, OverloadedOperatorKind Op, SourceLocation SymbolLocations[3])
 Specify that this unqualified-id was parsed as an operator-function-id.
void setConversionFunctionId (SourceLocation OperatorLoc, ParsedType Ty, SourceLocation EndLoc)
 Specify that this unqualified-id was parsed as a conversion-function-id.
void setLiteralOperatorId (const IdentifierInfo *Id, SourceLocation OpLoc, SourceLocation IdLoc)
 Specific that this unqualified-id was parsed as a literal-operator-id.
void setConstructorName (ParsedType ClassType, SourceLocation ClassNameLoc, SourceLocation EndLoc)
 Specify that this unqualified-id was parsed as a constructor name.
void setConstructorTemplateId (TemplateIdAnnotation *TemplateId)
 Specify that this unqualified-id was parsed as a template-id that names a constructor.
void setDestructorName (SourceLocation TildeLoc, ParsedType ClassType, SourceLocation EndLoc)
 Specify that this unqualified-id was parsed as a destructor name.
void setTemplateId (TemplateIdAnnotation *TemplateId)
 Specify that this unqualified-id was parsed as a template-id.
SourceRange getSourceRange () const LLVM_READONLY
 Return the source range that covers this unqualified-id.
SourceLocation getLocStart () const LLVM_READONLY
SourceLocation getLocEnd () const LLVM_READONLY

Public Attributes

enum clang::UnqualifiedId::IdKind Kind
union {
   IdentifierInfo *   Identifier
 When Kind == IK_Identifier, the parsed identifier, or when Kind == IK_UserLiteralId, the identifier suffix.
   struct OFI   OperatorFunctionId
 When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.
   UnionParsedType   ConversionFunctionId
 When Kind == IK_ConversionFunctionId, the type that the conversion function names.
   UnionParsedType   ConstructorName
 When Kind == IK_ConstructorName, the class-name of the type whose constructor is being referenced.
   UnionParsedType   DestructorName
 When Kind == IK_DestructorName, the type referred to by the class-name.
   TemplateIdAnnotation *   TemplateId
 When Kind == IK_TemplateId or IK_ConstructorTemplateId, the template-id annotation that contains the template name and template arguments.
}; 
 Anonymous union that holds extra data associated with the parsed unqualified-id.
SourceLocation StartLocation
 The location of the first token that describes this unqualified-id, which will be the location of the identifier, "operator" keyword, tilde (for a destructor), or the template name of a template-id.
SourceLocation EndLocation
 The location of the last token that describes this unqualified-id.

Detailed Description

Represents a C++ unqualified-id that has been parsed.

Definition at line 846 of file DeclSpec.h.


Member Enumeration Documentation

Describes the kind of unqualified-id parsed.

Enumerator:
IK_Identifier 

An identifier.

IK_OperatorFunctionId 

An overloaded operator name, e.g., operator+.

IK_ConversionFunctionId 

A conversion function name, e.g., operator int.

IK_LiteralOperatorId 

A user-defined literal name, e.g., operator "" _i.

IK_ConstructorName 

A constructor name.

IK_ConstructorTemplateId 

A constructor named via a template-id.

IK_DestructorName 

A destructor name.

IK_TemplateId 

A template-id, e.g., f<int>.

IK_ImplicitSelfParam 

An implicit 'self' parameter.

Definition at line 853 of file DeclSpec.h.


Constructor & Destructor Documentation

clang::UnqualifiedId::UnqualifiedId ( ) [inline]

Definition at line 925 of file DeclSpec.h.


Member Function Documentation

void clang::UnqualifiedId::clear ( ) [inline]

Clear out this unqualified-id, setting it to default (invalid) state.

Definition at line 929 of file DeclSpec.h.

References EndLocation, Identifier, IK_Identifier, and StartLocation.

Referenced by clang::Declarator::clear().

Definition at line 1053 of file DeclSpec.h.

References EndLocation.

Determine whether this unqualified-id refers to an invalid name.

Definition at line 940 of file DeclSpec.h.

References isValid().

bool clang::UnqualifiedId::isValid ( ) const [inline]

Determine whether this unqualified-id refers to a valid name.

Definition at line 937 of file DeclSpec.h.

References clang::SourceLocation::isValid(), and StartLocation.

Referenced by isInvalid(), clang::Declarator::isPastIdentifier(), and setOperatorFunctionId().

void clang::UnqualifiedId::setConstructorName ( ParsedType  ClassType,
SourceLocation  ClassNameLoc,
SourceLocation  EndLoc 
) [inline]

Specify that this unqualified-id was parsed as a constructor name.

Parameters:
ClassTypethe class type referred to by the constructor name.
ClassNameLocthe location of the class name.
EndLocthe location of the last token that makes up the type name.

Definition at line 1009 of file DeclSpec.h.

References ConstructorName, EndLocation, IK_ConstructorName, and StartLocation.

Referenced by clang::Parser::ParseUnqualifiedId().

Specify that this unqualified-id was parsed as a template-id that names a constructor.

Parameters:
TemplateIdthe template-id annotation that describes the parsed template-id. This UnqualifiedId instance will take ownership of the TemplateId and will free it on destruction.

Definition at line 49 of file DeclSpec.cpp.

References EndLocation, IK_ConstructorTemplateId, clang::TemplateIdAnnotation::RAngleLoc, StartLocation, TemplateId, and clang::TemplateIdAnnotation::TemplateNameLoc.

Referenced by clang::Parser::ParseUnqualifiedId().

Specify that this unqualified-id was parsed as a conversion-function-id.

Parameters:
OperatorLocthe location of the 'operator' keyword.
Tythe type to which this conversion function is converting.
EndLocthe location of the last token that makes up the type name.

Definition at line 977 of file DeclSpec.h.

References ConversionFunctionId, EndLocation, IK_ConversionFunctionId, and StartLocation.

void clang::UnqualifiedId::setDestructorName ( SourceLocation  TildeLoc,
ParsedType  ClassType,
SourceLocation  EndLoc 
) [inline]

Specify that this unqualified-id was parsed as a destructor name.

Parameters:
TildeLocthe location of the '~' that introduces the destructor name.
ClassTypethe name of the class referred to by the destructor name.

Definition at line 1032 of file DeclSpec.h.

References DestructorName, EndLocation, IK_DestructorName, and StartLocation.

Referenced by clang::Parser::ParseUnqualifiedId().

void clang::UnqualifiedId::setIdentifier ( const IdentifierInfo Id,
SourceLocation  IdLoc 
) [inline]
void clang::UnqualifiedId::setKind ( IdKind  kind) [inline]

Definition at line 944 of file DeclSpec.h.

Referenced by clang::Sema::LookupInObjCMethod().

void clang::UnqualifiedId::setLiteralOperatorId ( const IdentifierInfo Id,
SourceLocation  OpLoc,
SourceLocation  IdLoc 
) [inline]

Specific that this unqualified-id was parsed as a literal-operator-id.

Parameters:
Idthe parsed identifier.
OpLocthe location of the 'operator' keyword.
IdLocthe location of the identifier.

Definition at line 994 of file DeclSpec.h.

References EndLocation, Identifier, IK_LiteralOperatorId, and StartLocation.

void UnqualifiedId::setOperatorFunctionId ( SourceLocation  OperatorLoc,
OverloadedOperatorKind  Op,
SourceLocation  SymbolLocations[3] 
)

Specify that this unqualified-id was parsed as an operator-function-id.

Parameters:
OperatorLocthe location of the 'operator' keyword.
Opthe overloaded operator.
SymbolLocationsthe locations of the individual operator symbols in the operator.

Definition at line 1199 of file DeclSpec.cpp.

References EndLocation, clang::SourceLocation::getRawEncoding(), IK_OperatorFunctionId, isValid(), clang::UnqualifiedId::OFI::Operator, OperatorFunctionId, StartLocation, and clang::UnqualifiedId::OFI::SymbolLocations.

Referenced by ParseReductionId(), and clang::TreeTransform< Derived >::RebuildTemplateName().

Specify that this unqualified-id was parsed as a template-id.

Parameters:
TemplateIdthe template-id annotation that describes the parsed template-id. This UnqualifiedId instance will take ownership of the TemplateId and will free it on destruction.

Definition at line 41 of file DeclSpec.cpp.

References EndLocation, IK_TemplateId, clang::TemplateIdAnnotation::RAngleLoc, StartLocation, TemplateId, and clang::TemplateIdAnnotation::TemplateNameLoc.

Referenced by clang::Parser::ParseUnqualifiedId().


Member Data Documentation

union { ... }

Anonymous union that holds extra data associated with the parsed unqualified-id.

When Kind == IK_ConstructorName, the class-name of the type whose constructor is being referenced.

Definition at line 905 of file DeclSpec.h.

Referenced by clang::Sema::GetNameFromUnqualifiedId(), and setConstructorName().

When Kind == IK_ConversionFunctionId, the type that the conversion function names.

Definition at line 901 of file DeclSpec.h.

Referenced by clang::Sema::CheckConversionDeclarator(), GetDeclSpecTypeForDeclarator(), clang::Sema::GetNameFromUnqualifiedId(), and setConversionFunctionId().

When Kind == IK_DestructorName, the type referred to by the class-name.

Definition at line 909 of file DeclSpec.h.

Referenced by clang::Sema::CheckDestructorDeclarator(), clang::Sema::GetNameFromUnqualifiedId(), and setDestructorName().

When Kind == IK_OperatorFunctionId, the overloaded operator that we parsed.

Definition at line 897 of file DeclSpec.h.

Referenced by clang::Sema::ActOnDependentTemplateName(), clang::Sema::GetNameFromUnqualifiedId(), clang::Sema::isTemplateName(), and setOperatorFunctionId().


The documentation for this class was generated from the following files: