Skip to content

Commit 267e32d

Browse files
Merge pull request #32118 from AnthonyLatsis/post-increment-cleanup
[NFC] Pre- increment and decrement where possible
2 parents 09a5c7d + 9fd1aa5 commit 267e32d

File tree

162 files changed

+398
-397
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+398
-397
lines changed

include/swift/Remote/Failure.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ class Failure {
255255
result.append(text, next - text);
256256

257257
// Skip the '%'.
258-
next++;
258+
++next;
259259

260260
// Do something based on the character after '%'.
261261
char c = *next++;

include/swift/Runtime/Concurrent.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ template <class ElemTy> struct ConcurrentReadableArray {
434434
}
435435

436436
void deallocate() {
437-
for (size_t i = 0; i < Count; i++) {
437+
for (size_t i = 0; i < Count; ++i) {
438438
data()[i].~ElemTy();
439439
}
440440
free(this);

include/swift/SwiftRemoteMirror/SwiftRemoteMirrorLegacyInterop.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ swift_reflection_interop_loadFunctions(struct SwiftReflectionInteropContext *Con
486486
LOAD(dumpInfoForTypeRef);
487487

488488
Library->IsLegacy = IsLegacy;
489-
Context->LibraryCount++;
489+
++Context->LibraryCount;
490490

491491
return 1;
492492

lib/AST/ASTContext.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3846,7 +3846,7 @@ void SubstitutionMap::Storage::Profile(
38463846
id.AddPointer(replacementTypes[i].getPointer());
38473847
else
38483848
id.AddPointer(nullptr);
3849-
i++;
3849+
++i;
38503850
});
38513851

38523852
// Conformances.

lib/AST/ASTDemangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ Type ASTBuilder::createBoundGenericType(GenericTypeDecl *decl,
304304
auto *aliasDecl = cast<TypeAliasDecl>(decl);
305305

306306
auto genericSig = aliasDecl->getGenericSignature();
307-
for (unsigned i = 0, e = args.size(); i < e; i++) {
307+
for (unsigned i = 0, e = args.size(); i < e; ++i) {
308308
auto origTy = genericSig->getInnermostGenericParams()[i];
309309
auto substTy = args[i];
310310

lib/AST/ASTPrinter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1436,7 +1436,7 @@ void PrintAST::printGenericSignature(
14361436
// Move index to genericParams.
14371437
unsigned lastParamIdx = paramIdx;
14381438
do {
1439-
lastParamIdx++;
1439+
++lastParamIdx;
14401440
} while (lastParamIdx < numParam &&
14411441
genericParams[lastParamIdx]->getDepth() == depth);
14421442

lib/AST/ASTVerifier.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,7 +1692,7 @@ class Verifier : public ASTWalker {
16921692
// Look through optional evaluations.
16931693
if (auto *optionalEval = dyn_cast<OptionalEvaluationExpr>(subExpr)) {
16941694
subExpr = optionalEval->getSubExpr();
1695-
optionalDepth++;
1695+
++optionalDepth;
16961696
continue;
16971697
}
16981698

@@ -3165,7 +3165,7 @@ class Verifier : public ASTWalker {
31653165
unsigned NumDestructors = 0;
31663166
for (auto Member : CD->getMembers()) {
31673167
if (isa<DestructorDecl>(Member)) {
3168-
NumDestructors++;
3168+
++NumDestructors;
31693169
}
31703170
}
31713171
if (NumDestructors > 1) {

lib/AST/Builtins.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ getBuiltinGenericFunction(Identifier Id,
195195
DeclContext *DC = &M->getMainFile(FileUnitKind::Builtin);
196196

197197
SmallVector<ParamDecl*, 4> params;
198-
for (unsigned i = 0, e = ArgParamTypes.size(); i < e; i++) {
198+
for (unsigned i = 0, e = ArgParamTypes.size(); i < e; ++i) {
199199
auto paramIfaceType = ArgParamTypes[i].getPlainType();
200200
auto specifier =
201201
ParamDecl::getParameterSpecifierForValueOwnership(
@@ -2004,11 +2004,11 @@ ValueDecl *swift::getBuiltinValueDecl(ASTContext &Context, Identifier Id) {
20042004

20052005
// Accept weak, volatile, and singlethread if present.
20062006
if (NextPart != Parts.end() && *NextPart == "weak")
2007-
NextPart++;
2007+
++NextPart;
20082008
if (NextPart != Parts.end() && *NextPart == "volatile")
2009-
NextPart++;
2009+
++NextPart;
20102010
if (NextPart != Parts.end() && *NextPart == "singlethread")
2011-
NextPart++;
2011+
++NextPart;
20122012
// Nothing else is allowed in the name.
20132013
if (NextPart != Parts.end())
20142014
return nullptr;

lib/AST/ClangTypeConverter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ clang::QualType ClangTypeConverter::visitTupleType(TupleType *type) {
359359
return ClangASTContext.VoidTy;
360360

361361
Type eltTy = type->getElementType(0);
362-
for (unsigned i = 1; i < tupleNumElements; i++) {
362+
for (unsigned i = 1; i < tupleNumElements; ++i) {
363363
if (!eltTy->isEqual(type->getElementType(i)))
364364
// Only tuples where all element types are equal map to fixed-size
365365
// arrays.

lib/AST/Decl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5036,7 +5036,7 @@ ProtocolDecl::setLazyRequirementSignature(LazyMemberLoader *lazyLoader,
50365036
++NumLazyRequirementSignatures;
50375037
// FIXME: (transitional) increment the redundant "always-on" counter.
50385038
if (auto *Stats = getASTContext().Stats)
5039-
Stats->getFrontendCounters().NumLazyRequirementSignatures++;
5039+
++Stats->getFrontendCounters().NumLazyRequirementSignatures;
50405040
}
50415041

50425042
ArrayRef<Requirement> ProtocolDecl::getCachedRequirementSignature() const {
@@ -5196,7 +5196,7 @@ AbstractStorageDecl::AccessorRecord::create(ASTContext &ctx,
51965196
case AccessorKind::ID: \
51975197
if (!has##ID) { \
51985198
has##ID = true; \
5199-
numMissingOpaque--; \
5199+
--numMissingOpaque; \
52005200
} \
52015201
continue;
52025202
#include "swift/AST/AccessorKinds.def"

0 commit comments

Comments
 (0)