Skip to content

[Code Health] Improve eventual C++20 support. #67683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions include/swift/Driver/Compilation.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ class Compilation {
/// This data is used for cross-module module dependencies.
fine_grained_dependencies::ModuleDepGraph depGraph;

Result(bool hadAbnormalExit, int exitCode,
fine_grained_dependencies::ModuleDepGraph depGraph)
: hadAbnormalExit(hadAbnormalExit), exitCode(exitCode),
depGraph(depGraph) {}

Result(const Result &) = delete;
Result &operator=(const Result &) = delete;

Expand Down
2 changes: 1 addition & 1 deletion include/swift/IRGen/Linking.h
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ class LinkEntity {
Data = LINKENTITY_SET_FIELD(Kind, unsigned(kind));
}

LinkEntity() = default;
LinkEntity() : Pointer(nullptr), SecondaryPointer(nullptr), Data(0) {}

static bool isValidResilientMethodRef(SILDeclRef declRef) {
if (declRef.isForeign)
Expand Down
45 changes: 22 additions & 23 deletions include/swift/SILOptimizer/PassManager/PassPipeline.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,28 @@
namespace swift {

class SILPassPipelinePlan;
struct SILPassPipeline;

struct SILPassPipeline final {
unsigned ID;
StringRef Name;
unsigned KindOffset;
bool isFunctionPassPipeline;

friend bool operator==(const SILPassPipeline &lhs,
const SILPassPipeline &rhs) {
return lhs.ID == rhs.ID && lhs.Name.equals(rhs.Name) &&
lhs.KindOffset == rhs.KindOffset;
}

friend bool operator!=(const SILPassPipeline &lhs,
const SILPassPipeline &rhs) {
return !(lhs == rhs);
}

friend llvm::hash_code hash_value(const SILPassPipeline &pipeline) {
return llvm::hash_combine(pipeline.ID, pipeline.Name, pipeline.KindOffset);
}
};

enum class PassPipelineKind {
#define PASSPIPELINE(NAME, DESCRIPTION) NAME,
Expand Down Expand Up @@ -123,28 +144,6 @@ class SILPassPipelinePlan final {
}
};

struct SILPassPipeline final {
unsigned ID;
StringRef Name;
unsigned KindOffset;
bool isFunctionPassPipeline;

friend bool operator==(const SILPassPipeline &lhs,
const SILPassPipeline &rhs) {
return lhs.ID == rhs.ID && lhs.Name.equals(rhs.Name) &&
lhs.KindOffset == rhs.KindOffset;
}

friend bool operator!=(const SILPassPipeline &lhs,
const SILPassPipeline &rhs) {
return !(lhs == rhs);
}

friend llvm::hash_code hash_value(const SILPassPipeline &pipeline) {
return llvm::hash_combine(pipeline.ID, pipeline.Name, pipeline.KindOffset);
}
};

inline void SILPassPipelinePlan::
startPipeline(StringRef Name, bool isFunctionPassPipeline) {
PipelineStages.push_back(SILPassPipeline{
Expand Down
4 changes: 4 additions & 0 deletions lib/AST/CASTBridging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ struct BridgedDiagnosticImpl {
InFlightDiagnostic inFlight;
std::vector<StringRef> textBlobs;

BridgedDiagnosticImpl(InFlightDiagnostic inFlight,
std::vector<StringRef> textBlobs)
: inFlight(std::move(inFlight)), textBlobs(std::move(textBlobs)) {}

BridgedDiagnosticImpl(const BridgedDiagnosticImpl &) = delete;
BridgedDiagnosticImpl(BridgedDiagnosticImpl &&) = delete;
BridgedDiagnosticImpl &operator=(const BridgedDiagnosticImpl &) = delete;
Expand Down
3 changes: 3 additions & 0 deletions lib/Frontend/DependencyVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ struct Obligation {
public:
Key() = delete;

private:
Key(StringRef Name, Expectation::Kind Kind) : Name(Name), Kind(Kind) {}

public:
static Key forNegative(StringRef name) {
return Key{name, Expectation::Kind::Negative};
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/Outlining.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#ifndef SWIFT_IRGEN_OUTLINING_H
#define SWIFT_IRGEN_OUTLINING_H

#include "LocalTypeDataKind.h"
#include "swift/Basic/LLVM.h"
#include "llvm/ADT/MapVector.h"

Expand All @@ -37,7 +38,6 @@ class Address;
class Explosion;
class IRGenFunction;
class IRGenModule;
class LocalTypeDataKey;
class TypeInfo;

/// A helper class for emitting outlined value operations.
Expand Down