Skip to content

Commit cecba1d

Browse files
author
git apple-llvm automerger
committed
Merge commit '0adf6e8d332c' from llvm.org/main into next
2 parents c701079 + 0adf6e8 commit cecba1d

File tree

5 files changed

+14
-12
lines changed

5 files changed

+14
-12
lines changed

clang/include/clang/Basic/Attr.td

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,10 +2041,12 @@ private:
20412041
ArrayRef<SourceLocation> ArgLocs;
20422042

20432043
public:
2044-
static constexpr int THIS = 0;
2045-
static constexpr int INVALID = -1;
2046-
static constexpr int UNKNOWN = -2;
2047-
static constexpr int GLOBAL = -3;
2044+
enum ArgIndex {
2045+
This = 0,
2046+
Invalid = -1,
2047+
Unknown = -2,
2048+
Global = -3,
2049+
};
20482050

20492051
void setArgs(ArrayRef<IdentifierInfo*> Idents, ArrayRef<SourceLocation> Locs) {
20502052
assert(Idents.size() == params_Size);

clang/lib/Sema/CheckExprLifetime.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ static void visitFunctionCallArguments(IndirectLocalPath &Path, Expr *Call,
665665
CanonCallee->getParamDecl(I)->getAttr<LifetimeCaptureByAttr>();
666666
CaptureAttr && isa<CXXConstructorDecl>(CanonCallee) &&
667667
llvm::any_of(CaptureAttr->params(), [](int ArgIdx) {
668-
return ArgIdx == LifetimeCaptureByAttr::THIS;
668+
return ArgIdx == LifetimeCaptureByAttr::This;
669669
}))
670670
// `lifetime_capture_by(this)` in a class constructor has the same
671671
// semantics as `lifetimebound`:

clang/lib/Sema/SemaAttr.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ void Sema::inferLifetimeCaptureByAttribute(FunctionDecl *FD) {
290290
// pointer-like reference types (`const T&`, `T&&`).
291291
if (PVD->getType()->isReferenceType() &&
292292
sema::isGLSPointerType(PVD->getType().getNonReferenceType())) {
293-
int CaptureByThis[] = {LifetimeCaptureByAttr::THIS};
293+
int CaptureByThis[] = {LifetimeCaptureByAttr::This};
294294
PVD->addAttr(
295295
LifetimeCaptureByAttr::CreateImplicit(Context, CaptureByThis, 1));
296296
}

clang/lib/Sema/SemaChecking.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,8 +3338,8 @@ void Sema::checkLifetimeCaptureBy(FunctionDecl *FD, bool IsMemberFunction,
33383338
if (!FD || Args.empty())
33393339
return;
33403340
auto GetArgAt = [&](int Idx) -> const Expr * {
3341-
if (Idx == LifetimeCaptureByAttr::GLOBAL ||
3342-
Idx == LifetimeCaptureByAttr::UNKNOWN)
3341+
if (Idx == LifetimeCaptureByAttr::Global ||
3342+
Idx == LifetimeCaptureByAttr::Unknown)
33433343
return nullptr;
33443344
if (IsMemberFunction && Idx == 0)
33453345
return ThisArg;
@@ -3354,7 +3354,7 @@ void Sema::checkLifetimeCaptureBy(FunctionDecl *FD, bool IsMemberFunction,
33543354
for (int CapturingParamIdx : Attr->params()) {
33553355
// lifetime_capture_by(this) case is handled in the lifetimebound expr
33563356
// initialization codepath.
3357-
if (CapturingParamIdx == LifetimeCaptureByAttr::THIS &&
3357+
if (CapturingParamIdx == LifetimeCaptureByAttr::This &&
33583358
isa<CXXConstructorDecl>(FD))
33593359
continue;
33603360
Expr *Capturing = const_cast<Expr *>(GetArgAt(CapturingParamIdx));

clang/lib/Sema/SemaDeclAttr.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4290,7 +4290,7 @@ LifetimeCaptureByAttr *Sema::ParseLifetimeCaptureByAttr(const ParsedAttr &AL,
42904290
}
42914291
if (!IsValid)
42924292
return nullptr;
4293-
SmallVector<int> FakeParamIndices(N, LifetimeCaptureByAttr::INVALID);
4293+
SmallVector<int> FakeParamIndices(N, LifetimeCaptureByAttr::Invalid);
42944294
auto *CapturedBy =
42954295
LifetimeCaptureByAttr::Create(Context, FakeParamIndices.data(), N, AL);
42964296
CapturedBy->setArgs(ParamIdents, ParamLocs);
@@ -4333,8 +4333,8 @@ void Sema::LazyProcessLifetimeCaptureByParams(FunctionDecl *FD) {
43334333
if (Attrs.empty())
43344334
return;
43354335
llvm::StringMap<int> NameIdxMapping = {
4336-
{"global", LifetimeCaptureByAttr::GLOBAL},
4337-
{"unknown", LifetimeCaptureByAttr::UNKNOWN}};
4336+
{"global", LifetimeCaptureByAttr::Global},
4337+
{"unknown", LifetimeCaptureByAttr::Unknown}};
43384338
int Idx = 0;
43394339
if (HasImplicitThisParam) {
43404340
NameIdxMapping["this"] = 0;

0 commit comments

Comments
 (0)