Skip to content

Commit d0021ea

Browse files
committed
Fix coding style violations
1 parent 51c21ae commit d0021ea

File tree

12 files changed

+167
-167
lines changed

12 files changed

+167
-167
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3468,8 +3468,8 @@ class Sema final : public SemaBase {
34683468
PADAK_ExtraDiscPtrAuth,
34693469
};
34703470

3471-
bool checkPointerAuthDiscriminatorArg(Expr *arg, PointerAuthDiscArgKind kind,
3472-
unsigned &intVal);
3471+
bool checkPointerAuthDiscriminatorArg(Expr *Arg, PointerAuthDiscArgKind Kind,
3472+
unsigned &IntVal);
34733473

34743474
/// Diagnose function specifiers on a declaration of an identifier that
34753475
/// does not identify a function.

clang/lib/AST/ItaniumMangle.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2823,21 +2823,21 @@ void CXXNameMangler::mangleQualifiers(Qualifiers Quals, const DependentAddressSp
28232823
mangleVendorQualifier("__unaligned");
28242824

28252825
// __ptrauth. Note that this is parameterized.
2826-
if (auto ptrauth = Quals.getPointerAuth()) {
2826+
if (auto PtrAuth = Quals.getPointerAuth()) {
28272827
mangleVendorQualifier("__ptrauth");
28282828
// For now, since we only allow non-dependent arguments, we can just
28292829
// inline the mangling of those arguments as literals. We treat the
28302830
// key and extra-discriminator arguments as 'unsigned int' and the
28312831
// address-discriminated argument as 'bool'.
28322832
Out << "I"
28332833
"Lj"
2834-
<< ptrauth.getKey()
2834+
<< PtrAuth.getKey()
28352835
<< "E"
28362836
"Lb"
2837-
<< unsigned(ptrauth.isAddressDiscriminated())
2837+
<< unsigned(PtrAuth.isAddressDiscriminated())
28382838
<< "E"
28392839
"Lj"
2840-
<< ptrauth.getExtraDiscriminator()
2840+
<< PtrAuth.getExtraDiscriminator()
28412841
<< "E"
28422842
"E";
28432843
}

clang/lib/AST/TypePrinter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2470,8 +2470,8 @@ bool Qualifiers::isEmptyWhenPrinted(const PrintingPolicy &Policy) const {
24702470
if (!(lifetime == Qualifiers::OCL_Strong && Policy.SuppressStrongLifetime))
24712471
return false;
24722472

2473-
if (auto pointerAuth = getPointerAuth())
2474-
if (!pointerAuth.isEmptyWhenPrinted(Policy))
2473+
if (auto PointerAuth = getPointerAuth())
2474+
if (!PointerAuth.isEmptyWhenPrinted(Policy))
24752475
return false;
24762476

24772477
return true;
@@ -2580,12 +2580,12 @@ void Qualifiers::print(raw_ostream &OS, const PrintingPolicy& Policy,
25802580
}
25812581
}
25822582

2583-
if (auto pointerAuth = getPointerAuth()) {
2583+
if (auto PointerAuth = getPointerAuth()) {
25842584
if (addSpace)
25852585
OS << ' ';
25862586
addSpace = true;
25872587

2588-
pointerAuth.print(OS, Policy);
2588+
PointerAuth.print(OS, Policy);
25892589
}
25902590

25912591
if (appendSpaceIfNonEmpty && addSpace)

clang/lib/CodeGen/CGDecl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -795,17 +795,17 @@ void CodeGenFunction::EmitScalarInit(const Expr *init, const ValueDecl *D,
795795
LValue lvalue, bool capturedByInit) {
796796
Qualifiers::ObjCLifetime lifetime = lvalue.getObjCLifetime();
797797
if (!lifetime) {
798-
llvm::Value *value;
799-
if (auto ptrauth = lvalue.getQuals().getPointerAuth()) {
800-
value = EmitPointerAuthQualify(ptrauth, init, lvalue.getAddress());
798+
llvm::Value *Value;
799+
if (auto PtrAuth = lvalue.getQuals().getPointerAuth()) {
800+
Value = EmitPointerAuthQualify(PtrAuth, init, lvalue.getAddress());
801801
lvalue.getQuals().removePointerAuth();
802802
} else {
803-
value = EmitScalarExpr(init);
803+
Value = EmitScalarExpr(init);
804804
}
805805
if (capturedByInit)
806806
drillIntoBlockVariable(*this, lvalue, cast<VarDecl>(D));
807-
EmitNullabilityCheck(lvalue, value, init->getExprLoc());
808-
EmitStoreThroughLValue(RValue::get(value), lvalue, true);
807+
EmitNullabilityCheck(lvalue, Value, init->getExprLoc());
808+
EmitStoreThroughLValue(RValue::get(Value), lvalue, true);
809809
return;
810810
}
811811

clang/lib/CodeGen/CGExpr.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2191,10 +2191,10 @@ RValue CodeGenFunction::EmitLoadOfAnyValue(LValue LV, AggValueSlot Slot,
21912191
/// returning the rvalue.
21922192
RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, SourceLocation Loc) {
21932193
// Load from __ptrauth.
2194-
if (auto ptrauth = LV.getQuals().getPointerAuth()) {
2194+
if (auto PtrAuth = LV.getQuals().getPointerAuth()) {
21952195
LV.getQuals().removePointerAuth();
21962196
auto value = EmitLoadOfLValue(LV, Loc).getScalarVal();
2197-
return RValue::get(EmitPointerAuthUnqualify(ptrauth, value, LV.getType(),
2197+
return RValue::get(EmitPointerAuthUnqualify(PtrAuth, value, LV.getType(),
21982198
LV.getAddress(),
21992199
/*known nonnull*/ false));
22002200
}
@@ -2427,8 +2427,8 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
24272427
}
24282428

24292429
// Handle __ptrauth qualification by re-signing the value.
2430-
if (auto pointerAuth = Dst.getQuals().getPointerAuth()) {
2431-
Src = RValue::get(EmitPointerAuthQualify(pointerAuth, Src.getScalarVal(),
2430+
if (auto PointerAuth = Dst.getQuals().getPointerAuth()) {
2431+
Src = RValue::get(EmitPointerAuthQualify(PointerAuth, Src.getScalarVal(),
24322432
Dst.getType(), Dst.getAddress(),
24332433
/*known nonnull*/ false));
24342434
}
@@ -5574,21 +5574,21 @@ CGCallee CodeGenFunction::EmitCallee(const Expr *E) {
55745574
// Try to remember the original __ptrauth qualifier for loads of
55755575
// function pointers.
55765576
if (ICE->getCastKind() == CK_LValueToRValue) {
5577-
auto subExpr = ICE->getSubExpr();
5578-
if (auto ptrType = subExpr->getType()->getAs<PointerType>()) {
5579-
auto result = EmitOrigPointerRValue(E);
5577+
auto *SubExpr = ICE->getSubExpr();
5578+
if (auto *PtrType = SubExpr->getType()->getAs<PointerType>()) {
5579+
auto Result = EmitOrigPointerRValue(E);
55805580

5581-
QualType functionType = ptrType->getPointeeType();
5582-
assert(functionType->isFunctionType());
5581+
QualType FunctionType = PtrType->getPointeeType();
5582+
assert(FunctionType->isFunctionType());
55835583

55845584
GlobalDecl GD;
55855585
if (const auto *VD =
55865586
dyn_cast_or_null<VarDecl>(E->getReferencedDeclOfCallee())) {
55875587
GD = GlobalDecl(VD);
55885588
}
5589-
CGCalleeInfo calleeInfo(functionType->getAs<FunctionProtoType>(), GD);
5590-
CGCallee callee(calleeInfo, result.first, result.second);
5591-
return callee;
5589+
CGCalleeInfo CalleeInfo(FunctionType->getAs<FunctionProtoType>(), GD);
5590+
CGCallee Callee(CalleeInfo, Result.first, Result.second);
5591+
return Callee;
55925592
}
55935593
}
55945594

@@ -5654,12 +5654,12 @@ LValue CodeGenFunction::EmitBinaryOperatorLValue(const BinaryOperator *E) {
56545654

56555655
switch (getEvaluationKind(E->getType())) {
56565656
case TEK_Scalar: {
5657-
if (auto ptrauth = E->getLHS()->getType().getPointerAuth()) {
5657+
if (auto PtrAuth = E->getLHS()->getType().getPointerAuth()) {
56585658
LValue LV = EmitCheckedLValue(E->getLHS(), TCK_Store);
56595659
LValue CopiedLV = LV;
56605660
CopiedLV.getQuals().removePointerAuth();
56615661
llvm::Value *RV =
5662-
EmitPointerAuthQualify(ptrauth, E->getRHS(), CopiedLV.getAddress());
5662+
EmitPointerAuthQualify(PtrAuth, E->getRHS(), CopiedLV.getAddress());
56635663
EmitNullabilityCheck(CopiedLV, RV, E->getExprLoc());
56645664
EmitStoreThroughLValue(RValue::get(RV), CopiedLV);
56655665
return LV;

clang/lib/CodeGen/CGExprConstant.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,9 +2068,9 @@ llvm::Constant *ConstantLValueEmitter::tryEmit() {
20682068
}
20692069

20702070
// Apply pointer-auth signing from the destination type.
2071-
if (auto pointerAuth = DestType.getPointerAuth()) {
2071+
if (auto PointerAuth = DestType.getPointerAuth()) {
20722072
if (!result.HasDestPointerAuth) {
2073-
value = Emitter.tryEmitConstantSignedPointer(value, pointerAuth);
2073+
value = Emitter.tryEmitConstantSignedPointer(value, PointerAuth);
20742074
if (!value)
20752075
return nullptr;
20762076
}
@@ -2119,9 +2119,9 @@ ConstantLValueEmitter::tryEmitBase(const APValue::LValueBase &base) {
21192119
return CGM.GetWeakRefReference(D).getPointer();
21202120

21212121
auto PtrAuthSign = [&](llvm::Constant *C) {
2122-
if (auto pointerAuth = DestType.getPointerAuth()) {
2122+
if (auto PointerAuth = DestType.getPointerAuth()) {
21232123
C = applyOffset(C);
2124-
C = Emitter.tryEmitConstantSignedPointer(C, pointerAuth);
2124+
C = Emitter.tryEmitConstantSignedPointer(C, PointerAuth);
21252125
return ConstantLValue(C, /*applied offset*/ true, /*signed*/ true);
21262126
}
21272127

clang/lib/CodeGen/CGExprScalar.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,15 +2203,15 @@ static bool isDeclRefKnownNonNull(CodeGenFunction &CGF, const ValueDecl *D) {
22032203
static bool isLValueKnownNonNull(CodeGenFunction &CGF, const Expr *E) {
22042204
E = E->IgnoreParens();
22052205

2206-
if (auto UO = dyn_cast<UnaryOperator>(E)) {
2206+
if (auto *UO = dyn_cast<UnaryOperator>(E)) {
22072207
if (UO->getOpcode() == UO_Deref) {
22082208
return CGF.isPointerKnownNonNull(UO->getSubExpr());
22092209
}
22102210
}
22112211

2212-
if (auto DRE = dyn_cast<DeclRefExpr>(E)) {
2212+
if (auto *DRE = dyn_cast<DeclRefExpr>(E)) {
22132213
return isDeclRefKnownNonNull(CGF, DRE->getDecl());
2214-
} else if (auto ME = dyn_cast<MemberExpr>(E)) {
2214+
} else if (auto *ME = dyn_cast<MemberExpr>(E)) {
22152215
if (isa<FieldDecl>(ME->getMemberDecl()))
22162216
return true;
22172217
return isDeclRefKnownNonNull(CGF, ME->getMemberDecl());
@@ -2230,13 +2230,13 @@ bool CodeGenFunction::isPointerKnownNonNull(const Expr *E) {
22302230
if (isa<CXXThisExpr>(E))
22312231
return true;
22322232

2233-
if (auto UO = dyn_cast<UnaryOperator>(E)) {
2233+
if (auto *UO = dyn_cast<UnaryOperator>(E)) {
22342234
if (UO->getOpcode() == UO_AddrOf) {
22352235
return isLValueKnownNonNull(*this, UO->getSubExpr());
22362236
}
22372237
}
22382238

2239-
if (auto CE = dyn_cast<CastExpr>(E)) {
2239+
if (auto *CE = dyn_cast<CastExpr>(E)) {
22402240
if (CE->getCastKind() == CK_FunctionToPointerDecay ||
22412241
CE->getCastKind() == CK_ArrayToPointerDecay) {
22422242
return isLValueKnownNonNull(*this, CE->getSubExpr());
@@ -4850,17 +4850,17 @@ Value *ScalarExprEmitter::VisitBinAssign(const BinaryOperator *E) {
48504850
Value *RHS;
48514851
LValue LHS;
48524852

4853-
if (auto ptrauth = E->getLHS()->getType().getPointerAuth()) {
4853+
if (auto PtrAuth = E->getLHS()->getType().getPointerAuth()) {
48544854
LValue LV = CGF.EmitCheckedLValue(E->getLHS(), CodeGenFunction::TCK_Store);
48554855
LV.getQuals().removePointerAuth();
48564856
llvm::Value *RV =
4857-
CGF.EmitPointerAuthQualify(ptrauth, E->getRHS(), LV.getAddress());
4857+
CGF.EmitPointerAuthQualify(PtrAuth, E->getRHS(), LV.getAddress());
48584858
CGF.EmitNullabilityCheck(LV, RV, E->getExprLoc());
48594859
CGF.EmitStoreThroughLValue(RValue::get(RV), LV);
48604860

48614861
if (Ignore)
48624862
return nullptr;
4863-
RV = CGF.EmitPointerAuthUnqualify(ptrauth, RV, LV.getType(),
4863+
RV = CGF.EmitPointerAuthUnqualify(PtrAuth, RV, LV.getType(),
48644864
LV.getAddress(), /*nonnull*/ false);
48654865
return RV;
48664866
}

clang/lib/CodeGen/CGPointerAuth.cpp

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -194,99 +194,99 @@ CGPointerAuthInfo CodeGenModule::getPointerAuthInfoForType(QualType T) {
194194
}
195195

196196
static std::pair<llvm::Value *, CGPointerAuthInfo>
197-
emitLoadOfOrigPointerRValue(CodeGenFunction &CGF, const LValue &lv,
198-
SourceLocation loc) {
199-
auto value = CGF.EmitLoadOfScalar(lv, loc);
200-
CGPointerAuthInfo authInfo;
201-
if (auto ptrauth = lv.getQuals().getPointerAuth()) {
202-
authInfo = CGF.EmitPointerAuthInfo(ptrauth, lv.getAddress());
197+
emitLoadOfOrigPointerRValue(CodeGenFunction &CGF, const LValue &LV,
198+
SourceLocation Loc) {
199+
auto *Value = CGF.EmitLoadOfScalar(LV, Loc);
200+
CGPointerAuthInfo AuthInfo;
201+
if (auto PtrAuth = LV.getQuals().getPointerAuth()) {
202+
AuthInfo = CGF.EmitPointerAuthInfo(PtrAuth, LV.getAddress());
203203
} else {
204-
authInfo = getPointerAuthInfoForType(CGF.CGM, lv.getType());
204+
AuthInfo = getPointerAuthInfoForType(CGF.CGM, LV.getType());
205205
}
206-
return {value, authInfo};
206+
return {Value, AuthInfo};
207207
}
208208

209209
std::pair<llvm::Value *, CGPointerAuthInfo>
210210
CodeGenFunction::EmitOrigPointerRValue(const Expr *E) {
211211
assert(E->getType()->isSignableType());
212212

213213
E = E->IgnoreParens();
214-
if (auto load = dyn_cast<ImplicitCastExpr>(E)) {
215-
if (load->getCastKind() == CK_LValueToRValue) {
216-
E = load->getSubExpr()->IgnoreParens();
214+
if (auto *Load = dyn_cast<ImplicitCastExpr>(E)) {
215+
if (Load->getCastKind() == CK_LValueToRValue) {
216+
E = Load->getSubExpr()->IgnoreParens();
217217

218218
// We're semantically required to not emit loads of certain DREs naively.
219-
if (auto refExpr = dyn_cast<DeclRefExpr>(const_cast<Expr *>(E))) {
220-
if (auto result = tryEmitAsConstant(refExpr)) {
219+
if (auto *RefExpr = dyn_cast<DeclRefExpr>(const_cast<Expr *>(E))) {
220+
if (auto Result = tryEmitAsConstant(RefExpr)) {
221221
// Fold away a use of an intermediate variable.
222-
if (!result.isReference())
223-
return {result.getValue(),
224-
getPointerAuthInfoForType(CGM, refExpr->getType())};
222+
if (!Result.isReference())
223+
return {Result.getValue(),
224+
getPointerAuthInfoForType(CGM, RefExpr->getType())};
225225

226226
// Fold away a use of an intermediate reference.
227-
auto lv = result.getReferenceLValue(*this, refExpr);
228-
return emitLoadOfOrigPointerRValue(*this, lv, refExpr->getLocation());
227+
auto LV = Result.getReferenceLValue(*this, RefExpr);
228+
return emitLoadOfOrigPointerRValue(*this, LV, RefExpr->getLocation());
229229
}
230230
}
231231

232232
// Otherwise, load and use the pointer
233-
auto lv = EmitCheckedLValue(E, CodeGenFunction::TCK_Load);
234-
return emitLoadOfOrigPointerRValue(*this, lv, E->getExprLoc());
233+
auto LV = EmitCheckedLValue(E, CodeGenFunction::TCK_Load);
234+
return emitLoadOfOrigPointerRValue(*this, LV, E->getExprLoc());
235235
}
236236
}
237237

238238
// Emit direct references to functions without authentication.
239-
if (auto DRE = dyn_cast<DeclRefExpr>(E)) {
240-
if (auto FD = dyn_cast<FunctionDecl>(DRE->getDecl())) {
239+
if (auto *DRE = dyn_cast<DeclRefExpr>(E)) {
240+
if (auto *FD = dyn_cast<FunctionDecl>(DRE->getDecl())) {
241241
return {CGM.getRawFunctionPointer(FD), CGPointerAuthInfo()};
242242
}
243-
} else if (auto ME = dyn_cast<MemberExpr>(E)) {
244-
if (auto FD = dyn_cast<FunctionDecl>(ME->getMemberDecl())) {
243+
} else if (auto *ME = dyn_cast<MemberExpr>(E)) {
244+
if (auto *FD = dyn_cast<FunctionDecl>(ME->getMemberDecl())) {
245245
EmitIgnoredExpr(ME->getBase());
246246
return {CGM.getRawFunctionPointer(FD), CGPointerAuthInfo()};
247247
}
248248
}
249249

250250
// Fallback: just use the normal rules for the type.
251-
auto value = EmitScalarExpr(E);
252-
return {value, getPointerAuthInfoForType(CGM, E->getType())};
251+
auto *Value = EmitScalarExpr(E);
252+
return {Value, getPointerAuthInfoForType(CGM, E->getType())};
253253
}
254254

255255
llvm::Value *
256-
CodeGenFunction::EmitPointerAuthQualify(PointerAuthQualifier destQualifier,
256+
CodeGenFunction::EmitPointerAuthQualify(PointerAuthQualifier DestQualifier,
257257
const Expr *E,
258-
Address destStorageAddress) {
259-
assert(destQualifier);
258+
Address DestStorageAddress) {
259+
assert(DestQualifier);
260260

261-
auto src = EmitOrigPointerRValue(E);
262-
auto value = src.first;
263-
auto curAuthInfo = src.second;
261+
auto Src = EmitOrigPointerRValue(E);
262+
auto *Value = Src.first;
263+
auto CurAuthInfo = Src.second;
264264

265-
auto destAuthInfo = EmitPointerAuthInfo(destQualifier, destStorageAddress);
266-
return emitPointerAuthResign(value, E->getType(), curAuthInfo, destAuthInfo,
265+
auto DestAuthInfo = EmitPointerAuthInfo(DestQualifier, DestStorageAddress);
266+
return emitPointerAuthResign(Value, E->getType(), CurAuthInfo, DestAuthInfo,
267267
isPointerKnownNonNull(E));
268268
}
269269

270270
llvm::Value *CodeGenFunction::EmitPointerAuthQualify(
271-
PointerAuthQualifier destQualifier, llvm::Value *value,
272-
QualType pointerType, Address destStorageAddress, bool isKnownNonNull) {
273-
assert(destQualifier);
271+
PointerAuthQualifier DestQualifier, llvm::Value *Value,
272+
QualType PointerType, Address DestStorageAddress, bool IsKnownNonNull) {
273+
assert(DestQualifier);
274274

275-
auto curAuthInfo = getPointerAuthInfoForType(CGM, pointerType);
276-
auto destAuthInfo = EmitPointerAuthInfo(destQualifier, destStorageAddress);
277-
return emitPointerAuthResign(value, pointerType, curAuthInfo, destAuthInfo,
278-
isKnownNonNull);
275+
auto CurAuthInfo = getPointerAuthInfoForType(CGM, PointerType);
276+
auto DestAuthInfo = EmitPointerAuthInfo(DestQualifier, DestStorageAddress);
277+
return emitPointerAuthResign(Value, PointerType, CurAuthInfo, DestAuthInfo,
278+
IsKnownNonNull);
279279
}
280280

281281
llvm::Value *CodeGenFunction::EmitPointerAuthUnqualify(
282-
PointerAuthQualifier curQualifier, llvm::Value *value, QualType pointerType,
283-
Address curStorageAddress, bool isKnownNonNull) {
284-
assert(curQualifier);
285-
286-
auto curAuthInfo = EmitPointerAuthInfo(curQualifier, curStorageAddress);
287-
auto destAuthInfo = getPointerAuthInfoForType(CGM, pointerType);
288-
return emitPointerAuthResign(value, pointerType, curAuthInfo, destAuthInfo,
289-
isKnownNonNull);
282+
PointerAuthQualifier CurQualifier, llvm::Value *Value, QualType PointerType,
283+
Address CurStorageAddress, bool IsKnownNonNull) {
284+
assert(CurQualifier);
285+
286+
auto CurAuthInfo = EmitPointerAuthInfo(CurQualifier, CurStorageAddress);
287+
auto DestAuthInfo = getPointerAuthInfoForType(CGM, PointerType);
288+
return emitPointerAuthResign(Value, PointerType, CurAuthInfo, DestAuthInfo,
289+
IsKnownNonNull);
290290
}
291291

292292
static bool isZeroConstant(const llvm::Value *Value) {

0 commit comments

Comments
 (0)