clang API Documentation

Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends
clang::FunctionProtoType Class Reference

#include <Type.h>

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

List of all members.

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 QualTypeparam_type_iterator
typedef llvm::iterator_range
< param_type_iterator
param_type_range
typedef const QualTypeexception_iterator

Public Member Functions

unsigned getNumParams () const
QualType getParamType (unsigned i) const
ArrayRef< QualTypegetParamTypes () 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
ExprgetNoexceptExpr () const
FunctionDeclgetExceptionSpecDecl () 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.
FunctionDeclgetExceptionSpecTemplate () 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< QualTypeexceptions () 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

Detailed Description

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.

Definition at line 2850 of file Type.h.


Member Typedef Documentation

Definition at line 3095 of file Type.h.

Definition at line 3082 of file Type.h.

Definition at line 3083 of file Type.h.


Member Enumeration Documentation

Result type of getNoexceptSpec().

Enumerator:
NR_NoNoexcept 

There is no noexcept specifier.

NR_BadNoexcept 

The noexcept specifier has a bad expression.

NR_Dependent 

The noexcept specifier is dependent.

NR_Throw 

The noexcept specifier evaluates to false.

NR_Nothrow 

The noexcept specifier evaluates to true.

Definition at line 3018 of file Type.h.


Member Function Documentation

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().

Definition at line 3119 of file Type.h.

Definition at line 3100 of file Type.h.

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

Definition at line 3104 of file Type.h.

References clang::EST_Dynamic.

ArrayRef<QualType> clang::FunctionProtoType::exceptions ( ) 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().

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().

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().

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().

ArrayRef<QualType> clang::FunctionProtoType::getParamTypes ( ) 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().

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().

Return whether this function has a dynamic (throw) exception spec.

Definition at line 3008 of file Type.h.

References clang::isDynamicExceptionSpec().

Referenced by printExceptionSpecification().

Return whether this function has a noexcept exception spec.

Definition at line 3012 of file Type.h.

References clang::isNoexceptExceptionSpec().

bool FunctionProtoType::isNothrow ( const ASTContext Ctx,
bool  ResultIfDependent = false 
) const

Definition at line 3118 of file Type.h.

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().

void FunctionProtoType::printExceptionSpecification ( raw_ostream &  OS,
const PrintingPolicy Policy 
) const
void FunctionProtoType::Profile ( llvm::FoldingSetNodeID &  ID,
const ASTContext Ctx 
)
static void clang::FunctionProtoType::Profile ( llvm::FoldingSetNodeID &  ID,
QualType  Result,
param_type_iterator  ArgTys,
unsigned  NumArgs,
const ExtProtoInfo EPI,
const ASTContext Context 
) [static]

Friends And Related Function Documentation

friend class ASTContext [friend]

Reimplemented from clang::Type.

Definition at line 2951 of file Type.h.


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