class DeclRefExpr
Declaration
class DeclRefExpr : public Expr, private TrailingObjects { /* full declaration omitted */ };
Description
A reference to a declared variable, function, enum, etc. [C99 6.5.1p2] This encodes all the information about how a declaration is referenced within an expression. There are several optional constructs attached to DeclRefExprs only when they apply in order to conserve memory. These are laid out past the end of the object, and flags in the DeclRefExprBitfield track whether they exist: DeclRefExprBits.HasQualifier: Specifies when this declaration reference expression has a C++ nested-name-specifier. DeclRefExprBits.HasFoundDecl: Specifies when this declaration reference expression has a record of a NamedDecl (different from the referenced ValueDecl) which was found during name lookup and/or overload resolution. DeclRefExprBits.HasTemplateKWAndArgsInfo: Specifies when this declaration reference expression has an explicit C++ template keyword and/or template argument list. DeclRefExprBits.RefersToEnclosingVariableOrCapture Specifies when this declaration reference expression (validly) refers to an enclosed local or a captured variable.
Declared at: clang/include/clang/AST/Expr.h:1223
Inherits from: Expr, TrailingObjects
Member Variables
- private clang::ValueDecl* D
- The declaration that we are referencing.
- private clang::DeclarationNameLoc DNLoc
- Provides source/type location info for the declaration name embedded in D.
Inherited from Stmt:
Method Overview
- public static clang::DeclRefExpr * Create(const clang::ASTContext & Context, clang::NestedNameSpecifierLoc QualifierLoc, clang::SourceLocation TemplateKWLoc, clang::ValueDecl * D, bool RefersToEnclosingVariableOrCapture, clang::SourceLocation NameLoc, clang::QualType T, clang::ExprValueKind VK, clang::NamedDecl * FoundD = nullptr, const clang::TemplateArgumentListInfo * TemplateArgs = nullptr, clang::NonOdrUseReason NOUR = NOUR_None)
- public static clang::DeclRefExpr * Create(const clang::ASTContext & Context, clang::NestedNameSpecifierLoc QualifierLoc, clang::SourceLocation TemplateKWLoc, clang::ValueDecl * D, bool RefersToEnclosingVariableOrCapture, const clang::DeclarationNameInfo & NameInfo, clang::QualType T, clang::ExprValueKind VK, clang::NamedDecl * FoundD = nullptr, const clang::TemplateArgumentListInfo * TemplateArgs = nullptr, clang::NonOdrUseReason NOUR = NOUR_None)
- public static clang::DeclRefExpr * CreateEmpty(const clang::ASTContext & Context, bool HasQualifier, bool HasFoundDecl, bool HasTemplateKWAndArgsInfo, unsigned int NumTemplateArgs)
- private DeclRefExpr(const clang::ASTContext & Ctx, clang::NestedNameSpecifierLoc QualifierLoc, clang::SourceLocation TemplateKWLoc, clang::ValueDecl * D, bool RefersToEnlosingVariableOrCapture, const clang::DeclarationNameInfo & NameInfo, clang::NamedDecl * FoundD, const clang::TemplateArgumentListInfo * TemplateArgs, clang::QualType T, clang::ExprValueKind VK, clang::NonOdrUseReason NOUR)
- private DeclRefExpr(clang::Stmt::EmptyShell Empty)
- public DeclRefExpr(const clang::ASTContext & Ctx, clang::ValueDecl * D, bool RefersToEnclosingVariableOrCapture, clang::QualType T, clang::ExprValueKind VK, clang::SourceLocation L, const clang::DeclarationNameLoc & LocInfo = clang::DeclarationNameLoc(), clang::NonOdrUseReason NOUR = NOUR_None)
- public clang::Stmt::const_child_range children() const
- public clang::Stmt::child_range children()
- public static bool classof(const clang::Stmt * T)
- public void copyTemplateArgumentsInto(clang::TemplateArgumentListInfo & List) const
- public clang::SourceLocation getBeginLoc() const
- public clang::ValueDecl * getDecl()
- public const clang::ValueDecl * getDecl() const
- public clang::SourceLocation getEndLoc() const
- public const clang::NamedDecl * getFoundDecl() const
- public clang::NamedDecl * getFoundDecl()
- public clang::SourceLocation getLAngleLoc() const
- public clang::SourceLocation getLocation() const
- public clang::DeclarationNameInfo getNameInfo() const
- public unsigned int getNumTemplateArgs() const
- public clang::NestedNameSpecifier * getQualifier() const
- public clang::NestedNameSpecifierLoc getQualifierLoc() const
- public clang::SourceLocation getRAngleLoc() const
- public const clang::TemplateArgumentLoc * getTemplateArgs() const
- public clang::SourceLocation getTemplateKeywordLoc() const
- public bool hadMultipleCandidates() const
- public bool hasExplicitTemplateArgs() const
- private bool hasFoundDecl() const
- public bool hasQualifier() const
- public bool hasTemplateKWAndArgsInfo() const
- public bool hasTemplateKeyword() const
- public clang::NonOdrUseReason isNonOdrUse() const
- private size_t numTrailingObjects(OverloadToken<clang::NestedNameSpecifierLoc>) const
- private size_t numTrailingObjects(OverloadToken<clang::ASTTemplateKWAndArgsInfo>) const
- private size_t numTrailingObjects(OverloadToken<clang::NamedDecl *>) const
- public bool refersToEnclosingVariableOrCapture() const
- public void setDecl(clang::ValueDecl * NewD)
- public void setHadMultipleCandidates(bool V = true)
- public void setLocation(clang::SourceLocation L)
- public ArrayRef<clang::TemplateArgumentLoc> template_arguments() const
Inherited from Expr:
- public Classify
- public ClassifyLValue
- public ClassifyModifiable
- public EvaluateAsBooleanCondition
- public EvaluateAsConstantExpr
- public EvaluateAsFixedPoint
- public EvaluateAsFloat
- public EvaluateAsInitializer
- public EvaluateAsInt
- public EvaluateAsLValue
- public EvaluateAsRValue
- public EvaluateForOverflow
- public EvaluateKnownConstInt
- public EvaluateKnownConstIntCheckOverflow
- public EvaluateWithSubstitution
- public HasSideEffects
- public IgnoreCasts
- public IgnoreCasts
- public IgnoreConversionOperatorSingleStep
- public IgnoreConversionOperatorSingleStep
- public IgnoreImpCasts
- public IgnoreImpCasts
- public IgnoreImplicit
- public IgnoreImplicit
- public IgnoreImplicitAsWritten
- public IgnoreImplicitAsWritten
- public IgnoreParenBaseCasts
- public IgnoreParenBaseCasts
- public IgnoreParenCasts
- public IgnoreParenCasts
- public IgnoreParenImpCasts
- public IgnoreParenImpCasts
- public IgnoreParenLValueCasts
- public IgnoreParenLValueCasts
- public IgnoreParenNoopCasts
- public IgnoreParenNoopCasts
- public IgnoreParens
- public IgnoreParens
- public IgnoreUnlessSpelledInSource
- public IgnoreUnlessSpelledInSource
- public classof
- public containsErrors
- public containsUnexpandedParameterPack
- public findBoundMemberType
- public getAsBuiltinConstantDeclRef
- public getBestDynamicClassType
- public getBestDynamicClassTypeExpr
- public getDependence
- public getExprLoc
- public getFPFeaturesInEffect
- public getIntegerConstantExpr
- public getObjCProperty
- public getObjectKind
- public getReferencedDeclOfCallee
- public getReferencedDeclOfCallee
- public getSourceBitField
- public getSourceBitField
- public getType
- public getValueKind
- public getValueKindForType
- public hasAnyTypeDependentArguments
- public hasNonTrivialCall
- public hasPlaceholderType
- public hasPlaceholderType
- public isBoundMemberFunction
- public isCXX11ConstantExpr
- public isCXX98IntegralConstantExpr
- public isConstantInitializer
- public isDefaultArgument
- public isEvaluatable
- public isGLValue
- public isImplicitCXXThis
- public isInstantiationDependent
- public isIntegerConstantExpr
- public isKnownToHaveBooleanValue
- public isLValue
- public isModifiableLvalue
- public isNullPointerConstant
- public isOBJCGCCandidate
- public isObjCSelfExpr
- public isOrdinaryOrBitFieldObject
- public isPRValue
- public isPotentialConstantExpr
- public isPotentialConstantExprUnevaluated
- public isReadIfDiscardedInCPlusPlus11
- public isSameComparisonOperand
- public isTemporaryObject
- public isTypeDependent
- public isUnusedResultAWarning
- public isValueDependent
- public isXValue
- public refersToBitField
- public refersToGlobalRegisterVar
- public refersToMatrixElement
- public refersToVectorElement
- protected setDependence
- public setObjectKind
- public setType
- public setValueKind
- public skipRValueSubobjectAdjustments
- public skipRValueSubobjectAdjustments
- public tryEvaluateObjectSize
- public tryEvaluateStrLen
Inherited from ValueStmt:
Inherited from Stmt:
- public EnableStatistics
- public IgnoreContainers
- public IgnoreContainers
- public PrintStats
- public ProcessODRHash
- public Profile
- public addStmtClass
- public child_begin
- public child_begin
- public child_end
- public child_end
- public children
- public children
- public determineLikelihoodConflict
- public dump
- public dump
- public dumpColor
- public dumpPretty
- public getBeginLoc
- public getEndLoc
- public getID
- public getLikelihood
- public getLikelihood
- public getLikelihood
- public getLikelihoodAttr
- public getSourceRange
- public getStmtClass
- public getStmtClassName
- public printJson
- public printPretty
- public printPrettyControlled
- public stripLabelLikeStatements
- public stripLabelLikeStatements
- public viewAST
Methods
¶static clang::DeclRefExpr* Create(
const clang::ASTContext& Context,
clang::NestedNameSpecifierLoc QualifierLoc,
clang::SourceLocation TemplateKWLoc,
clang::ValueDecl* D,
bool RefersToEnclosingVariableOrCapture,
clang::SourceLocation NameLoc,
clang::QualType T,
clang::ExprValueKind VK,
clang::NamedDecl* FoundD = nullptr,
const clang::TemplateArgumentListInfo*
TemplateArgs = nullptr,
clang::NonOdrUseReason NOUR = NOUR_None)
static clang::DeclRefExpr* Create(
const clang::ASTContext& Context,
clang::NestedNameSpecifierLoc QualifierLoc,
clang::SourceLocation TemplateKWLoc,
clang::ValueDecl* D,
bool RefersToEnclosingVariableOrCapture,
clang::SourceLocation NameLoc,
clang::QualType T,
clang::ExprValueKind VK,
clang::NamedDecl* FoundD = nullptr,
const clang::TemplateArgumentListInfo*
TemplateArgs = nullptr,
clang::NonOdrUseReason NOUR = NOUR_None)
Declared at: clang/include/clang/AST/Expr.h:1273
Parameters
- const clang::ASTContext& Context
- clang::NestedNameSpecifierLoc QualifierLoc
- clang::SourceLocation TemplateKWLoc
- clang::ValueDecl* D
- bool RefersToEnclosingVariableOrCapture
- clang::SourceLocation NameLoc
- clang::QualType T
- clang::ExprValueKind VK
- clang::NamedDecl* FoundD = nullptr
- const clang::TemplateArgumentListInfo* TemplateArgs = nullptr
- clang::NonOdrUseReason NOUR = NOUR_None
¶static clang::DeclRefExpr* Create(
const clang::ASTContext& Context,
clang::NestedNameSpecifierLoc QualifierLoc,
clang::SourceLocation TemplateKWLoc,
clang::ValueDecl* D,
bool RefersToEnclosingVariableOrCapture,
const clang::DeclarationNameInfo& NameInfo,
clang::QualType T,
clang::ExprValueKind VK,
clang::NamedDecl* FoundD = nullptr,
const clang::TemplateArgumentListInfo*
TemplateArgs = nullptr,
clang::NonOdrUseReason NOUR = NOUR_None)
static clang::DeclRefExpr* Create(
const clang::ASTContext& Context,
clang::NestedNameSpecifierLoc QualifierLoc,
clang::SourceLocation TemplateKWLoc,
clang::ValueDecl* D,
bool RefersToEnclosingVariableOrCapture,
const clang::DeclarationNameInfo& NameInfo,
clang::QualType T,
clang::ExprValueKind VK,
clang::NamedDecl* FoundD = nullptr,
const clang::TemplateArgumentListInfo*
TemplateArgs = nullptr,
clang::NonOdrUseReason NOUR = NOUR_None)
Declared at: clang/include/clang/AST/Expr.h:1281
Parameters
- const clang::ASTContext& Context
- clang::NestedNameSpecifierLoc QualifierLoc
- clang::SourceLocation TemplateKWLoc
- clang::ValueDecl* D
- bool RefersToEnclosingVariableOrCapture
- const clang::DeclarationNameInfo& NameInfo
- clang::QualType T
- clang::ExprValueKind VK
- clang::NamedDecl* FoundD = nullptr
- const clang::TemplateArgumentListInfo* TemplateArgs = nullptr
- clang::NonOdrUseReason NOUR = NOUR_None
¶static clang::DeclRefExpr* CreateEmpty(
const clang::ASTContext& Context,
bool HasQualifier,
bool HasFoundDecl,
bool HasTemplateKWAndArgsInfo,
unsigned int NumTemplateArgs)
static clang::DeclRefExpr* CreateEmpty(
const clang::ASTContext& Context,
bool HasQualifier,
bool HasFoundDecl,
bool HasTemplateKWAndArgsInfo,
unsigned int NumTemplateArgs)
Description
Construct an empty declaration reference expression.
Declared at: clang/include/clang/AST/Expr.h:1290
Parameters
- const clang::ASTContext& Context
- bool HasQualifier
- bool HasFoundDecl
- bool HasTemplateKWAndArgsInfo
- unsigned int NumTemplateArgs
¶DeclRefExpr(
const clang::ASTContext& Ctx,
clang::NestedNameSpecifierLoc QualifierLoc,
clang::SourceLocation TemplateKWLoc,
clang::ValueDecl* D,
bool RefersToEnlosingVariableOrCapture,
const clang::DeclarationNameInfo& NameInfo,
clang::NamedDecl* FoundD,
const clang::TemplateArgumentListInfo*
TemplateArgs,
clang::QualType T,
clang::ExprValueKind VK,
clang::NonOdrUseReason NOUR)
DeclRefExpr(
const clang::ASTContext& Ctx,
clang::NestedNameSpecifierLoc QualifierLoc,
clang::SourceLocation TemplateKWLoc,
clang::ValueDecl* D,
bool RefersToEnlosingVariableOrCapture,
const clang::DeclarationNameInfo& NameInfo,
clang::NamedDecl* FoundD,
const clang::TemplateArgumentListInfo*
TemplateArgs,
clang::QualType T,
clang::ExprValueKind VK,
clang::NonOdrUseReason NOUR)
Declared at: clang/include/clang/AST/Expr.h:1255
Parameters
- const clang::ASTContext& Ctx
- clang::NestedNameSpecifierLoc QualifierLoc
- clang::SourceLocation TemplateKWLoc
- clang::ValueDecl* D
- bool RefersToEnlosingVariableOrCapture
- const clang::DeclarationNameInfo& NameInfo
- clang::NamedDecl* FoundD
- const clang::TemplateArgumentListInfo* TemplateArgs
- clang::QualType T
- clang::ExprValueKind VK
- clang::NonOdrUseReason NOUR
¶DeclRefExpr(clang::Stmt::EmptyShell Empty)
DeclRefExpr(clang::Stmt::EmptyShell Empty)
Description
Construct an empty declaration reference expression.
Declared at: clang/include/clang/AST/Expr.h:1263
Parameters
- clang::Stmt::EmptyShell Empty
¶DeclRefExpr(
const clang::ASTContext& Ctx,
clang::ValueDecl* D,
bool RefersToEnclosingVariableOrCapture,
clang::QualType T,
clang::ExprValueKind VK,
clang::SourceLocation L,
const clang::DeclarationNameLoc& LocInfo =
clang::DeclarationNameLoc(),
clang::NonOdrUseReason NOUR = NOUR_None)
DeclRefExpr(
const clang::ASTContext& Ctx,
clang::ValueDecl* D,
bool RefersToEnclosingVariableOrCapture,
clang::QualType T,
clang::ExprValueKind VK,
clang::SourceLocation L,
const clang::DeclarationNameLoc& LocInfo =
clang::DeclarationNameLoc(),
clang::NonOdrUseReason NOUR = NOUR_None)
Declared at: clang/include/clang/AST/Expr.h:1266
Parameters
- const clang::ASTContext& Ctx
- clang::ValueDecl* D
- bool RefersToEnclosingVariableOrCapture
- clang::QualType T
- clang::ExprValueKind VK
- clang::SourceLocation L
- const clang::DeclarationNameLoc& LocInfo = clang::DeclarationNameLoc()
- clang::NonOdrUseReason NOUR = NOUR_None
¶clang::Stmt::const_child_range children() const
clang::Stmt::const_child_range children() const
Declared at: clang/include/clang/AST/Expr.h:1438
¶clang::Stmt::child_range children()
clang::Stmt::child_range children()
Declared at: clang/include/clang/AST/Expr.h:1434
¶static bool classof(const clang::Stmt* T)
static bool classof(const clang::Stmt* T)
Declared at: clang/include/clang/AST/Expr.h:1429
Parameters
- const clang::Stmt* T
¶void copyTemplateArgumentsInto(
clang::TemplateArgumentListInfo& List) const
void copyTemplateArgumentsInto(
clang::TemplateArgumentListInfo& List) const
Description
Copies the template arguments (if present) into the given structure.
Declared at: clang/include/clang/AST/Expr.h:1380
Parameters
¶clang::SourceLocation getBeginLoc() const
clang::SourceLocation getBeginLoc() const
Declared at: clang/include/clang/AST/Expr.h:1305
¶clang::ValueDecl* getDecl()
clang::ValueDecl* getDecl()
Declared at: clang/include/clang/AST/Expr.h:1295
¶const clang::ValueDecl* getDecl() const
const clang::ValueDecl* getDecl() const
Declared at: clang/include/clang/AST/Expr.h:1296
¶clang::SourceLocation getEndLoc() const
clang::SourceLocation getEndLoc() const
Declared at: clang/include/clang/AST/Expr.h:1306
¶const clang::NamedDecl* getFoundDecl() const
const clang::NamedDecl* getFoundDecl() const
Description
Get the NamedDecl through which this reference occurred. See non-const variant.
Declared at: clang/include/clang/AST/Expr.h:1338
¶clang::NamedDecl* getFoundDecl()
clang::NamedDecl* getFoundDecl()
Description
Get the NamedDecl through which this reference occurred. This Decl may be different from the ValueDecl actually referred to in the presence of using declarations, etc. It always returns non-NULL, and may simple return the ValueDecl when appropriate.
Declared at: clang/include/clang/AST/Expr.h:1332
¶clang::SourceLocation getLAngleLoc() const
clang::SourceLocation getLAngleLoc() const
Description
Retrieve the location of the left angle bracket starting the explicit template argument list following the name, if any.
Declared at: clang/include/clang/AST/Expr.h:1356
¶clang::SourceLocation getLocation() const
clang::SourceLocation getLocation() const
Declared at: clang/include/clang/AST/Expr.h:1303
¶clang::DeclarationNameInfo getNameInfo() const
clang::DeclarationNameInfo getNameInfo() const
Declared at: clang/include/clang/AST/Expr.h:1299
¶unsigned int getNumTemplateArgs() const
unsigned int getNumTemplateArgs() const
Description
Retrieve the number of template arguments provided as part of this template-id.
Declared at: clang/include/clang/AST/Expr.h:1396
¶clang::NestedNameSpecifier* getQualifier() const
clang::NestedNameSpecifier* getQualifier() const
Description
If the name was qualified, retrieves the nested-name-specifier that precedes the name. Otherwise, returns NULL.
Declared at: clang/include/clang/AST/Expr.h:1322
¶clang::NestedNameSpecifierLoc getQualifierLoc()
const
clang::NestedNameSpecifierLoc getQualifierLoc()
const
Description
If the name was qualified, retrieves the nested-name-specifier that precedes the name, with source-location information.
Declared at: clang/include/clang/AST/Expr.h:1314
¶clang::SourceLocation getRAngleLoc() const
clang::SourceLocation getRAngleLoc() const
Description
Retrieve the location of the right angle bracket ending the explicit template argument list following the name, if any.
Declared at: clang/include/clang/AST/Expr.h:1364
¶const clang::TemplateArgumentLoc*
getTemplateArgs() const
const clang::TemplateArgumentLoc*
getTemplateArgs() const
Description
Retrieve the template arguments provided as part of this template-id.
Declared at: clang/include/clang/AST/Expr.h:1388
¶clang::SourceLocation getTemplateKeywordLoc()
const
clang::SourceLocation getTemplateKeywordLoc()
const
Description
Retrieve the location of the template keyword preceding this name, if any.
Declared at: clang/include/clang/AST/Expr.h:1348
¶bool hadMultipleCandidates() const
bool hadMultipleCandidates() const
Description
Returns true if this expression refers to a function that was resolved from an overloaded set having size greater than 1.
Declared at: clang/include/clang/AST/Expr.h:1408
¶bool hasExplicitTemplateArgs() const
bool hasExplicitTemplateArgs() const
Description
Determines whether this declaration reference was followed by an explicit template argument list.
Declared at: clang/include/clang/AST/Expr.h:1376
¶bool hasFoundDecl() const
bool hasFoundDecl() const
Description
Test whether there is a distinct FoundDecl attached to the end of this DRE.
Declared at: clang/include/clang/AST/Expr.h:1253
¶bool hasQualifier() const
bool hasQualifier() const
Description
Determine whether this declaration reference was preceded by a C++ nested-name-specifier, e.g., \c N::foo.
Declared at: clang/include/clang/AST/Expr.h:1310
¶bool hasTemplateKWAndArgsInfo() const
bool hasTemplateKWAndArgsInfo() const
Declared at: clang/include/clang/AST/Expr.h:1342
¶bool hasTemplateKeyword() const
bool hasTemplateKeyword() const
Description
Determines whether the name in this declaration reference was preceded by the template keyword.
Declared at: clang/include/clang/AST/Expr.h:1372
¶clang::NonOdrUseReason isNonOdrUse() const
clang::NonOdrUseReason isNonOdrUse() const
Description
Is this expression a non-odr-use reference, and if so, why?
Declared at: clang/include/clang/AST/Expr.h:1419
¶size_t numTrailingObjects(
OverloadToken<clang::NestedNameSpecifierLoc>)
const
size_t numTrailingObjects(
OverloadToken<clang::NestedNameSpecifierLoc>)
const
Declared at: clang/include/clang/AST/Expr.h:1239
Parameters
- OverloadToken<clang::NestedNameSpecifierLoc>
¶size_t numTrailingObjects(
OverloadToken<
clang::ASTTemplateKWAndArgsInfo>) const
size_t numTrailingObjects(
OverloadToken<
clang::ASTTemplateKWAndArgsInfo>) const
Declared at: clang/include/clang/AST/Expr.h:1247
Parameters
- OverloadToken<clang::ASTTemplateKWAndArgsInfo>
¶size_t numTrailingObjects(
OverloadToken<clang::NamedDecl*>) const
size_t numTrailingObjects(
OverloadToken<clang::NamedDecl*>) const
Declared at: clang/include/clang/AST/Expr.h:1243
Parameters
- OverloadToken<clang::NamedDecl*>
¶bool refersToEnclosingVariableOrCapture() const
bool refersToEnclosingVariableOrCapture() const
Description
Does this DeclRefExpr refer to an enclosing local or a captured variable?
Declared at: clang/include/clang/AST/Expr.h:1425
¶void setDecl(clang::ValueDecl* NewD)
void setDecl(clang::ValueDecl* NewD)
Declared at: clang/include/clang/AST/Expr.h:1297
Parameters
- clang::ValueDecl* NewD
¶void setHadMultipleCandidates(bool V = true)
void setHadMultipleCandidates(bool V = true)
Description
Sets the flag telling whether this expression refers to a function that was resolved from an overloaded set having size greater than 1.
Declared at: clang/include/clang/AST/Expr.h:1414
Parameters
- bool V = true
¶void setLocation(clang::SourceLocation L)
void setLocation(clang::SourceLocation L)
Declared at: clang/include/clang/AST/Expr.h:1304
Parameters
¶ArrayRef<clang::TemplateArgumentLoc>
template_arguments() const
ArrayRef<clang::TemplateArgumentLoc>
template_arguments() const
Declared at: clang/include/clang/AST/Expr.h:1402