clang API Documentation
#include <Type.h>
Classes | |
struct | ExceptionSpecInfo |
struct | ExtProtoInfo |
ExtProtoInfo - Extra information about a function prototype. More... | |
Public Types | |
enum | NoexceptResult { NR_NoNoexcept, NR_BadNoexcept, NR_Dependent, NR_Throw, NR_Nothrow } |
Result type of getNoexceptSpec(). More... | |
typedef const QualType * | param_type_iterator |
typedef llvm::iterator_range < param_type_iterator > | param_type_range |
typedef const QualType * | exception_iterator |
Public Member Functions | |
unsigned | getNumParams () const |
QualType | getParamType (unsigned i) const |
ArrayRef< QualType > | getParamTypes () const |
ExtProtoInfo | getExtProtoInfo () const |
ExceptionSpecificationType | getExceptionSpecType () const |
Get the kind of exception specification on this function. | |
bool | hasExceptionSpec () const |
Return whether this function has any kind of exception spec. | |
bool | hasDynamicExceptionSpec () const |
Return whether this function has a dynamic (throw) exception spec. | |
bool | hasNoexceptExceptionSpec () const |
Return whether this function has a noexcept exception spec. | |
bool | hasDependentExceptionSpec () const |
Return whether this function has a dependent exception spec. | |
NoexceptResult | getNoexceptSpec (const ASTContext &Ctx) const |
Get the meaning of the noexcept spec on this function, if any. | |
unsigned | getNumExceptions () const |
QualType | getExceptionType (unsigned i) const |
Expr * | getNoexceptExpr () const |
FunctionDecl * | getExceptionSpecDecl () const |
If this function type has an exception specification which hasn't been determined yet (either because it has not been evaluated or because it has not been instantiated), this is the function whose exception specification is represented by this type. | |
FunctionDecl * | getExceptionSpecTemplate () const |
If this function type has an uninstantiated exception specification, this is the function whose exception specification should be instantiated to find the exception specification for this type. | |
bool | isNothrow (const ASTContext &Ctx, bool ResultIfDependent=false) const |
Determine whether this function type has a non-throwing exception specification. If this depends on template arguments, returns ResultIfDependent . | |
bool | isVariadic () const |
bool | isTemplateVariadic () const |
Determines whether this function prototype contains a parameter pack at the end. | |
bool | hasTrailingReturn () const |
unsigned | getTypeQuals () const |
RefQualifierKind | getRefQualifier () const |
Retrieve the ref-qualifier associated with this function type. | |
param_type_range | param_types () const |
param_type_iterator | param_type_begin () const |
param_type_iterator | param_type_end () const |
ArrayRef< QualType > | exceptions () const |
exception_iterator | exception_begin () const |
exception_iterator | exception_end () const |
bool | hasAnyConsumedParams () const |
bool | isParamConsumed (unsigned I) const |
bool | isSugared () const |
QualType | desugar () const |
void | printExceptionSpecification (raw_ostream &OS, const PrintingPolicy &Policy) const |
void | Profile (llvm::FoldingSetNodeID &ID, const ASTContext &Ctx) |
Static Public Member Functions | |
static bool | classof (const Type *T) |
static void | Profile (llvm::FoldingSetNodeID &ID, QualType Result, param_type_iterator ArgTys, unsigned NumArgs, const ExtProtoInfo &EPI, const ASTContext &Context) |
Friends | |
class | ASTContext |
FunctionProtoType - Represents a prototype with parameter type info, e.g. 'int foo(int)' or 'int foo(void)'. 'void' is represented as having no parameters, not as having a single void parameter. Such a type can have an exception specification, but this specification is not part of the canonical type.
typedef const QualType* clang::FunctionProtoType::exception_iterator |
typedef const QualType* clang::FunctionProtoType::param_type_iterator |
typedef llvm::iterator_range<param_type_iterator> clang::FunctionProtoType::param_type_range |
Result type of getNoexceptSpec().
static bool clang::FunctionProtoType::classof | ( | const Type * | T | ) | [inline, static] |
Reimplemented from clang::FunctionType.
Definition at line 3124 of file Type.h.
References clang::Type::getTypeClass().
QualType clang::FunctionProtoType::desugar | ( | ) | const [inline] |
exception_iterator clang::FunctionProtoType::exception_begin | ( | ) | const [inline] |
Definition at line 3100 of file Type.h.
Referenced by clang::Sema::CheckEquivalentExceptionSpec().
exception_iterator clang::FunctionProtoType::exception_end | ( | ) | const [inline] |
Definition at line 3104 of file Type.h.
References clang::EST_Dynamic.
ArrayRef<QualType> clang::FunctionProtoType::exceptions | ( | ) | const [inline] |
Definition at line 3097 of file Type.h.
Referenced by clang::Sema::ImplicitExceptionSpecification::CalledDecl(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckExceptionSpecSubset(), clang::Sema::checkThisInStaticMemberFunctionExceptionSpec(), hasDependentExceptionSpec(), and clang::ASTNodeImporter::VisitFunctionProtoType().
FunctionDecl* clang::FunctionProtoType::getExceptionSpecDecl | ( | ) | const [inline] |
If this function type has an exception specification which hasn't been determined yet (either because it has not been evaluated or because it has not been instantiated), this is the function whose exception specification is represented by this type.
Definition at line 3042 of file Type.h.
References clang::EST_Unevaluated, and clang::EST_Uninstantiated.
Referenced by addExceptionSpec(), and clang::Sema::ResolveExceptionSpec().
FunctionDecl* clang::FunctionProtoType::getExceptionSpecTemplate | ( | ) | const [inline] |
If this function type has an uninstantiated exception specification, this is the function whose exception specification should be instantiated to find the exception specification for this type.
Definition at line 3052 of file Type.h.
References clang::EST_Uninstantiated.
Referenced by addExceptionSpec(), and clang::Sema::InstantiateExceptionSpec().
ExceptionSpecificationType clang::FunctionProtoType::getExceptionSpecType | ( | ) | const [inline] |
Get the kind of exception specification on this function.
Definition at line 3000 of file Type.h.
Referenced by addExceptionSpec(), clang::ASTDeclReader::attachPreviousDeclImpl(), clang::Sema::ImplicitExceptionSpecification::CalledDecl(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckExceptionSpecSubset(), clang::Sema::CheckExplicitlyDefaultedMemberExceptionSpec(), clang::Sema::CheckExplicitlyDefaultedSpecialMember(), clang::Sema::checkThisInStaticMemberFunctionExceptionSpec(), clang::CodeGen::CodeGenFunction::EmitEndEHSpec(), clang::CodeGen::CodeGenFunction::EmitStartEHSpec(), clang::Sema::EvaluateImplicitExceptionSpec(), getNoexceptSpec(), clang::Sema::InstantiateExceptionSpec(), isNothrow(), IsStructurallyEquivalent(), clang::Sema::MarkFunctionReferenced(), printExceptionSpecification(), and clang::Sema::ResolveExceptionSpec().
QualType clang::FunctionProtoType::getExceptionType | ( | unsigned | i | ) | const [inline] |
Definition at line 3028 of file Type.h.
Referenced by addExceptionSpec(), clang::CodeGen::CodeGenFunction::EmitStartEHSpec(), isNothrow(), IsStructurallyEquivalent(), and printExceptionSpecification().
ExtProtoInfo clang::FunctionProtoType::getExtProtoInfo | ( | ) | const [inline] |
Definition at line 2976 of file Type.h.
References clang::FunctionProtoType::ExtProtoInfo::ConsumedParameters, clang::EST_ComputedNoexcept, clang::EST_Dynamic, clang::EST_Unevaluated, clang::EST_Uninstantiated, clang::FunctionProtoType::ExceptionSpecInfo::Exceptions, clang::FunctionProtoType::ExtProtoInfo::ExceptionSpec, clang::FunctionProtoType::ExtProtoInfo::ExtInfo, clang::FunctionProtoType::ExtProtoInfo::HasTrailingReturn, clang::FunctionProtoType::ExceptionSpecInfo::NoexceptExpr, clang::FunctionProtoType::ExtProtoInfo::RefQualifier, clang::FunctionProtoType::ExceptionSpecInfo::SourceDecl, clang::FunctionProtoType::ExceptionSpecInfo::SourceTemplate, clang::FunctionProtoType::ExceptionSpecInfo::Type, clang::FunctionProtoType::ExtProtoInfo::TypeQuals, and clang::FunctionProtoType::ExtProtoInfo::Variadic.
Referenced by clang::Sema::ActOnBlockStmtExpr(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnLambdaExpr(), addBlockPointerConversion(), addFunctionPointerConversion(), clang::ASTContext::adjustDeducedFunctionResultType(), clang::Sema::AdjustDestructorExceptionSpec(), clang::ASTContext::adjustFunctionType(), clang::ASTDeclReader::attachPreviousDeclImpl(), clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckDestructorDeclarator(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckExplicitlyDefaultedSpecialMember(), clang::Sema::CheckFunctionDeclaration(), clang::Sema::CheckFunctionTemplateSpecialization(), clang::ASTContext::FunctionTypesMatchOnNSConsumedAttrs(), GetFullTypeForDeclarator(), getFunctionTypeWithExceptionSpec(), clang::TemplateDeclInstantiator::InitFunctionInstantiation(), LookupDirect(), clang::Sema::MergeFunctionDecl(), clang::ASTContext::mergeFunctionTypes(), Profile(), SpecializeCorrespondingLambdaCallOperatorAndInvoker(), clang::Sema::startLambdaDefinition(), clang::Sema::SubstExceptionSpec(), clang::Sema::SubstituteExplicitTemplateArguments(), clang::TreeTransform< Derived >::TransformFunctionProtoType(), and clang::ASTNodeImporter::VisitFunctionProtoType().
Expr* clang::FunctionProtoType::getNoexceptExpr | ( | ) | const [inline] |
Definition at line 3032 of file Type.h.
References clang::EST_ComputedNoexcept.
Referenced by addExceptionSpec(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::checkThisInStaticMemberFunctionExceptionSpec(), getNoexceptSpec(), hasDependentExceptionSpec(), IsStructurallyEquivalent(), and printExceptionSpecification().
FunctionProtoType::NoexceptResult FunctionProtoType::getNoexceptSpec | ( | const ASTContext & | Ctx | ) | const |
Get the meaning of the noexcept spec on this function, if any.
Definition at line 1690 of file Type.cpp.
References clang::EST_BasicNoexcept, clang::EST_ComputedNoexcept, getExceptionSpecType(), getNoexceptExpr(), clang::Expr::isIntegerConstantExpr(), clang::Expr::isValueDependent(), NR_BadNoexcept, NR_Dependent, NR_NoNoexcept, NR_Nothrow, and NR_Throw.
Referenced by clang::Sema::ImplicitExceptionSpecification::CalledDecl(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckExceptionSpecSubset(), clang::CodeGen::CodeGenFunction::EmitEndEHSpec(), clang::CodeGen::CodeGenFunction::EmitStartEHSpec(), and isNothrow().
unsigned clang::FunctionProtoType::getNumExceptions | ( | ) | const [inline] |
Definition at line 3027 of file Type.h.
Referenced by addExceptionSpec(), clang::Sema::CheckEquivalentExceptionSpec(), clang::CodeGen::CodeGenFunction::EmitStartEHSpec(), IsStructurallyEquivalent(), and printExceptionSpecification().
unsigned clang::FunctionProtoType::getNumParams | ( | ) | const [inline] |
Definition at line 2967 of file Type.h.
Referenced by clang::Sema::AddMethodCandidate(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddSurrogateCandidate(), clang::Sema::BuildCallToObjectOfClassType(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CheckMain(), clang::Sema::CheckParamExceptionSpec(), commonEmitCXXMemberOrOperatorCall(), clang::Sema::CompleteConstructorCall(), CompleteNonViableCandidate(), clang::Sema::ComputeDefaultedCopyAssignmentExceptionSpec(), clang::Sema::ComputeDefaultedCopyCtorExceptionSpec(), clang::Sema::ConvertArgumentsForCall(), clang::CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(), DeduceTemplateArgumentsByTypeMatch(), EvaluateUnaryTypeTrait(), clang::Sema::FindAllocationFunctions(), clang::CodeGen::RequiredArgs::forPrototypePlus(), clang::ASTContext::FunctionTypesMatchOnNSConsumedAttrs(), clang::Sema::GatherArgumentsForCall(), getAbsoluteValueArgumentType(), clang::FunctionDecl::getNumParams(), clang::Sema::HandleFunctionTypeMismatch(), IsAcceptableNonMemberOperatorCandidate(), clang::Sema::IsBlockPointerConversion(), isDispatchBlock(), isFirstArgumentCompatibleWithType(), clang::Sema::isObjCPointerConversion(), clang::Sema::IsOverload(), clang::FunctionDecl::isReplaceableGlobalAllocationFunction(), clang::FunctionDecl::isReservedGlobalPlacementOperator(), IsStructurallyEquivalent(), isTemplateVariadic(), MarkUsedTemplateParameters(), clang::ASTContext::mergeFunctionTypes(), clang::NamedDecl::printQualifiedName(), and clang::TreeTransform< Derived >::TransformFunctionProtoType().
QualType clang::FunctionProtoType::getParamType | ( | unsigned | i | ) | const [inline] |
Definition at line 2968 of file Type.h.
Referenced by clang::Sema::AddOverloadCandidate(), clang::Sema::AddSurrogateCandidate(), clang::Sema::BuildResolvedCallExpr(), clang::Sema::CheckExplicitlyDefaultedSpecialMember(), clang::Sema::CheckMain(), clang::Sema::CheckParamExceptionSpec(), CompleteNonViableCandidate(), clang::Sema::ComputeDefaultedCopyAssignmentExceptionSpec(), clang::Sema::ComputeDefaultedCopyCtorExceptionSpec(), clang::CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(), clang::Sema::FindAllocationFunctions(), clang::Sema::GatherArgumentsForCall(), getAbsoluteValueArgumentType(), clang::Sema::HandleFunctionTypeMismatch(), IsAcceptableNonMemberOperatorCandidate(), clang::Sema::IsBlockPointerConversion(), isFirstArgumentCompatibleWithType(), clang::Sema::isObjCPointerConversion(), clang::FunctionDecl::isReplaceableGlobalAllocationFunction(), clang::FunctionDecl::isReservedGlobalPlacementOperator(), IsStructurallyEquivalent(), isTemplateVariadic(), MarkUsedTemplateParameters(), clang::ASTContext::mergeFunctionTypes(), and clang::TemplateDeclInstantiator::SubstFunctionType().
ArrayRef<QualType> clang::FunctionProtoType::getParamTypes | ( | ) | const [inline] |
Definition at line 2972 of file Type.h.
Referenced by clang::Sema::ActOnBlockStmtExpr(), clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnLambdaExpr(), addBlockPointerConversion(), addFunctionPointerConversion(), clang::ASTContext::adjustDeducedFunctionResultType(), clang::ASTContext::adjustFunctionType(), clang::Sema::CheckConstructorDeclarator(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckFunctionDeclaration(), clang::Sema::CheckFunctionTemplateSpecialization(), GetFullTypeForDeclarator(), getFunctionTypeWithExceptionSpec(), clang::TemplateDeclInstantiator::InitFunctionInstantiation(), clang::ASTContext::mergeFunctionTypes(), SpecializeCorrespondingLambdaCallOperatorAndInvoker(), and clang::Sema::startLambdaDefinition().
RefQualifierKind clang::FunctionProtoType::getRefQualifier | ( | ) | const [inline] |
Retrieve the ref-qualifier associated with this function type.
Definition at line 3078 of file Type.h.
Referenced by checkQualifiedFunction(), DeduceTemplateArgumentsByTypeMatch(), and getFunctionQualifiersAsString().
unsigned clang::FunctionProtoType::getTypeQuals | ( | ) | const [inline] |
Reimplemented from clang::FunctionType.
Definition at line 3074 of file Type.h.
References clang::FunctionType::getTypeQuals().
Referenced by AddFunctionTypeQualsToCompletionString(), clang::Sema::BuildCallToMemberFunction(), clang::Sema::CheckExplicitlyDefaultedSpecialMember(), checkQualifiedFunction(), DeduceTemplateArgumentsByTypeMatch(), getFunctionQualifiersAsString(), clang::Sema::HandleFunctionTypeMismatch(), clang::Sema::isObjCPointerConversion(), and IsStructurallyEquivalent().
bool clang::FunctionProtoType::hasAnyConsumedParams | ( | ) | const [inline] |
Definition at line 3110 of file Type.h.
Referenced by clang::ASTContext::FunctionTypesMatchOnNSConsumedAttrs().
Return whether this function has a dependent exception spec.
Definition at line 1677 of file Type.cpp.
References exceptions(), and getNoexceptExpr().
Referenced by clang::Sema::CheckExceptionSpecCompatibility().
bool clang::FunctionProtoType::hasDynamicExceptionSpec | ( | ) | const [inline] |
Return whether this function has a dynamic (throw) exception spec.
Definition at line 3008 of file Type.h.
References clang::isDynamicExceptionSpec().
Referenced by printExceptionSpecification().
bool clang::FunctionProtoType::hasExceptionSpec | ( | ) | const [inline] |
Return whether this function has any kind of exception spec.
Definition at line 3004 of file Type.h.
References clang::EST_None.
Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::Sema::AdjustDestructorExceptionSpec(), clang::Sema::CheckDistantExceptionSpec(), clang::Sema::CheckEquivalentExceptionSpec(), clang::Sema::CheckExplicitlyDefaultedSpecialMember(), clang::hasImplicitExceptionSpec(), clang::TemplateDeclInstantiator::InitFunctionInstantiation(), and clang::ASTContext::mergeFunctionTypes().
bool clang::FunctionProtoType::hasNoexceptExceptionSpec | ( | ) | const [inline] |
Return whether this function has a noexcept exception spec.
Definition at line 3012 of file Type.h.
References clang::isNoexceptExceptionSpec().
bool clang::FunctionProtoType::hasTrailingReturn | ( | ) | const [inline] |
Definition at line 3072 of file Type.h.
Referenced by clang::Sema::checkThisInStaticMemberFunctionType(), clang::TypeLoc::getBeginLoc(), clang::TypeLoc::getEndLoc(), clang::Sema::SubstituteExplicitTemplateArguments(), and clang::TreeTransform< Derived >::TransformFunctionProtoType().
bool FunctionProtoType::isNothrow | ( | const ASTContext & | Ctx, |
bool | ResultIfDependent = false |
||
) | const |
Determine whether this function type has a non-throwing exception specification. If this depends on template arguments, returns ResultIfDependent
.
Definition at line 1713 of file Type.cpp.
References clang::EST_BasicNoexcept, clang::EST_ComputedNoexcept, clang::EST_Dynamic, clang::EST_DynamicNone, clang::EST_Unevaluated, clang::EST_Uninstantiated, getExceptionSpecType(), getExceptionType(), getNoexceptSpec(), NR_Dependent, and NR_Nothrow.
Referenced by clang::canCalleeThrow(), clang::CodeGen::CodeGenModule::ConstructAttributeList(), clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(), EvaluateUnaryTypeTrait(), and HasNoThrowOperator().
bool clang::FunctionProtoType::isParamConsumed | ( | unsigned | I | ) | const [inline] |
Definition at line 3111 of file Type.h.
Referenced by clang::Sema::BuildResolvedCallExpr(), and clang::Sema::GatherArgumentsForCall().
bool clang::FunctionProtoType::isSugared | ( | ) | const [inline] |
bool FunctionProtoType::isTemplateVariadic | ( | ) | const |
Determines whether this function prototype contains a parameter pack at the end.
A function template whose last parameter is a parameter pack can be called with an arbitrary number of arguments, much like a variadic function.
Definition at line 1738 of file Type.cpp.
References getNumParams(), and getParamType().
Referenced by clang::Sema::DeduceTemplateArguments().
bool clang::FunctionProtoType::isVariadic | ( | ) | const [inline] |
Definition at line 3062 of file Type.h.
Referenced by addFunctionPointerConversion(), clang::Sema::AddMethodCandidate(), clang::Sema::AddOverloadCandidate(), clang::Sema::AddSurrogateCandidate(), clang::Sema::BuildCallToObjectOfClassType(), clang::Sema::BuildCXXNew(), clang::Sema::BuildResolvedCallExpr(), clang::Sema::CheckConversionDeclarator(), clang::Sema::CompleteConstructorCall(), clang::Sema::ConvertArgumentsForCall(), clang::CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(), clang::Sema::DeduceTemplateArguments(), DeduceTemplateArgumentsByTypeMatch(), clang::Sema::FindAllocationFunctions(), FormatFunctionParameter(), clang::CodeGen::RequiredArgs::forPrototypePlus(), clang::CodeGen::CodeGenFunction::GenerateBlockFunction(), clang::Sema::getVariadicCallType(), handleFunctionTypeAttr(), clang::Sema::IsBlockPointerConversion(), isFunctionOrMethodVariadic(), clang::Sema::isObjCPointerConversion(), clang::Sema::IsOverload(), clang::FunctionDecl::isReplaceableGlobalAllocationFunction(), clang::FunctionDecl::isReservedGlobalPlacementOperator(), IsStructurallyEquivalent(), clang::ASTContext::mergeFunctionTypes(), and clang::NamedDecl::printQualifiedName().
param_type_iterator clang::FunctionProtoType::param_type_begin | ( | ) | const [inline] |
Definition at line 3088 of file Type.h.
Referenced by CheckConstexprParameterTypes(), DeduceTemplateArgumentsByTypeMatch(), clang::CodeGen::CodeGenFunction::EmitBuiltinNewDeleteCall(), clang::Sema::FunctionParamTypesAreEqual(), isAtLeastAsSpecializedAs(), Profile(), and clang::TreeTransform< Derived >::TransformFunctionProtoType().
param_type_iterator clang::FunctionProtoType::param_type_end | ( | ) | const [inline] |
Definition at line 3091 of file Type.h.
Referenced by CheckConstexprParameterTypes(), clang::Sema::FunctionParamTypesAreEqual(), isAtLeastAsSpecializedAs(), and clang::TreeTransform< Derived >::TransformFunctionProtoType().
param_type_range clang::FunctionProtoType::param_types | ( | ) | const [inline] |
Definition at line 3085 of file Type.h.
Referenced by addAssociatedClassesAndNamespaces(), computeCachedProperties(), computeLinkageInfo(), and clang::ASTNodeImporter::VisitFunctionProtoType().
void FunctionProtoType::printExceptionSpecification | ( | raw_ostream & | OS, |
const PrintingPolicy & | Policy | ||
) | const |
Definition at line 585 of file TypePrinter.cpp.
References clang::EST_ComputedNoexcept, clang::EST_MSAny, getExceptionSpecType(), getExceptionType(), getNoexceptExpr(), getNumExceptions(), hasDynamicExceptionSpec(), clang::isNoexceptExceptionSpec(), clang::Stmt::printPretty(), and clang::QualType::stream().
void FunctionProtoType::Profile | ( | llvm::FoldingSetNodeID & | ID, |
const ASTContext & | Ctx | ||
) |
Definition at line 1801 of file Type.cpp.
References getExtProtoInfo(), clang::FunctionType::getReturnType(), and param_type_begin().
Referenced by clang::ASTContext::getFunctionType().
static void clang::FunctionProtoType::Profile | ( | llvm::FoldingSetNodeID & | ID, |
QualType | Result, | ||
param_type_iterator | ArgTys, | ||
unsigned | NumArgs, | ||
const ExtProtoInfo & | EPI, | ||
const ASTContext & | Context | ||
) | [static] |
friend class ASTContext [friend] |
Reimplemented from clang::Type.