clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Friends
clang::TypeLoc Class Reference

Base wrapper for a particular "section" of type source info. More...

#include <TypeLoc.h>

Inheritance diagram for clang::TypeLoc:
Inheritance graph
[legend]
Collaboration diagram for clang::TypeLoc:
Collaboration graph
[legend]

List of all members.

Public Types

enum  TypeLocClass

Public Member Functions

template<typename T >
castAs () const
 Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
template<typename T >
getAs () const
 Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired type.
 TypeLoc ()
 TypeLoc (QualType ty, void *opaqueData)
 TypeLoc (const Type *ty, void *opaqueData)
TypeLocClass getTypeLocClass () const
bool isNull () const
LLVM_EXPLICIT operator bool () const
QualType getType () const
 Get the type for which this source info wrapper provides information.
const TypegetTypePtr () const
void * getOpaqueData () const
 Get the pointer where source information is stored.
SourceLocation getBeginLoc () const
 Get the begin source location.
SourceLocation getEndLoc () const
 Get the end source location.
SourceRange getSourceRange () const LLVM_READONLY
 Get the full source range.
SourceLocation getLocStart () const LLVM_READONLY
SourceLocation getLocEnd () const LLVM_READONLY
SourceRange getLocalSourceRange () const
 Get the local source range.
unsigned getFullDataSize () const
 Returns the size of the type source info data block.
TypeLoc getNextTypeLoc () const
 Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next TypeLoc is for "int".
UnqualTypeLoc getUnqualifiedLoc () const
 Skips past any qualifiers, if this is qualified.
TypeLoc IgnoreParens () const
void initialize (ASTContext &Context, SourceLocation Loc) const
 Initializes this to state that every location in this type is the given location.
void initializeFullCopy (TypeLoc Other) const
 Initializes this by copying its information from another TypeLoc of the same type.
void initializeFullCopy (TypeLoc Other, unsigned Size) const
 Initializes this by copying its information from another TypeLoc of the same type. The given size must be the full data size.

Static Public Member Functions

static unsigned getFullDataSizeForType (QualType Ty)
 Returns the size of type source info data block for the given type.
static unsigned getLocalAlignmentForType (QualType Ty)
 Returns the alignment of type source info data block for the given type.

Protected Attributes

const void * Ty
void * Data

Friends

bool operator== (const TypeLoc &LHS, const TypeLoc &RHS)
bool operator!= (const TypeLoc &LHS, const TypeLoc &RHS)

Detailed Description

Base wrapper for a particular "section" of type source info.

A client should use the TypeLoc subclasses through castAs()/getAs() in order to get at the actual information.

Definition at line 40 of file TypeLoc.h.


Member Enumeration Documentation

The kinds of TypeLocs. Equivalent to the Type::TypeClass enum, except it also defines a Qualified enum that corresponds to the QualifiedLoc class.

Definition at line 76 of file TypeLoc.h.


Constructor & Destructor Documentation

Definition at line 84 of file TypeLoc.h.

Referenced by getEndLoc(), and getLocalAlignmentForType().

clang::TypeLoc::TypeLoc ( QualType  ty,
void *  opaqueData 
) [inline]

Definition at line 85 of file TypeLoc.h.

clang::TypeLoc::TypeLoc ( const Type ty,
void *  opaqueData 
) [inline]

Definition at line 87 of file TypeLoc.h.


Member Function Documentation

template<typename T >
T clang::TypeLoc::castAs ( ) const [inline]
template<typename T >
T clang::TypeLoc::getAs ( ) const [inline]

Returns the size of type source info data block for the given type.

Returns the size of the type source info data block.

Definition at line 74 of file TypeLoc.cpp.

References getLocalAlignmentForType(), getNextTypeLoc(), getType(), and isNull().

Referenced by clang::ASTContext::adjustExceptionSpec(), clang::ASTContext::CreateTypeSourceInfo(), and getFullDataSize().

Returns the alignment of type source info data block for the given type.

Returns the alignment of the type source info data block.

Definition at line 56 of file TypeLoc.cpp.

References clang::QualType::isNull(), and TypeLoc().

Referenced by getFullDataSizeForType(), and clang::QualifiedTypeLoc::getUnqualifiedLoc().

Get the local source range.

Reimplemented in clang::AtomicTypeLoc, clang::PackExpansionTypeLoc, clang::DependentTemplateSpecializationTypeLoc, clang::DependentNameTypeLoc, clang::ElaboratedTypeLoc, clang::UnaryTransformTypeLoc, clang::TypeOfExprTypeLoc, clang::TypeofLikeTypeLoc< Derived, TypeClass, LocalData >, clang::TypeofLikeTypeLoc< TypeOfExprTypeLoc, TypeOfExprType, TypeOfExprTypeLocInfo >, clang::TypeofLikeTypeLoc< TypeOfTypeLoc, TypeOfType, TypeOfTypeLocInfo >, clang::TemplateSpecializationTypeLoc, clang::ArrayTypeLoc, clang::FunctionTypeLoc, clang::MemberPointerTypeLoc, clang::PointerLikeTypeLoc< Derived, TypeClass, LocalData >, clang::PointerLikeTypeLoc< PointerTypeLoc, PointerType >, clang::PointerLikeTypeLoc< BlockPointerTypeLoc, BlockPointerType >, clang::PointerLikeTypeLoc< ReferenceTypeLoc, ReferenceType >, clang::PointerLikeTypeLoc< MemberPointerTypeLoc, MemberPointerType, MemberPointerLocInfo >, clang::PointerLikeTypeLoc< ObjCObjectPointerTypeLoc, ObjCObjectPointerType >, clang::AdjustedTypeLoc, clang::ParenTypeLoc, clang::ObjCInterfaceTypeLoc, clang::ObjCObjectTypeLoc, clang::AttributedTypeLoc, clang::BuiltinTypeLoc, clang::TypeSpecTypeLoc, and clang::QualifiedTypeLoc.

Definition at line 134 of file TypeLoc.h.

Referenced by clang::Sema::BuildBaseInitializer(), clang::Sema::BuildBuiltinOffsetOf(), clang::Sema::BuildDelegatingInitializer(), clang::Sema::BuildPseudoDestructorExpr(), clang::Sema::CheckFriendTypeDecl(), getBeginLoc(), getEndLoc(), and clang::PseudoDestructorTypeStorage::PseudoDestructorTypeStorage().

Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next TypeLoc is for "int".

Reimplemented in clang::ConcreteTypeLoc< ObjCObjectTypeLoc, ObjCInterfaceTypeLoc, ObjCInterfaceType, ObjCInterfaceLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, PackExpansionTypeLoc, PackExpansionType, PackExpansionTypeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, AdjustedTypeLoc, AdjustedType, AdjustedLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, DependentNameTypeLoc, DependentNameType, DependentNameLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, TemplateSpecializationTypeLoc, TemplateSpecializationType, TemplateSpecializationLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, UnaryTransformTypeLoc, UnaryTransformType, UnaryTransformTypeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, TypeOfExprTypeLoc, TypeOfExprType, TypeOfExprTypeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, AttributedTypeLoc, AttributedType, AttributedLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, FunctionTypeLoc, FunctionType, FunctionLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ParenTypeLoc, ParenType, ParenLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, DependentTemplateSpecializationTypeLoc, DependentTemplateSpecializationType, DependentTemplateSpecializationLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ObjCObjectTypeLoc, ObjCObjectType, ObjCProtocolListLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, BuiltinTypeLoc, BuiltinType, BuiltinLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, PointerTypeLoc, PointerType, PointerLikeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, AtomicTypeLoc, AtomicType, AtomicTypeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, TypeOfTypeLoc, TypeOfType, TypeOfTypeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ArrayTypeLoc, ArrayType, ArrayLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, BlockPointerTypeLoc, BlockPointerType, PointerLikeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ObjCObjectPointerTypeLoc, ObjCObjectPointerType, PointerLikeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, Derived, TypeClass, LocalData >, clang::ConcreteTypeLoc< UnqualTypeLoc, TypeSpecTypeLoc, Type, TypeSpecLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, MemberPointerTypeLoc, MemberPointerType, MemberPointerLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ElaboratedTypeLoc, ElaboratedType, ElaboratedLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ReferenceTypeLoc, ReferenceType, PointerLikeLocInfo >, and clang::QualifiedTypeLoc.

Definition at line 145 of file TypeLoc.h.

Referenced by clang::ASTWriter::AddTypeLoc(), getBeginLoc(), getEndLoc(), getFullDataSizeForType(), clang::Sema::GetTypeSourceInfoForDeclarator(), and clang::TypeLocBuilder::pushFullCopy().

void* clang::TypeLoc::getOpaqueData ( ) const [inline]
QualType clang::TypeLoc::getType ( ) const [inline]
const Type* clang::TypeLoc::getTypePtr ( ) const [inline]

Reimplemented in clang::InheritingConcreteTypeLoc< ArrayTypeLoc, VariableArrayTypeLoc, VariableArrayType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, TagTypeLoc, TagType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, SubstTemplateTypeParmTypeLoc, SubstTemplateTypeParmType >, clang::InheritingConcreteTypeLoc< ArrayTypeLoc, ConstantArrayTypeLoc, ConstantArrayType >, clang::InheritingConcreteTypeLoc< ArrayTypeLoc, DependentSizedArrayTypeLoc, DependentSizedArrayType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, TemplateTypeParmTypeLoc, TemplateTypeParmType >, clang::InheritingConcreteTypeLoc< TagTypeLoc, RecordTypeLoc, RecordType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, InjectedClassNameTypeLoc, InjectedClassNameType >, clang::InheritingConcreteTypeLoc< VectorTypeLoc, ExtVectorTypeLoc, ExtVectorType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, DependentSizedExtVectorTypeLoc, DependentSizedExtVectorType >, clang::InheritingConcreteTypeLoc< TagTypeLoc, EnumTypeLoc, EnumType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, UnresolvedUsingTypeLoc, UnresolvedUsingType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, SubstTemplateTypeParmPackTypeLoc, SubstTemplateTypeParmPackType >, clang::InheritingConcreteTypeLoc< AdjustedTypeLoc, DecayedTypeLoc, DecayedType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, ComplexTypeLoc, ComplexType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, VectorTypeLoc, VectorType >, clang::InheritingConcreteTypeLoc< ArrayTypeLoc, IncompleteArrayTypeLoc, IncompleteArrayType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, AutoTypeLoc, AutoType >, clang::InheritingConcreteTypeLoc< FunctionTypeLoc, FunctionNoProtoTypeLoc, FunctionNoProtoType >, clang::InheritingConcreteTypeLoc< FunctionTypeLoc, FunctionProtoTypeLoc, FunctionProtoType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, TypedefTypeLoc, TypedefType >, clang::InheritingConcreteTypeLoc< ReferenceTypeLoc, RValueReferenceTypeLoc, RValueReferenceType >, clang::InheritingConcreteTypeLoc< TypeSpecTypeLoc, DecltypeTypeLoc, DecltypeType >, clang::InheritingConcreteTypeLoc< ReferenceTypeLoc, LValueReferenceTypeLoc, LValueReferenceType >, clang::ConcreteTypeLoc< ObjCObjectTypeLoc, ObjCInterfaceTypeLoc, ObjCInterfaceType, ObjCInterfaceLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, PackExpansionTypeLoc, PackExpansionType, PackExpansionTypeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, AdjustedTypeLoc, AdjustedType, AdjustedLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, DependentNameTypeLoc, DependentNameType, DependentNameLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, TemplateSpecializationTypeLoc, TemplateSpecializationType, TemplateSpecializationLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, UnaryTransformTypeLoc, UnaryTransformType, UnaryTransformTypeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, TypeOfExprTypeLoc, TypeOfExprType, TypeOfExprTypeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, AttributedTypeLoc, AttributedType, AttributedLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, FunctionTypeLoc, FunctionType, FunctionLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ParenTypeLoc, ParenType, ParenLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, DependentTemplateSpecializationTypeLoc, DependentTemplateSpecializationType, DependentTemplateSpecializationLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ObjCObjectTypeLoc, ObjCObjectType, ObjCProtocolListLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, BuiltinTypeLoc, BuiltinType, BuiltinLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, PointerTypeLoc, PointerType, PointerLikeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, AtomicTypeLoc, AtomicType, AtomicTypeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, TypeOfTypeLoc, TypeOfType, TypeOfTypeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ArrayTypeLoc, ArrayType, ArrayLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, BlockPointerTypeLoc, BlockPointerType, PointerLikeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ObjCObjectPointerTypeLoc, ObjCObjectPointerType, PointerLikeLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, Derived, TypeClass, LocalData >, clang::ConcreteTypeLoc< UnqualTypeLoc, TypeSpecTypeLoc, Type, TypeSpecLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, MemberPointerTypeLoc, MemberPointerType, MemberPointerLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ElaboratedTypeLoc, ElaboratedType, ElaboratedLocInfo >, clang::ConcreteTypeLoc< UnqualTypeLoc, ReferenceTypeLoc, ReferenceType, PointerLikeLocInfo >, and clang::UnqualTypeLoc.

Definition at line 111 of file TypeLoc.h.

References clang::QualType::getFromOpaquePtr(), clang::QualType::getTypePtr(), and Ty.

Referenced by clang::NestedNameSpecifierLocBuilder::Extend(), and clang::QualifiedTypeLoc::getUnqualifiedLoc().

void clang::TypeLoc::initialize ( ASTContext Context,
SourceLocation  Loc 
) const [inline]

Initializes this to state that every location in this type is the given location.

This method exists to provide a simple transition for code that relies on location-less types.

Definition at line 159 of file TypeLoc.h.

Referenced by clang::ASTContext::getTrivialTypeSourceInfo().

void clang::TypeLoc::initializeFullCopy ( TypeLoc  Other) const [inline]

Initializes this by copying its information from another TypeLoc of the same type.

Definition at line 165 of file TypeLoc.h.

References getFullDataSize(), getOpaqueData(), and getType().

Referenced by clang::Sema::ActOnBlockArguments(), and FixInvalidVariablyModifiedTypeLoc().

void clang::TypeLoc::initializeFullCopy ( TypeLoc  Other,
unsigned  Size 
) const [inline]

Initializes this by copying its information from another TypeLoc of the same type. The given size must be the full data size.

Definition at line 174 of file TypeLoc.h.

References getFullDataSize(), getOpaqueData(), and getType().

bool clang::TypeLoc::isNull ( ) const [inline]
LLVM_EXPLICIT clang::TypeLoc::operator bool ( ) const [inline]

Definition at line 96 of file TypeLoc.h.

References Ty.


Friends And Related Function Documentation

bool operator!= ( const TypeLoc LHS,
const TypeLoc RHS 
) [friend]

Definition at line 184 of file TypeLoc.h.

bool operator== ( const TypeLoc LHS,
const TypeLoc RHS 
) [friend]

Definition at line 180 of file TypeLoc.h.


Member Data Documentation

void* clang::TypeLoc::Data [protected]
const void* clang::TypeLoc::Ty [protected]

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