clang API Documentation
ParmVarDecl - Represents a parameter to a function. More...
#include <Decl.h>


Public Types | |
| enum | { MaxFunctionScopeDepth = 255 } |
| enum | { MaxFunctionScopeIndex = 255 } |
Public Member Functions | |
| virtual SourceRange | getSourceRange () const |
| Source range that this declaration covers. | |
| void | setObjCMethodScopeInfo (unsigned parameterIndex) |
| void | setScopeInfo (unsigned scopeDepth, unsigned parameterIndex) |
| bool | isObjCMethodParameter () const |
| unsigned | getFunctionScopeDepth () const |
| unsigned | getFunctionScopeIndex () const |
| Returns the index of this parameter in its prototype or method scope. | |
| ObjCDeclQualifier | getObjCDeclQualifier () const |
| void | setObjCDeclQualifier (ObjCDeclQualifier QTVal) |
| bool | isKNRPromoted () const |
| void | setKNRPromoted (bool promoted) |
| Expr * | getDefaultArg () |
| const Expr * | getDefaultArg () const |
| void | setDefaultArg (Expr *defarg) |
| SourceRange | getDefaultArgRange () const |
| Retrieve the source range that covers the entire default argument. | |
| void | setUninstantiatedDefaultArg (Expr *arg) |
| Expr * | getUninstantiatedDefaultArg () |
| const Expr * | getUninstantiatedDefaultArg () const |
| bool | hasDefaultArg () const |
| bool | hasUnparsedDefaultArg () const |
| bool | hasUninstantiatedDefaultArg () const |
| void | setUnparsedDefaultArg () |
| bool | hasInheritedDefaultArg () const |
| void | setHasInheritedDefaultArg (bool I=true) |
| QualType | getOriginalType () const |
| bool | isParameterPack () const |
| Determine whether this parameter is actually a function parameter pack. | |
| void | setOwningFunction (DeclContext *FD) |
Static Public Member Functions | |
| static ParmVarDecl * | Create (ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, StorageClass SCAsWritten, Expr *DefArg) |
| static ParmVarDecl * | CreateDeserialized (ASTContext &C, unsigned ID) |
| static bool | classof (const Decl *D) |
| static bool | classof (const ParmVarDecl *D) |
| static bool | classofKind (Kind K) |
Protected Member Functions | |
| ParmVarDecl (Kind DK, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, StorageClass SCAsWritten, Expr *DefArg) | |
ParmVarDecl - Represents a parameter to a function.
| clang::ParmVarDecl::ParmVarDecl | ( | Kind | DK, |
| DeclContext * | DC, | ||
| SourceLocation | StartLoc, | ||
| SourceLocation | IdLoc, | ||
| IdentifierInfo * | Id, | ||
| QualType | T, | ||
| TypeSourceInfo * | TInfo, | ||
| StorageClass | S, | ||
| StorageClass | SCAsWritten, | ||
| Expr * | DefArg | ||
| ) | [inline, protected] |
Definition at line 1178 of file Decl.h.
References clang::VarDecl::ParmVarDeclBits, and setDefaultArg().
Referenced by Create(), and CreateDeserialized().
| static bool clang::ParmVarDecl::classof | ( | const Decl * | D | ) | [inline, static] |
Reimplemented from clang::VarDecl.
Definition at line 1335 of file Decl.h.
References classofKind(), and clang::Decl::getKind().
| static bool clang::ParmVarDecl::classof | ( | const ParmVarDecl * | D | ) | [inline, static] |
| static bool clang::ParmVarDecl::classofKind | ( | Kind | K | ) | [inline, static] |
Reimplemented from clang::VarDecl.
Definition at line 1337 of file Decl.h.
Referenced by classof(), clang::FunctionDecl::classof(), clang::FieldDecl::classof(), clang::EnumConstantDecl::classof(), clang::IndirectFieldDecl::classof(), clang::TypeDecl::classof(), clang::TypedefNameDecl::classof(), clang::TypedefDecl::classof(), clang::TypeAliasDecl::classof(), clang::TagDecl::classof(), clang::EnumDecl::classof(), clang::RecordDecl::classof(), clang::FileScopeAsmDecl::classof(), clang::BlockDecl::classof(), and clang::ImportDecl::classof().
| ParmVarDecl * ParmVarDecl::Create | ( | ASTContext & | C, |
| DeclContext * | DC, | ||
| SourceLocation | StartLoc, | ||
| SourceLocation | IdLoc, | ||
| IdentifierInfo * | Id, | ||
| QualType | T, | ||
| TypeSourceInfo * | TInfo, | ||
| StorageClass | S, | ||
| StorageClass | SCAsWritten, | ||
| Expr * | DefArg | ||
| ) | [static] |
Definition at line 1503 of file Decl.cpp.
References ParmVarDecl().
Referenced by clang::Sema::BuildParmVarDeclForTypedef(), clang::Sema::CheckParameter(), clang::FunctionDecl::Create(), clang::Sema::DeclareGlobalAllocationFunction(), clang::Sema::DeclareImplicitCopyAssignment(), clang::Sema::DeclareImplicitCopyConstructor(), clang::Sema::DeclareImplicitMoveAssignment(), clang::Sema::DeclareImplicitMoveConstructor(), clang::Sema::DeclareInheritedConstructors(), clang::Sema::LazilyCreateBuiltin(), clang::Sema::MergeFunctionDecl(), clang::Sema::ProcessPropertyDecl(), clang::TreeTransform< Derived >::TransformFunctionTypeParam(), and clang::ASTNodeImporter::VisitParmVarDecl().
| ParmVarDecl * ParmVarDecl::CreateDeserialized | ( | ASTContext & | C, |
| unsigned | ID | ||
| ) | [static] |
Reimplemented from clang::VarDecl.
Definition at line 1513 of file Decl.cpp.
References clang::Decl::AllocateDeserializedDecl(), ParmVarDecl(), and clang::SC_None.
| Expr * ParmVarDecl::getDefaultArg | ( | ) |
Definition at line 1529 of file Decl.cpp.
References Arg, clang::VarDecl::getInit(), hasUninstantiatedDefaultArg(), and hasUnparsedDefaultArg().
Referenced by clang::Sema::BuildCXXDefaultArgExpr(), clang::Sema::CheckExtraCXXDefaultArguments(), getDefaultArg(), clang::CXXDefaultArgExpr::getExpr(), and clang::Sema::SubstParmVarDecl().
| const Expr* clang::ParmVarDecl::getDefaultArg | ( | ) | const [inline] |
Definition at line 1255 of file Decl.h.
References getDefaultArg().
| SourceRange ParmVarDecl::getDefaultArgRange | ( | ) | const |
Retrieve the source range that covers the entire default argument.
Definition at line 1541 of file Decl.cpp.
References clang::VarDecl::getInit(), clang::Stmt::getSourceRange(), getUninstantiatedDefaultArg(), and hasUninstantiatedDefaultArg().
Referenced by CheckOperatorNewDeclaration(), getSourceRange(), and clang::Sema::MergeCXXFunctionDecl().
| unsigned clang::ParmVarDecl::getFunctionScopeDepth | ( | ) | const [inline] |
Definition at line 1220 of file Decl.h.
References clang::VarDecl::ParmVarDeclBits.
Referenced by clang::Sema::SubstParmVarDecl(), clang::TreeTransform< Derived >::TransformFunctionTypeParam(), and clang::ASTDeclWriter::VisitParmVarDecl().
| unsigned clang::ParmVarDecl::getFunctionScopeIndex | ( | ) | const [inline] |
Returns the index of this parameter in its prototype or method scope.
Definition at line 1226 of file Decl.h.
Referenced by clang::Sema::SubstParmVarDecl(), clang::TreeTransform< Derived >::TransformFunctionTypeParam(), and clang::ASTDeclWriter::VisitParmVarDecl().
| ObjCDeclQualifier clang::ParmVarDecl::getObjCDeclQualifier | ( | ) | const [inline] |
Definition at line 1230 of file Decl.h.
References clang::Decl::OBJC_TQ_None, and clang::VarDecl::ParmVarDeclBits.
Referenced by CheckMethodOverrideParam(), FormatFunctionParameter(), clang::ASTContext::getObjCEncodingForMethodDecl(), and clang::ASTDeclWriter::VisitParmVarDecl().
| QualType clang::ParmVarDecl::getOriginalType | ( | ) | const [inline] |
Definition at line 1318 of file Decl.h.
References clang::TypeSourceInfo::getType(), clang::ValueDecl::getType(), and clang::DeclaratorDecl::getTypeSourceInfo().
Referenced by clang::Sema::CheckParmsForFunctionDef(), clang::Sema::CheckStaticArrayArgument(), clang::CodeCompleteConsumer::OverloadCandidate::CreateSignatureString(), clang::ASTContext::getObjCEncodingForBlock(), clang::ASTContext::getObjCEncodingForFunctionDecl(), clang::ASTContext::getObjCEncodingForMethodDecl(), and isPointerToConst().
| SourceRange ParmVarDecl::getSourceRange | ( | ) | const [virtual] |
Source range that this declaration covers.
Reimplemented from clang::VarDecl.
Definition at line 1519 of file Decl.cpp.
References getDefaultArgRange(), clang::SourceRange::getEnd(), clang::DeclaratorDecl::getOuterLocStart(), hasInheritedDefaultArg(), and clang::SourceRange::isValid().
Referenced by CheckConstexprParameterTypes().
| Expr* clang::ParmVarDecl::getUninstantiatedDefaultArg | ( | ) | [inline] |
Definition at line 1269 of file Decl.h.
References clang::VarDecl::Init.
Referenced by clang::Sema::BuildCXXDefaultArgExpr(), getDefaultArgRange(), clang::Sema::MergeCXXFunctionDecl(), clang::Sema::SubstParmVarDecl(), and clang::ASTDeclWriter::VisitParmVarDecl().
| const Expr* clang::ParmVarDecl::getUninstantiatedDefaultArg | ( | ) | const [inline] |
Definition at line 1272 of file Decl.h.
References clang::VarDecl::Init.
| bool clang::ParmVarDecl::hasDefaultArg | ( | ) | const [inline] |
hasDefaultArg - Determines whether this parameter has a default argument, either parsed or not.
Definition at line 1278 of file Decl.h.
References clang::VarDecl::getInit(), hasUninstantiatedDefaultArg(), and hasUnparsedDefaultArg().
Referenced by AddFunctionParameterChunks(), clang::Sema::CheckConstructor(), clang::Sema::CheckCXXDefaultArguments(), CheckOperatorNewDeclaration(), clang::CXXConstructorDecl::isConvertingConstructor(), clang::CXXConstructorDecl::isDefaultConstructor(), clang::Sema::isInitListConstructor(), clang::Sema::MergeCXXFunctionDecl(), and NeedsInstantiationAsFunctionType().
| bool clang::ParmVarDecl::hasInheritedDefaultArg | ( | ) | const [inline] |
Definition at line 1310 of file Decl.h.
References clang::VarDecl::ParmVarDeclBits.
Referenced by getSourceRange(), clang::Sema::SubstParmVarDecl(), clang::ASTDeclWriter::VisitParmVarDecl(), and clang::ASTNodeImporter::VisitParmVarDecl().
| bool clang::ParmVarDecl::hasUninstantiatedDefaultArg | ( | ) | const [inline] |
Definition at line 1297 of file Decl.h.
References clang::VarDecl::Init.
Referenced by clang::Sema::BuildCXXDefaultArgExpr(), getDefaultArg(), getDefaultArgRange(), hasDefaultArg(), clang::Sema::MergeCXXFunctionDecl(), clang::Sema::SubstParmVarDecl(), and clang::ASTDeclWriter::VisitParmVarDecl().
| bool clang::ParmVarDecl::hasUnparsedDefaultArg | ( | ) | const [inline] |
hasUnparsedDefaultArg - Determines whether this parameter has a default argument that has not yet been parsed. This will occur during the processing of a C++ class whose member functions have default arguments, e.g.,
class X { public: void f(int x = 17); // x has an unparsed default argument now }; // x has a regular default argument now
Definition at line 1293 of file Decl.h.
References clang::VarDecl::Init.
Referenced by clang::Sema::ActOnDelayedCXXMethodParameter(), clang::Sema::BuildCXXDefaultArgExpr(), clang::Sema::CheckExtraCXXDefaultArguments(), getDefaultArg(), hasDefaultArg(), and clang::Sema::SubstParmVarDecl().
| bool clang::ParmVarDecl::isKNRPromoted | ( | ) | const [inline] |
True if the value passed to this parameter must undergo K&R-style default argument promotion:
C99 6.5.2.2. If the expression that denotes the called function has a type that does not include a prototype, the integer promotions are performed on each argument, and arguments that have type float are promoted to double.
Definition at line 1247 of file Decl.h.
References clang::VarDecl::ParmVarDeclBits.
Referenced by clang::ASTDeclWriter::VisitParmVarDecl().
| bool clang::ParmVarDecl::isObjCMethodParameter | ( | ) | const [inline] |
Definition at line 1216 of file Decl.h.
References clang::VarDecl::ParmVarDeclBits.
Referenced by clang::ASTDeclWriter::VisitParmVarDecl().
| bool ParmVarDecl::isParameterPack | ( | ) | const |
Determine whether this parameter is actually a function parameter pack.
Reimplemented from clang::Decl.
Definition at line 1551 of file Decl.cpp.
References clang::ValueDecl::getType().
Referenced by clang::Sema::InstantiateFunctionDefinition(), isVariadicFunctionTemplate(), clang::TemplateDeclInstantiator::SubstFunctionType(), and clang::Sema::SubstParmVarDecl().
| void clang::ParmVarDecl::setDefaultArg | ( | Expr * | defarg | ) | [inline] |
Definition at line 1259 of file Decl.h.
References clang::VarDecl::Init.
Referenced by clang::Sema::ActOnDelayedCXXMethodParameter(), clang::Sema::CheckCXXDefaultArguments(), clang::Sema::CheckExtraCXXDefaultArguments(), clang::Sema::MergeCXXFunctionDecl(), ParmVarDecl(), and clang::Sema::SetParamDefaultArgument().
| void clang::ParmVarDecl::setHasInheritedDefaultArg | ( | bool | I = true | ) | [inline] |
Definition at line 1314 of file Decl.h.
References clang::VarDecl::ParmVarDeclBits.
Referenced by clang::Sema::MergeCXXFunctionDecl(), clang::Sema::SubstParmVarDecl(), and clang::ASTNodeImporter::VisitParmVarDecl().
| void clang::ParmVarDecl::setKNRPromoted | ( | bool | promoted | ) | [inline] |
Definition at line 1250 of file Decl.h.
References clang::VarDecl::ParmVarDeclBits.
Referenced by GetFullTypeForDeclarator().
| void clang::ParmVarDecl::setObjCDeclQualifier | ( | ObjCDeclQualifier | QTVal | ) | [inline] |
Definition at line 1234 of file Decl.h.
References clang::VarDecl::ParmVarDeclBits.
Referenced by clang::Sema::ActOnMethodDeclaration().
| void clang::ParmVarDecl::setObjCMethodScopeInfo | ( | unsigned | parameterIndex | ) | [inline] |
Definition at line 1201 of file Decl.h.
References clang::VarDecl::ParmVarDeclBits.
Referenced by clang::Sema::ActOnMethodDeclaration(), and clang::ASTDeclReader::VisitParmVarDecl().
| void clang::ParmVarDecl::setOwningFunction | ( | DeclContext * | FD | ) | [inline] |
setOwningFunction - Sets the function declaration that owns this ParmVarDecl. Since ParmVarDecls are often created before the FunctionDecls that own them, this routine is required to update the DeclContext appropriately.
Definition at line 1332 of file Decl.h.
References clang::Decl::setDeclContext().
Referenced by clang::Sema::ActOnStartOfFunctionDef(), clang::Sema::ActOnStartOfLambdaDefinition(), and clang::ASTNodeImporter::VisitObjCMethodDecl().
| void clang::ParmVarDecl::setScopeInfo | ( | unsigned | scopeDepth, |
| unsigned | parameterIndex | ||
| ) | [inline] |
Definition at line 1206 of file Decl.h.
References clang::VarDecl::ParmVarDeclBits.
Referenced by clang::Sema::ActOnFunctionDeclarator(), clang::Sema::ActOnParamDeclarator(), clang::Sema::DeclClonePragmaWeak(), clang::Sema::LazilyCreateBuiltin(), clang::Sema::MergeFunctionDecl(), clang::Sema::SubstParmVarDecl(), clang::TreeTransform< Derived >::TransformFunctionTypeParam(), clang::TemplateDeclInstantiator::VisitFunctionDecl(), and clang::ASTDeclReader::VisitParmVarDecl().
| void clang::ParmVarDecl::setUninstantiatedDefaultArg | ( | Expr * | arg | ) | [inline] |
Definition at line 1266 of file Decl.h.
References clang::VarDecl::Init.
Referenced by clang::Sema::MergeCXXFunctionDecl(), clang::Sema::SubstParmVarDecl(), and clang::ASTDeclReader::VisitParmVarDecl().
| void clang::ParmVarDecl::setUnparsedDefaultArg | ( | ) | [inline] |
setUnparsedDefaultArg - Specify that this parameter has an unparsed default argument. The argument will be replaced with a real default argument via setDefaultArg when the class definition enclosing the function declaration that owns this default argument is completed.
Definition at line 1306 of file Decl.h.
References clang::VarDecl::Init.
Referenced by clang::Sema::ActOnParamUnparsedDefaultArgument(), and clang::Sema::SubstParmVarDecl().