Skip to content

Commit 3200074

Browse files
authored
Merge pull request #5938 from gottesmm/small_nfc_gardening
2 parents 8135e72 + f9fefa4 commit 3200074

File tree

3 files changed

+30
-18
lines changed

3 files changed

+30
-18
lines changed

include/swift/SIL/SILBasicBlock.h

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public llvm::ilist_node<SILBasicBlock>, public SILAllocated<SILBasicBlock> {
124124
}
125125

126126
const TermInst *getTerminator() const {
127-
return const_cast<SILBasicBlock*>(this)->getTerminator();
127+
return const_cast<SILBasicBlock *>(this)->getTerminator();
128128
}
129129

130130
/// \brief Splits a basic block into two at the specified instruction.
@@ -135,7 +135,9 @@ public llvm::ilist_node<SILBasicBlock>, public SILAllocated<SILBasicBlock> {
135135
SILBasicBlock *split(iterator I);
136136

137137
/// \brief Move the basic block to after the specified basic block in the IR.
138-
/// The basic blocks must reside in the same function.
138+
///
139+
/// Assumes that the basic blocks must reside in the same function. In asserts
140+
/// builds, an assert verifies that this is true.
139141
void moveAfter(SILBasicBlock *After);
140142

141143
//===--------------------------------------------------------------------===//
@@ -216,9 +218,7 @@ public llvm::ilist_node<SILBasicBlock>, public SILAllocated<SILBasicBlock> {
216218
}
217219

218220
const SILBasicBlock *getSingleSuccessor() const {
219-
if (succ_empty() || std::next(succ_begin()) != succ_end())
220-
return nullptr;
221-
return *succ_begin();
221+
return const_cast<SILBasicBlock *>(this)->getSingleSuccessor();
222222
}
223223

224224
/// \brief Returns true if \p BB is a successor of this block.
@@ -273,7 +273,7 @@ public llvm::ilist_node<SILBasicBlock>, public SILAllocated<SILBasicBlock> {
273273
}
274274

275275
const SILBasicBlock *getSinglePredecessor() const {
276-
return const_cast<SILBasicBlock*>(this)->getSinglePredecessor();
276+
return const_cast<SILBasicBlock *>(this)->getSinglePredecessor();
277277
}
278278

279279
/// Pretty-print the SILBasicBlock.
@@ -319,8 +319,8 @@ namespace llvm {
319319
//===----------------------------------------------------------------------===//
320320

321321
template <>
322-
struct ilist_traits<::swift::SILBasicBlock> :
323-
public ilist_default_traits<::swift::SILBasicBlock> {
322+
struct ilist_traits<::swift::SILBasicBlock>
323+
: ilist_default_traits<::swift::SILBasicBlock> {
324324
using SelfTy = ilist_traits<::swift::SILBasicBlock>;
325325
using SILBasicBlock = ::swift::SILBasicBlock;
326326
using SILFunction = ::swift::SILFunction;
@@ -333,19 +333,17 @@ public ilist_default_traits<::swift::SILBasicBlock> {
333333
SILFunction *Parent;
334334

335335
public:
336-
337336
SILBasicBlock *createSentinel() const {
338-
return static_cast<SILBasicBlock*>(&Sentinel);
337+
return static_cast<SILBasicBlock *>(&Sentinel);
339338
}
340339
void destroySentinel(SILBasicBlock *) const {}
341340

342341
SILBasicBlock *provideInitialHead() const { return createSentinel(); }
343-
SILBasicBlock *ensureHead(SILBasicBlock*) const { return createSentinel(); }
344-
static void noteHead(SILBasicBlock*, SILBasicBlock*) {}
342+
SILBasicBlock *ensureHead(SILBasicBlock *) const { return createSentinel(); }
343+
static void noteHead(SILBasicBlock *, SILBasicBlock *) {}
345344
static void deleteNode(SILBasicBlock *BB) { BB->~SILBasicBlock(); }
346345

347-
void addNodeToList(SILBasicBlock *BB) {
348-
}
346+
void addNodeToList(SILBasicBlock *BB) {}
349347

350348
void transferNodesFromList(ilist_traits<SILBasicBlock> &SrcTraits,
351349
ilist_iterator<SILBasicBlock> First,

include/swift/SIL/SILDebugScope.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@
99
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
1010
//
1111
//===----------------------------------------------------------------------===//
12-
//
13-
// This file defines a container for scope information used to
14-
// generate debug info.
15-
//
12+
///
13+
/// \file
14+
///
15+
/// This file defines a container for scope information used to
16+
/// generate debug info.
17+
///
1618
//===----------------------------------------------------------------------===//
1719

1820
#ifndef SWIFT_SIL_DEBUGSCOPE_H

lib/SILOptimizer/Utils/CheckedCastBrJumpThreading.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
//===--- CheckedCastBrJumpThreading.cpp -----------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See http://swift.org/LICENSE.txt for license information
9+
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
113
#define DEBUG_TYPE "sil-simplify-cfg"
214
#include "llvm/ADT/SmallPtrSet.h"
315
#include "llvm/ADT/SmallVector.h"

0 commit comments

Comments
 (0)