clang
3.9.0
|
Base wrapper for a particular "section" of type source info. More...
#include <TypeLoc.h>
Public Types | |
enum | TypeLocClass { Qualified } |
The kinds of TypeLocs. More... | |
Public Member Functions | |
template<typename T > | |
T | castAs () const |
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type. More... | |
template<typename T > | |
T | getAs () const |
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired type. More... | |
TypeLoc () | |
TypeLoc (QualType ty, void *opaqueData) | |
TypeLoc (const Type *ty, void *opaqueData) | |
TypeLocClass | getTypeLocClass () const |
bool | isNull () const |
operator bool () const | |
QualType | getType () const |
Get the type for which this source info wrapper provides information. More... | |
const Type * | getTypePtr () const |
void * | getOpaqueData () const |
Get the pointer where source information is stored. More... | |
SourceLocation | getBeginLoc () const |
Get the begin source location. More... | |
SourceLocation | getEndLoc () const |
Get the end source location. More... | |
SourceRange | getSourceRange () const LLVM_READONLY |
Get the full source range. More... | |
SourceLocation | getLocStart () const LLVM_READONLY |
SourceLocation | getLocEnd () const LLVM_READONLY |
SourceRange | getLocalSourceRange () const |
Get the local source range. More... | |
unsigned | getFullDataSize () const |
Returns the size of the type source info data block. More... | |
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". More... | |
UnqualTypeLoc | getUnqualifiedLoc () const |
Skips past any qualifiers, if this is qualified. More... | |
TypeLoc | IgnoreParens () const |
TypeLoc | findExplicitQualifierLoc () const |
Find a type with the location of an explicit type qualifier. More... | |
void | initialize (ASTContext &Context, SourceLocation Loc) const |
Initializes this to state that every location in this type is the given location. More... | |
void | initializeFullCopy (TypeLoc Other) |
Initializes this by copying its information from another TypeLoc of the same type. More... | |
void | initializeFullCopy (TypeLoc Other, unsigned Size) |
Initializes this by copying its information from another TypeLoc of the same type. More... | |
void | copy (TypeLoc other) |
Copies the other type loc into this one. More... | |
SourceLocation | findNullabilityLoc () const |
Find the location of the nullability specifier (__nonnull, __nullable, or __null_unspecifier), if there is one. More... | |
Static Public Member Functions | |
static unsigned | getFullDataSizeForType (QualType Ty) |
Returns the size of type source info data block for the given type. More... | |
static unsigned | getLocalAlignmentForType (QualType Ty) |
Returns the alignment of type source info data block for the given type. More... | |
Protected Attributes | |
const void * | Ty |
void * | Data |
Friends | |
bool | operator== (const TypeLoc &LHS, const TypeLoc &RHS) |
bool | operator!= (const TypeLoc &LHS, const TypeLoc &RHS) |
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.
The kinds of TypeLocs.
Equivalent to the Type::TypeClass enum, except it also defines a Qualified enum that corresponds to the QualifiedLoc class.
Enumerator | |
---|---|
Qualified |
|
inline |
Definition at line 84 of file TypeLoc.h.
Referenced by findExplicitQualifierLoc(), getEndLoc(), and getLocalAlignmentForType().
|
inline |
|
inline |
|
inline |
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
Definition at line 53 of file TypeLoc.h.
Referenced by clang::Sema::actOnObjCTypeArgsAndProtocolQualifiers(), clang::Sema::ActOnTemplatedFriendTag(), clang::Sema::ActOnTypenameType(), clang::Sema::BuildMemInitializer(), clang::Sema::DiagnoseUnusedExprResult(), clang::Sema::findInheritingConstructor(), FixInvalidVariablyModifiedTypeLoc(), getBeginLoc(), getEndLoc(), clang::Sema::getReturnTypeLoc(), clang::Sema::getTemplateArgumentPackExpansionPattern(), clang::ASTContext::getTemplateSpecializationTypeInfo(), clang::Sema::GetTypeSourceInfoForDeclarator(), NeedsInstantiationAsFunctionType(), clang::TypeLocBuilder::push(), clang::TypeLocBuilder::pushTypeSpec(), clang::TemplateDeclInstantiator::SubstFunctionType(), clang::TreeTransform< Derived >::TransformFunctionTypeParam(), and clang::TreeTransform< Derived >::TransformFunctionTypeParams().
void TypeLoc::copy | ( | TypeLoc | other | ) |
Copies the other type loc into this one.
Definition at line 146 of file TypeLoc.cpp.
References Data, getFullDataSize(), getNextTypeLoc(), getType(), and TypeLocMaxDataAlign.
Referenced by initializeFullCopy().
TypeLoc TypeLoc::findExplicitQualifierLoc | ( | ) | const |
Find a type with the location of an explicit type qualifier.
The result, if non-null, will be one of: QualifiedTypeLoc AtomicTypeLoc AttributedTypeLoc, for those type attributes that behave as qualifiers
Definition at line 371 of file TypeLoc.cpp.
References getAs(), IgnoreParens(), and TypeLoc().
Referenced by clang::Sema::actOnObjCTypeParam(), and applyObjCTypeArgs().
SourceLocation TypeLoc::findNullabilityLoc | ( | ) | const |
Find the location of the nullability specifier (__nonnull, __nullable, or __null_unspecifier), if there is one.
Definition at line 360 of file TypeLoc.cpp.
References clang::AttributedType::attr_nonnull, clang::AttributedType::attr_null_unspecified, and clang::AttributedType::attr_nullable.
|
inline |
Convert to the specified TypeLoc type, returning a null TypeLoc if this TypeLoc is not of the desired type.
Definition at line 64 of file TypeLoc.h.
Referenced by clang::Sema::ActOnBlockArguments(), clang::Sema::ActOnFinishFunctionBody(), clang::Sema::actOnObjCTypeArgsAndProtocolQualifiers(), clang::Sema::actOnObjCTypeParam(), addFunctionPointerConversion(), checkAllAtProps(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckFunctionDeclaration(), clang::Sema::checkThisInStaticMemberFunctionExceptionSpec(), clang::Sema::checkThisInStaticMemberFunctionType(), DiagnoseCalleeStaticArrayParam(), clang::comments::DeclInfo::fill(), findExplicitQualifierLoc(), FixInvalidVariablyModifiedTypeLoc(), FormatFunctionParameter(), clang::Sema::getReturnTypeLoc(), clang::FunctionDecl::getReturnTypeSourceRange(), clang::Sema::GetTypeSourceInfoForDeclarator(), isEnableIf(), IsTailPaddedMemberArray(), NeedsInstantiationAsFunctionType(), clang::InitializationSequence::Perform(), clang::Sema::SubstFunctionDeclType(), clang::TemplateDeclInstantiator::SubstFunctionType(), clang::Sema::SubstParmVarDecl(), and clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc().
SourceLocation TypeLoc::getBeginLoc | ( | ) | const |
Get the begin source location.
Definition at line 170 of file TypeLoc.cpp.
References castAs(), clang::SourceRange::getBegin(), getLocalSourceRange(), getNextTypeLoc(), getTypeLocClass(), clang::InheritingConcreteTypeLoc< Base, Derived, TypeClass >::getTypePtr(), clang::FunctionProtoType::hasTrailingReturn(), isNull(), clang::SourceLocation::isValid(), and Qualified.
Referenced by clang::Sema::ActOnAliasDeclaration(), clang::Sema::ActOnMethodDeclaration(), clang::Sema::ActOnObjCForCollectionStmt(), clang::Sema::actOnObjCTypeParam(), clang::Sema::ActOnTag(), clang::Sema::AtomicPropertySetterGetterRules(), clang::Sema::BuildCXXNew(), clang::Sema::BuildCXXTypeConstructExpr(), clang::Sema::BuildVAArgExpr(), clang::Sema::CheckBaseSpecifier(), CheckConstexprDeclStmt(), clang::Sema::CheckEnumUnderlyingType(), clang::Sema::deduceVarTypeFromInitializer(), clang::CXXScopeSpec::Extend(), clang::TemplateTypeParmDecl::getDefaultArgumentLoc(), clang::DependentNameTypeLoc::getLocalSourceRange(), clang::DependentTemplateSpecializationTypeLoc::getLocalSourceRange(), getLocStart(), clang::CXXUnresolvedConstructExpr::getLocStart(), getSourceRange(), clang::DeclaratorDecl::getTypeSpecStartLoc(), clang::ASTReader::ReadNestedNameSpecifierLoc(), clang::TreeTransform< Derived >::RebuildCXXPseudoDestructorExpr(), ReplaceWithClasstype(), ReplaceWithInstancetype(), clang::TreeTransform< Derived >::TransformFunctionProtoType(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), and clang::TreeTransform< Derived >::TransformType().
SourceLocation TypeLoc::getEndLoc | ( | ) | const |
Get the end source location.
Definition at line 207 of file TypeLoc.cpp.
References castAs(), clang::SourceRange::getEnd(), getLocalSourceRange(), getNextTypeLoc(), getTypeLocClass(), clang::InheritingConcreteTypeLoc< Base, Derived, TypeClass >::getTypePtr(), clang::FunctionProtoType::hasTrailingReturn(), clang::LangAS::Last, Paren, Qualified, and TypeLoc().
Referenced by clang::Sema::actOnObjCTypeParam(), clang::ElaboratedTypeLoc::getLocalSourceRange(), getLocEnd(), getSourceRange(), clang::ClassTemplateSpecializationDecl::getSourceRange(), ReplaceWithClasstype(), and ReplaceWithInstancetype().
|
inline |
Returns the size of the type source info data block.
Definition at line 139 of file TypeLoc.h.
References getFullDataSizeForType(), and getType().
Referenced by clang::Sema::ActOnBlockArguments(), copy(), clang::TemplateSpecializationTypeLoc::copy(), clang::ElaboratedTypeLoc::copy(), clang::DependentNameTypeLoc::copy(), clang::DependentTemplateSpecializationTypeLoc::copy(), clang::Sema::GetTypeSourceInfoForDeclarator(), initializeFullCopy(), clang::TypeLocBuilder::pushFullCopy(), clang::Sema::SubstFunctionDeclType(), clang::Sema::SubstType(), clang::TreeTransform< Derived >::TransformFunctionTypeParam(), and clang::TreeTransform< Derived >::TransformType().
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 76 of file TypeLoc.cpp.
References getLocalAlignmentForType(), getNextTypeLoc(), getType(), isNull(), and max().
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 58 of file TypeLoc.cpp.
References clang::QualType::isNull(), and TypeLoc().
Referenced by getFullDataSizeForType(), and clang::QualifiedTypeLoc::getUnqualifiedLoc().
|
inline |
Get the local source range.
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().
|
inline |
Definition at line 131 of file TypeLoc.h.
References getEndLoc().
Referenced by clang::Sema::ActOnSuperClassOfClassInterface(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckParameter(), clang::Sema::CreatePropertyDecl(), GetFullTypeForDeclarator(), and clang::Sema::SubstExceptionSpec().
|
inline |
Definition at line 130 of file TypeLoc.h.
References getBeginLoc().
Referenced by clang::Sema::ActOnExplicitInstantiation(), clang::Sema::actOnObjCTypeParam(), applyObjCTypeArgs(), clang::Sema::CheckFriendTypeDecl(), clang::Sema::CreatePropertyDecl(), GetFullTypeForDeclarator(), clang::CXXFunctionalCastExpr::getLocStart(), and clang::ASTImporter::Import().
|
inline |
Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the TypeLoc is a PointerLoc and next TypeLoc is for "int".
Definition at line 145 of file TypeLoc.h.
Referenced by clang::ASTRecordWriter::AddTypeLoc(), copy(), getBeginLoc(), getEndLoc(), getFullDataSizeForType(), clang::Sema::GetTypeSourceInfoForDeclarator(), and clang::TypeLocBuilder::pushFullCopy().
|
inline |
Get the pointer where source information is stored.
Definition at line 116 of file TypeLoc.h.
References Data.
Referenced by clang::NestedNameSpecifierLocBuilder::Extend(), clang::TypeLocBuilder::getTypeSourceInfo(), clang::Sema::GetTypeSourceInfoForDeclarator(), and clang::NestedNameSpecifierLocBuilder::MakeTrivial().
|
inline |
Get the full source range.
Definition at line 127 of file TypeLoc.h.
References getBeginLoc(), and getEndLoc().
Referenced by clang::Sema::actOnObjCTypeArgsAndProtocolQualifiers(), applyObjCTypeArgs(), clang::Sema::BuildClassMessage(), clang::Sema::BuildCStyleCastExpr(), clang::Sema::BuildCXXFunctionalCastExpr(), clang::Sema::BuildCXXNew(), clang::Sema::BuildObjCBridgedCast(), clang::Sema::BuildVAArgExpr(), clang::Sema::CheckBaseSpecifier(), CheckConstexprDeclStmt(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckPackExpansion(), clang::Sema::CheckTemplateArgument(), checkTypeParamListConsistency(), findTemplateParameter(), clang::TypeOfExprTypeLoc::getLocalSourceRange(), clang::Sema::getPrintable(), getRangeOfTypeInNestedNameSpecifier(), clang::ObjCMessageExpr::getReceiverRange(), clang::FunctionDecl::getReturnTypeSourceRange(), getTypeRange(), clang::Sema::InstantiateMemInitializers(), and clang::TreeTransform< Derived >::TransformFunctionTypeParam().
|
inline |
Get the type for which this source info wrapper provides information.
Definition at line 107 of file TypeLoc.h.
References clang::QualType::getFromOpaquePtr(), and Ty.
Referenced by clang::Sema::ActOnBlockArguments(), clang::Sema::ActOnFinishFunctionBody(), clang::ASTRecordWriter::AddTypeLoc(), CheckConstexprDeclStmt(), copy(), clang::Sema::DeduceAutoType(), clang::Sema::DeduceFunctionTypeFromReturnExpr(), findTemplateParameter(), getFullDataSize(), getFullDataSizeForType(), clang::Sema::getTemplateArgumentPackExpansionPattern(), getTypeLocClass(), initializeFullCopy(), clang::Sema::SubstType(), clang::TreeTransform< Derived >::TransformFunctionProtoType(), clang::TreeTransform< Derived >::TransformNestedNameSpecifierLoc(), and clang::TreeTransform< Derived >::TransformReferenceType().
|
inline |
Definition at line 90 of file TypeLoc.h.
References getType(), clang::Type::getTypeClass(), and Qualified.
Referenced by getBeginLoc(), getEndLoc(), clang::TypeLocBuilder::pushFullCopy(), clang::TreeTransform< Derived >::TransformType(), clang::RecursiveASTVisitor< Derived >::TraverseTypeLoc(), and clang::TypeLocVisitor< TypeLocReader >::Visit().
|
inline |
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().
|
inline |
Skips past any qualifiers, if this is qualified.
Definition at line 297 of file TypeLoc.h.
References getUnqualifiedLoc().
Referenced by clang::comments::DeclInfo::fill(), FixInvalidVariablyModifiedTypeLoc(), FormatFunctionParameter(), clang::Sema::GetTypeSourceInfoForDeclarator(), getUnqualifiedLoc(), and clang::RecursiveASTVisitor< CallGraph >::WalkUpFromUnqualTypeLoc().
|
inline |
Definition at line 1056 of file TypeLoc.h.
Referenced by clang::Sema::ActOnBlockArguments(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckFunctionDeclaration(), clang::comments::DeclInfo::fill(), findExplicitQualifierLoc(), clang::Sema::findInheritingConstructor(), FormatFunctionParameter(), clang::Sema::getReturnTypeLoc(), clang::FunctionDecl::getReturnTypeSourceRange(), NeedsInstantiationAsFunctionType(), clang::Sema::SubstFunctionDeclType(), and clang::TemplateDeclInstantiator::SubstFunctionType().
|
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 167 of file TypeLoc.h.
Referenced by clang::ASTContext::getTrivialTypeSourceInfo().
|
inline |
Initializes this by copying its information from another TypeLoc of the same type.
Definition at line 173 of file TypeLoc.h.
References copy(), and getType().
Referenced by clang::Sema::ActOnBlockArguments(), and FixInvalidVariablyModifiedTypeLoc().
|
inline |
Definition at line 95 of file TypeLoc.h.
References Ty.
Referenced by clang::ASTRecordWriter::AddTypeLoc(), getBeginLoc(), getFullDataSizeForType(), clang::ASTReader::GetTypeSourceInfo(), clang::index::IndexingContext::indexTypeLoc(), clang::index::IndexingContext::indexTypeSourceInfo(), and clang::RecursiveASTVisitor< Derived >::TraverseTypeLoc().
|
inlineexplicit |
|
protected |
Definition at line 45 of file TypeLoc.h.
Referenced by copy(), clang::TemplateSpecializationTypeLoc::copy(), clang::ElaboratedTypeLoc::copy(), clang::DependentNameTypeLoc::copy(), clang::DependentTemplateSpecializationTypeLoc::copy(), getOpaqueData(), and clang::QualifiedTypeLoc::getUnqualifiedLoc().
|
protected |
Definition at line 44 of file TypeLoc.h.
Referenced by getType(), getTypePtr(), clang::UnqualTypeLoc::getTypePtr(), isNull(), and operator bool().