Skip to content

Commit e394df3

Browse files
authored
[NFC] Rename members in AutoVarEmission (#161668)
It was brought up by Andy in a different review that AutoVarEmission's member variables didn't follow our naming standard. This patch corrects that and fixes all references.
1 parent 2512611 commit e394df3

File tree

3 files changed

+27
-27
lines changed

3 files changed

+27
-27
lines changed

clang/lib/CIR/CodeGen/CIRGenDecl.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ CIRGenFunction::emitAutoVarAlloca(const VarDecl &d,
3535
getContext().getLangOpts().ElideConstructors && d.isNRVOVariable();
3636

3737
CIRGenFunction::AutoVarEmission emission(d);
38-
emission.IsEscapingByRef = d.isEscapingByref();
39-
if (emission.IsEscapingByRef)
38+
emission.isEscapingByRef = d.isEscapingByref();
39+
if (emission.isEscapingByRef)
4040
cgm.errorNYI(d.getSourceRange(),
4141
"emitAutoVarDecl: decl escaping by reference");
4242

@@ -78,7 +78,7 @@ CIRGenFunction::emitAutoVarAlloca(const VarDecl &d,
7878
alignment);
7979
}
8080

81-
emission.Addr = address;
81+
emission.addr = address;
8282
setAddrOfLocalVar(&d, address);
8383

8484
return emission;
@@ -101,13 +101,13 @@ bool CIRGenFunction::isTrivialInitializer(const Expr *init) {
101101

102102
void CIRGenFunction::emitAutoVarInit(
103103
const CIRGenFunction::AutoVarEmission &emission) {
104-
assert(emission.Variable && "emission was not valid!");
104+
assert(emission.variable && "emission was not valid!");
105105

106106
// If this was emitted as a global constant, we're done.
107107
if (emission.wasEmittedAsGlobal())
108108
return;
109109

110-
const VarDecl &d = *emission.Variable;
110+
const VarDecl &d = *emission.variable;
111111

112112
QualType type = d.getType();
113113

@@ -124,7 +124,7 @@ void CIRGenFunction::emitAutoVarInit(
124124
return;
125125
}
126126

127-
const Address addr = emission.Addr;
127+
const Address addr = emission.addr;
128128

129129
// Check whether this is a byref variable that's potentially
130130
// captured and moved by its own initializer. If so, we'll need to
@@ -153,7 +153,7 @@ void CIRGenFunction::emitAutoVarInit(
153153
}
154154

155155
mlir::Attribute constant;
156-
if (emission.IsConstantAggregate ||
156+
if (emission.isConstantAggregate ||
157157
d.mightBeUsableInConstantExpressions(getContext())) {
158158
// FIXME: Differently from LLVM we try not to emit / lower too much
159159
// here for CIR since we are interested in seeing the ctor in some
@@ -196,7 +196,7 @@ void CIRGenFunction::emitAutoVarInit(
196196
// FIXME(cir): migrate most of this file to use mlir::TypedAttr directly.
197197
auto typedConstant = mlir::dyn_cast<mlir::TypedAttr>(constant);
198198
assert(typedConstant && "expected typed attribute");
199-
if (!emission.IsConstantAggregate) {
199+
if (!emission.isConstantAggregate) {
200200
// For simple scalar/complex initialization, store the value directly.
201201
LValue lv = makeAddrLValue(addr, type);
202202
assert(init && "expected initializer");
@@ -209,7 +209,7 @@ void CIRGenFunction::emitAutoVarInit(
209209

210210
void CIRGenFunction::emitAutoVarCleanups(
211211
const CIRGenFunction::AutoVarEmission &emission) {
212-
const VarDecl &d = *emission.Variable;
212+
const VarDecl &d = *emission.variable;
213213

214214
// Check the type for a cleanup.
215215
if (QualType::DestructionKind dtorKind = d.needsDestruction(getContext()))
@@ -821,7 +821,7 @@ void CIRGenFunction::emitAutoVarTypeCleanup(
821821
// original stack object, not the possibly forwarded object.
822822
Address addr = emission.getObjectAddress(*this);
823823

824-
const VarDecl *var = emission.Variable;
824+
const VarDecl *var = emission.variable;
825825
QualType type = var->getType();
826826

827827
CleanupKind cleanupKind = NormalAndEHCleanup;
@@ -834,7 +834,7 @@ void CIRGenFunction::emitAutoVarTypeCleanup(
834834
case QualType::DK_cxx_destructor:
835835
// If there's an NRVO flag on the emission, we need a different
836836
// cleanup.
837-
if (emission.NRVOFlag) {
837+
if (emission.nrvoFlag) {
838838
cgm.errorNYI(var->getSourceRange(), "emitAutoVarTypeCleanup: NRVO");
839839
return;
840840
}

clang/lib/CIR/CodeGen/CIRGenFunction.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -479,55 +479,55 @@ class CIRGenFunction : public CIRGenTypeCache {
479479
ConstantEmission tryEmitAsConstant(const MemberExpr *me);
480480

481481
struct AutoVarEmission {
482-
const clang::VarDecl *Variable;
482+
const clang::VarDecl *variable;
483483
/// The address of the alloca for languages with explicit address space
484484
/// (e.g. OpenCL) or alloca casted to generic pointer for address space
485485
/// agnostic languages (e.g. C++). Invalid if the variable was emitted
486486
/// as a global constant.
487-
Address Addr;
487+
Address addr;
488488

489489
/// True if the variable is of aggregate type and has a constant
490490
/// initializer.
491-
bool IsConstantAggregate = false;
491+
bool isConstantAggregate = false;
492492

493493
/// True if the variable is a __block variable that is captured by an
494494
/// escaping block.
495-
bool IsEscapingByRef = false;
495+
bool isEscapingByRef = false;
496496

497497
/// True if the variable was emitted as an offload recipe, and thus doesn't
498498
/// have the same sort of alloca initialization.
499-
bool EmittedAsOffload = false;
499+
bool emittedAsOffload = false;
500500

501-
mlir::Value NRVOFlag{};
501+
mlir::Value nrvoFlag{};
502502

503503
struct Invalid {};
504-
AutoVarEmission(Invalid) : Variable(nullptr), Addr(Address::invalid()) {}
504+
AutoVarEmission(Invalid) : variable(nullptr), addr(Address::invalid()) {}
505505

506506
AutoVarEmission(const clang::VarDecl &variable)
507-
: Variable(&variable), Addr(Address::invalid()) {}
507+
: variable(&variable), addr(Address::invalid()) {}
508508

509509
static AutoVarEmission invalid() { return AutoVarEmission(Invalid()); }
510510

511-
bool wasEmittedAsGlobal() const { return !Addr.isValid(); }
511+
bool wasEmittedAsGlobal() const { return !addr.isValid(); }
512512

513-
bool wasEmittedAsOffloadClause() const { return EmittedAsOffload; }
513+
bool wasEmittedAsOffloadClause() const { return emittedAsOffload; }
514514

515515
/// Returns the raw, allocated address, which is not necessarily
516516
/// the address of the object itself. It is casted to default
517517
/// address space for address space agnostic languages.
518-
Address getAllocatedAddress() const { return Addr; }
518+
Address getAllocatedAddress() const { return addr; }
519519

520520
// Changes the stored address for the emission. This function should only
521521
// be used in extreme cases, and isn't required to model normal AST
522522
// initialization/variables.
523-
void setAllocatedAddress(Address A) { Addr = A; }
523+
void setAllocatedAddress(Address a) { addr = a; }
524524

525525
/// Returns the address of the object within this declaration.
526526
/// Note that this does not chase the forwarding pointer for
527527
/// __block decls.
528528
Address getObjectAddress(CIRGenFunction &cgf) const {
529-
if (!IsEscapingByRef)
530-
return Addr;
529+
if (!isEscapingByRef)
530+
return addr;
531531

532532
assert(!cir::MissingFeatures::opAllocaEscapeByReference());
533533
return Address::invalid();

clang/lib/CIR/CodeGen/CIRGenOpenACCRecipe.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ void OpenACCRecipeBuilderBase::makeBoundsInit(
408408
CIRGenFunction::LexicalScope ls(cgf, loc, block);
409409

410410
CIRGenFunction::AutoVarEmission tempDeclEmission{*allocaDecl};
411-
tempDeclEmission.EmittedAsOffload = true;
411+
tempDeclEmission.emittedAsOffload = true;
412412

413413
// The init section is the only one of the handful that only has a single
414414
// argument for the 'type', so we have to drop 1 for init, and future calls
@@ -504,7 +504,7 @@ void OpenACCRecipeBuilderBase::createFirstprivateRecipeCopy(
504504
// that instead of the variable in the other block.
505505
tempDeclEmission.setAllocatedAddress(
506506
Address{toArg, elementTy, cgf.getContext().getDeclAlign(varRecipe)});
507-
tempDeclEmission.EmittedAsOffload = true;
507+
tempDeclEmission.emittedAsOffload = true;
508508

509509
CIRGenFunction::DeclMapRevertingRAII declMapRAII{cgf, temporary};
510510
cgf.setAddrOfLocalVar(

0 commit comments

Comments
 (0)