Skip to content

Commit b59f5c7

Browse files
authored
Merge pull request #67683 from allevato/c++20-tweaks
[Code Health] Improve eventual C++20 support.
2 parents 281207f + 52e216e commit b59f5c7

File tree

6 files changed

+36
-25
lines changed

6 files changed

+36
-25
lines changed

include/swift/Driver/Compilation.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ class Compilation {
8989
/// This data is used for cross-module module dependencies.
9090
fine_grained_dependencies::ModuleDepGraph depGraph;
9191

92+
Result(bool hadAbnormalExit, int exitCode,
93+
fine_grained_dependencies::ModuleDepGraph depGraph)
94+
: hadAbnormalExit(hadAbnormalExit), exitCode(exitCode),
95+
depGraph(depGraph) {}
96+
9297
Result(const Result &) = delete;
9398
Result &operator=(const Result &) = delete;
9499

include/swift/IRGen/Linking.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ class LinkEntity {
680680
Data = LINKENTITY_SET_FIELD(Kind, unsigned(kind));
681681
}
682682

683-
LinkEntity() = default;
683+
LinkEntity() : Pointer(nullptr), SecondaryPointer(nullptr), Data(0) {}
684684

685685
static bool isValidResilientMethodRef(SILDeclRef declRef) {
686686
if (declRef.isForeign)

include/swift/SILOptimizer/PassManager/PassPipeline.h

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,28 @@
3333
namespace swift {
3434

3535
class SILPassPipelinePlan;
36-
struct SILPassPipeline;
36+
37+
struct SILPassPipeline final {
38+
unsigned ID;
39+
StringRef Name;
40+
unsigned KindOffset;
41+
bool isFunctionPassPipeline;
42+
43+
friend bool operator==(const SILPassPipeline &lhs,
44+
const SILPassPipeline &rhs) {
45+
return lhs.ID == rhs.ID && lhs.Name.equals(rhs.Name) &&
46+
lhs.KindOffset == rhs.KindOffset;
47+
}
48+
49+
friend bool operator!=(const SILPassPipeline &lhs,
50+
const SILPassPipeline &rhs) {
51+
return !(lhs == rhs);
52+
}
53+
54+
friend llvm::hash_code hash_value(const SILPassPipeline &pipeline) {
55+
return llvm::hash_combine(pipeline.ID, pipeline.Name, pipeline.KindOffset);
56+
}
57+
};
3758

3859
enum class PassPipelineKind {
3960
#define PASSPIPELINE(NAME, DESCRIPTION) NAME,
@@ -123,28 +144,6 @@ class SILPassPipelinePlan final {
123144
}
124145
};
125146

126-
struct SILPassPipeline final {
127-
unsigned ID;
128-
StringRef Name;
129-
unsigned KindOffset;
130-
bool isFunctionPassPipeline;
131-
132-
friend bool operator==(const SILPassPipeline &lhs,
133-
const SILPassPipeline &rhs) {
134-
return lhs.ID == rhs.ID && lhs.Name.equals(rhs.Name) &&
135-
lhs.KindOffset == rhs.KindOffset;
136-
}
137-
138-
friend bool operator!=(const SILPassPipeline &lhs,
139-
const SILPassPipeline &rhs) {
140-
return !(lhs == rhs);
141-
}
142-
143-
friend llvm::hash_code hash_value(const SILPassPipeline &pipeline) {
144-
return llvm::hash_combine(pipeline.ID, pipeline.Name, pipeline.KindOffset);
145-
}
146-
};
147-
148147
inline void SILPassPipelinePlan::
149148
startPipeline(StringRef Name, bool isFunctionPassPipeline) {
150149
PipelineStages.push_back(SILPassPipeline{

lib/AST/CASTBridging.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ struct BridgedDiagnosticImpl {
2020
InFlightDiagnostic inFlight;
2121
std::vector<StringRef> textBlobs;
2222

23+
BridgedDiagnosticImpl(InFlightDiagnostic inFlight,
24+
std::vector<StringRef> textBlobs)
25+
: inFlight(std::move(inFlight)), textBlobs(std::move(textBlobs)) {}
26+
2327
BridgedDiagnosticImpl(const BridgedDiagnosticImpl &) = delete;
2428
BridgedDiagnosticImpl(BridgedDiagnosticImpl &&) = delete;
2529
BridgedDiagnosticImpl &operator=(const BridgedDiagnosticImpl &) = delete;

lib/Frontend/DependencyVerifier.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ struct Obligation {
148148
public:
149149
Key() = delete;
150150

151+
private:
152+
Key(StringRef Name, Expectation::Kind Kind) : Name(Name), Kind(Kind) {}
153+
151154
public:
152155
static Key forNegative(StringRef name) {
153156
return Key{name, Expectation::Kind::Negative};

lib/IRGen/Outlining.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef SWIFT_IRGEN_OUTLINING_H
1818
#define SWIFT_IRGEN_OUTLINING_H
1919

20+
#include "LocalTypeDataKind.h"
2021
#include "swift/Basic/LLVM.h"
2122
#include "llvm/ADT/MapVector.h"
2223

@@ -37,7 +38,6 @@ class Address;
3738
class Explosion;
3839
class IRGenFunction;
3940
class IRGenModule;
40-
class LocalTypeDataKey;
4141
class TypeInfo;
4242

4343
/// A helper class for emitting outlined value operations.

0 commit comments

Comments
 (0)