summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-12-16 08:01:48 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-12-16 08:01:48 +0000
commit07649fb7c5d7dec2e35b5c1c1c7907bafabb6a90 (patch)
treea8c4bef117584a8f09f1a47af931e335f584a6a0 /clang/lib/Sema
parent8c66273d0c35bf4f7b99b52427af4ec2fcac21cb (diff)
downloadbcm5719-llvm-07649fb7c5d7dec2e35b5c1c1c7907bafabb6a90.tar.gz
bcm5719-llvm-07649fb7c5d7dec2e35b5c1c1c7907bafabb6a90.zip
Renamed RefersToEnclosingLocal bitfield to RefersToCapturedVariable.
Bitfield RefersToEnclosingLocal of Stmt::DeclRefExprBitfields renamed to RefersToCapturedVariable to reflect latest changes introduced in commit 224323. Also renamed method Expr::refersToEnclosingLocal() to Expr::refersToCapturedVariable() and comments for constant arguments. No functional changes. llvm-svn: 224329
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp4
-rw-r--r--clang/lib/Sema/SemaDecl.cpp2
-rw-r--r--clang/lib/Sema/SemaExpr.cpp30
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp17
-rw-r--r--clang/lib/Sema/SemaStmt.cpp2
5 files changed, 28 insertions, 27 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 9c56bec7771..550474107c0 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4972,7 +4972,7 @@ static Expr *EvalAddr(Expr *E, SmallVectorImpl<DeclRefExpr *> &refVars,
DeclRefExpr *DR = cast<DeclRefExpr>(E);
// If we leave the immediate function, the lifetime isn't about to end.
- if (DR->refersToEnclosingLocal())
+ if (DR->refersToCapturedVariable())
return nullptr;
if (VarDecl *V = dyn_cast<VarDecl>(DR->getDecl()))
@@ -5139,7 +5139,7 @@ do {
DeclRefExpr *DR = cast<DeclRefExpr>(E);
// If we leave the immediate function, the lifetime isn't about to end.
- if (DR->refersToEnclosingLocal())
+ if (DR->refersToCapturedVariable())
return nullptr;
if (VarDecl *V = dyn_cast<VarDecl>(DR->getDecl())) {
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 0d33deaa5e5..298e4e705f6 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -10181,7 +10181,7 @@ static void RebuildLambdaScopeInfo(CXXMethodDecl *CallOperator,
QualType CaptureType = VD->getType();
const bool ByRef = C.getCaptureKind() == LCK_ByRef;
LSI->addCapture(VD, /*IsBlock*/false, ByRef,
- /*RefersToEnclosingLocal*/true, C.getLocation(),
+ /*RefersToCapturedVariable*/true, C.getLocation(),
/*EllipsisLoc*/C.isPackExpansion()
? C.getEllipsisLoc() : SourceLocation(),
CaptureType, /*Expr*/ nullptr);
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index f7756ba606c..04497f3efd6 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -1601,7 +1601,7 @@ Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK,
}
}
- bool refersToEnclosingScope =
+ bool RefersToCapturedVariable =
isa<VarDecl>(D) &&
NeedToCaptureVariable(cast<VarDecl>(D), NameInfo.getLoc());
@@ -1613,15 +1613,15 @@ Sema::BuildDeclRefExpr(ValueDecl *D, QualType Ty, ExprValueKind VK,
E = DeclRefExpr::Create(
Context,
SS ? SS->getWithLocInContext(Context) : NestedNameSpecifierLoc(),
- VarSpec->getTemplateKeywordLoc(), D, refersToEnclosingScope,
+ VarSpec->getTemplateKeywordLoc(), D, RefersToCapturedVariable,
NameInfo.getLoc(), Ty, VK, FoundD, TemplateArgs);
} else {
assert(!TemplateArgs && "No template arguments for non-variable"
" template specialization references");
- E = DeclRefExpr::Create(
- Context,
- SS ? SS->getWithLocInContext(Context) : NestedNameSpecifierLoc(),
- SourceLocation(), D, refersToEnclosingScope, NameInfo, Ty, VK, FoundD);
+ E = DeclRefExpr::Create(Context, SS ? SS->getWithLocInContext(Context)
+ : NestedNameSpecifierLoc(),
+ SourceLocation(), D, RefersToCapturedVariable,
+ NameInfo, Ty, VK, FoundD);
}
MarkDeclRefReferenced(E);
@@ -8586,7 +8586,7 @@ static NonConstCaptureKind isReferenceToNonConstCapture(Sema &S, Expr *E) {
// Must be a reference to a declaration from an enclosing scope.
DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E);
if (!DRE) return NCCK_None;
- if (!DRE->refersToEnclosingLocal()) return NCCK_None;
+ if (!DRE->refersToCapturedVariable()) return NCCK_None;
// The declaration must be a variable which is not declared 'const'.
VarDecl *var = dyn_cast<VarDecl>(DRE->getDecl());
@@ -11965,7 +11965,7 @@ static bool captureInCapturedRegion(CapturedRegionScopeInfo *RSI,
const bool BuildAndDiagnose,
QualType &CaptureType,
QualType &DeclRefType,
- const bool RefersToEnclosingLocal,
+ const bool RefersToCapturedVariable,
Sema &S) {
// By default, capture variables by reference.
@@ -11987,7 +11987,7 @@ static bool captureInCapturedRegion(CapturedRegionScopeInfo *RSI,
Field->setAccess(AS_private);
RD->addDecl(Field);
- CopyExpr = new (S.Context) DeclRefExpr(Var, RefersToEnclosingLocal,
+ CopyExpr = new (S.Context) DeclRefExpr(Var, RefersToCapturedVariable,
DeclRefType, VK_LValue, Loc);
Var->setReferenced(true);
Var->markUsed(S.Context);
@@ -11995,7 +11995,7 @@ static bool captureInCapturedRegion(CapturedRegionScopeInfo *RSI,
// Actually capture the variable.
if (BuildAndDiagnose)
- RSI->addCapture(Var, /*isBlock*/false, ByRef, RefersToEnclosingLocal, Loc,
+ RSI->addCapture(Var, /*isBlock*/false, ByRef, RefersToCapturedVariable, Loc,
SourceLocation(), CaptureType, CopyExpr);
@@ -12009,7 +12009,7 @@ static ExprResult addAsFieldToClosureType(Sema &S,
VarDecl *Var, QualType FieldType,
QualType DeclRefType,
SourceLocation Loc,
- bool RefersToEnclosingLocal) {
+ bool RefersToCapturedVariable) {
CXXRecordDecl *Lambda = LSI->Lambda;
// Build the non-static data member.
@@ -12038,7 +12038,7 @@ static ExprResult addAsFieldToClosureType(Sema &S,
// C++ [expr.prim.labda]p12:
// An entity captured by a lambda-expression is odr-used (3.2) in
// the scope containing the lambda-expression.
- Expr *Ref = new (S.Context) DeclRefExpr(Var, RefersToEnclosingLocal,
+ Expr *Ref = new (S.Context) DeclRefExpr(Var, RefersToCapturedVariable,
DeclRefType, VK_LValue, Loc);
Var->setReferenced(true);
Var->markUsed(S.Context);
@@ -12132,7 +12132,7 @@ static bool captureInLambda(LambdaScopeInfo *LSI,
const bool BuildAndDiagnose,
QualType &CaptureType,
QualType &DeclRefType,
- const bool RefersToEnclosingLocal,
+ const bool RefersToCapturedVariable,
const Sema::TryCaptureKind Kind,
SourceLocation EllipsisLoc,
const bool IsTopScope,
@@ -12206,7 +12206,7 @@ static bool captureInLambda(LambdaScopeInfo *LSI,
if (BuildAndDiagnose) {
ExprResult Result = addAsFieldToClosureType(S, LSI, Var,
CaptureType, DeclRefType, Loc,
- RefersToEnclosingLocal);
+ RefersToCapturedVariable);
if (!Result.isInvalid())
CopyExpr = Result.get();
}
@@ -12227,7 +12227,7 @@ static bool captureInLambda(LambdaScopeInfo *LSI,
// Add the capture.
if (BuildAndDiagnose)
- LSI->addCapture(Var, /*IsBlock=*/false, ByRef, RefersToEnclosingLocal,
+ LSI->addCapture(Var, /*IsBlock=*/false, ByRef, RefersToCapturedVariable,
Loc, EllipsisLoc, CaptureType, CopyExpr);
return true;
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index a1064d68b05..8dbf52fedb4 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -4166,11 +4166,12 @@ OMPClause *Sema::ActOnOpenMPPrivateClause(ArrayRef<Expr *> VarList,
if (VDPrivate->isInvalidDecl())
continue;
CurContext->addDecl(VDPrivate);
- auto VDPrivateRefExpr = DeclRefExpr::Create(
- Context, /*QualifierLoc*/ NestedNameSpecifierLoc(),
- /*TemplateKWLoc*/ SourceLocation(), VDPrivate,
- /*isEnclosingLocal*/ false, /*NameLoc*/ SourceLocation(), DE->getType(),
- /*VK*/ VK_LValue);
+ auto VDPrivateRefExpr =
+ DeclRefExpr::Create(Context, /*QualifierLoc*/ NestedNameSpecifierLoc(),
+ /*TemplateKWLoc*/ SourceLocation(), VDPrivate,
+ /*RefersToCapturedVariable*/ false,
+ /*NameLoc*/ SourceLocation(), DE->getType(),
+ /*VK*/ VK_LValue);
DSAStack->addDSA(VD, DE, OMPC_private);
Vars.push_back(DE);
@@ -4391,7 +4392,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
VDInitRefExpr = DeclRefExpr::Create(
Context, /*QualifierLoc*/ NestedNameSpecifierLoc(),
/*TemplateKWLoc*/ SourceLocation(), VDInit,
- /*isEnclosingLocal*/ true, ELoc, Type,
+ /*RefersToCapturedVariable*/ true, ELoc, Type,
/*VK*/ VK_LValue);
VDInit->setIsUsed();
auto Init = DefaultLvalueConversion(VDInitRefExpr).get();
@@ -4409,7 +4410,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
VDPrivate, DefaultLvalueConversion(
DeclRefExpr::Create(Context, NestedNameSpecifierLoc(),
SourceLocation(), DE->getDecl(),
- /*isEnclosingLocal=*/true,
+ /*RefersToCapturedVariable=*/true,
DE->getExprLoc(), DE->getType(),
/*VK=*/VK_LValue)).get(),
/*DirectInit=*/false, /*TypeMayContainAuto=*/false);
@@ -4425,7 +4426,7 @@ OMPClause *Sema::ActOnOpenMPFirstprivateClause(ArrayRef<Expr *> VarList,
auto VDPrivateRefExpr = DeclRefExpr::Create(
Context, /*QualifierLoc*/ NestedNameSpecifierLoc(),
/*TemplateKWLoc*/ SourceLocation(), VDPrivate,
- /*isEnclosingLocal*/ false, DE->getLocStart(), DE->getType(),
+ /*RefersToCapturedVariable*/ false, DE->getLocStart(), DE->getType(),
/*VK*/ VK_LValue);
DSAStack->addDSA(VD, DE, OMPC_firstprivate);
Vars.push_back(DE);
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 0c3bfd50acf..a3fd6fa9a17 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -2484,7 +2484,7 @@ VarDecl *Sema::getCopyElisionCandidate(QualType ReturnType,
// - in a return statement in a function [where] ...
// ... the expression is the name of a non-volatile automatic object ...
DeclRefExpr *DR = dyn_cast<DeclRefExpr>(E->IgnoreParens());
- if (!DR || DR->refersToEnclosingLocal())
+ if (!DR || DR->refersToCapturedVariable())
return nullptr;
VarDecl *VD = dyn_cast<VarDecl>(DR->getDecl());
if (!VD)
OpenPOWER on IntegriCloud