clang API Documentation

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
clang::ParmVarDecl Class Reference

ParmVarDecl - Represents a parameter to a function. More...

#include <Decl.h>

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

List of all members.

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)
ExprgetDefaultArg ()
const ExprgetDefaultArg () const
void setDefaultArg (Expr *defarg)
SourceRange getDefaultArgRange () const
 Retrieve the source range that covers the entire default argument.
void setUninstantiatedDefaultArg (Expr *arg)
ExprgetUninstantiatedDefaultArg ()
const ExprgetUninstantiatedDefaultArg () 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 ParmVarDeclCreate (ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, StorageClass SCAsWritten, Expr *DefArg)
static ParmVarDeclCreateDeserialized (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)

Detailed Description

ParmVarDecl - Represents a parameter to a function.

Definition at line 1172 of file Decl.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
MaxFunctionScopeDepth 

Definition at line 1174 of file Decl.h.

anonymous enum
Enumerator:
MaxFunctionScopeIndex 

Definition at line 1175 of file Decl.h.


Constructor & Destructor Documentation

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


Member Function Documentation

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]

Definition at line 1336 of file Decl.h.

static bool clang::ParmVarDecl::classofKind ( Kind  K) [inline, static]
ParmVarDecl * ParmVarDecl::Create ( ASTContext C,
DeclContext DC,
SourceLocation  StartLoc,
SourceLocation  IdLoc,
IdentifierInfo Id,
QualType  T,
TypeSourceInfo TInfo,
StorageClass  S,
StorageClass  SCAsWritten,
Expr DefArg 
) [static]
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 ( )
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]
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]
QualType clang::ParmVarDecl::getOriginalType ( ) const [inline]
SourceRange ParmVarDecl::getSourceRange ( ) const [virtual]
Expr* clang::ParmVarDecl::getUninstantiatedDefaultArg ( ) [inline]
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]
bool clang::ParmVarDecl::hasInheritedDefaultArg ( ) const [inline]
bool clang::ParmVarDecl::hasUninstantiatedDefaultArg ( ) const [inline]
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]
void clang::ParmVarDecl::setHasInheritedDefaultArg ( bool  I = true) [inline]
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]
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]
void clang::ParmVarDecl::setUninstantiatedDefaultArg ( Expr arg) [inline]
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().


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