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

SourceRange getSourceRange () const override LLVM_READONLY
 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, Expr *DefArg)
static ParmVarDeclCreateDeserialized (ASTContext &C, unsigned ID)
static bool classof (const Decl *D)
static bool classofKind (Kind K)

Protected Member Functions

 ParmVarDecl (Kind DK, ASTContext &C, DeclContext *DC, SourceLocation StartLoc, SourceLocation IdLoc, IdentifierInfo *Id, QualType T, TypeSourceInfo *TInfo, StorageClass S, Expr *DefArg)

Detailed Description

ParmVarDecl - Represents a parameter to a function.

Definition at line 1248 of file Decl.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
MaxFunctionScopeDepth 

Definition at line 1250 of file Decl.h.

anonymous enum
Enumerator:
MaxFunctionScopeIndex 

Definition at line 1251 of file Decl.h.


Constructor & Destructor Documentation

clang::ParmVarDecl::ParmVarDecl ( Kind  DK,
ASTContext C,
DeclContext DC,
SourceLocation  StartLoc,
SourceLocation  IdLoc,
IdentifierInfo Id,
QualType  T,
TypeSourceInfo TInfo,
StorageClass  S,
Expr DefArg 
) [inline, protected]

Definition at line 1254 of file Decl.h.

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 1403 of file Decl.h.

References clang::Decl::getKind().

static bool clang::ParmVarDecl::classofKind ( Kind  K) [inline, static]

Reimplemented from clang::VarDecl.

Definition at line 1404 of file Decl.h.

ParmVarDecl * ParmVarDecl::Create ( ASTContext C,
DeclContext DC,
SourceLocation  StartLoc,
SourceLocation  IdLoc,
IdentifierInfo Id,
QualType  T,
TypeSourceInfo TInfo,
StorageClass  S,
Expr DefArg 
) [static]

Reimplemented from clang::VarDecl.

Definition at line 2220 of file Decl.cpp.

References AttributeLangSupport::C, ParmVarDecl(), and clang::SC_None.

const Expr* clang::ParmVarDecl::getDefaultArg ( ) const [inline]

Definition at line 1329 of file Decl.h.

Retrieve the source range that covers the entire default argument.

Definition at line 2253 of file Decl.cpp.

References clang::VarDecl::getInit(), clang::Stmt::getSourceRange(), getUninstantiatedDefaultArg(), and hasUninstantiatedDefaultArg().

Referenced by CheckOperatorNewDeclaration(), getSourceRange(), and clang::Sema::MergeCXXFunctionDecl().

SourceRange ParmVarDecl::getSourceRange ( ) const [override, virtual]

Definition at line 1346 of file Decl.h.

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 1367 of file Decl.h.

Referenced by clang::Sema::ActOnDelayedCXXMethodParameter(), clang::Sema::BuildCXXDefaultArgExpr(), clang::Sema::CheckExtraCXXDefaultArguments(), getDefaultArg(), and clang::Sema::SubstParmVarDecl().

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 1321 of file Decl.h.

Referenced by clang::ASTDeclWriter::VisitParmVarDecl().

Definition at line 1290 of file Decl.h.

Referenced by clang::ASTDeclWriter::VisitParmVarDecl().

Determine whether this parameter is actually a function parameter pack.

Reimplemented from clang::Decl.

Definition at line 2263 of file Decl.cpp.

References clang::ValueDecl::getType().

Referenced by addInstantiatedParametersToScope(), clang::CXXConstructorDecl::isConvertingConstructor(), isVariadicFunctionTemplate(), clang::TemplateDeclInstantiator::SubstFunctionType(), and clang::Sema::SubstParmVarDecl().

void clang::ParmVarDecl::setDefaultArg ( Expr defarg) [inline]
void clang::ParmVarDecl::setKNRPromoted ( bool  promoted) [inline]

Definition at line 1324 of file Decl.h.

Referenced by GetFullTypeForDeclarator().

Definition at line 1308 of file Decl.h.

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

void clang::ParmVarDecl::setObjCMethodScopeInfo ( unsigned  parameterIndex) [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 1400 of file Decl.h.

Referenced by clang::ASTNodeImporter::VisitObjCMethodDecl().

void clang::ParmVarDecl::setScopeInfo ( unsigned  scopeDepth,
unsigned  parameterIndex 
) [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 1380 of file Decl.h.

Referenced by clang::Sema::ActOnParamUnparsedDefaultArgument(), and clang::Sema::SubstParmVarDecl().


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