diff --git a/include/swift/Sema/TypeCheckRequest.h b/include/swift/Sema/TypeCheckRequest.h index b5767e5..cc2061a 100644 --- a/include/swift/Sema/TypeCheckRequest.h +++ b/include/swift/Sema/TypeCheckRequest.h @@ -114,7 +114,41 @@ public: } #include "swift/Sema/TypeCheckRequestPayloads.def" - + + TypeCheckRequest(const TypeCheckRequest &T) { *this = T; } + + TypeCheckRequest& operator=(const TypeCheckRequest &T) { + TheKind = T.getKind(); + switch (getPayloadKind(TheKind)) { + case PayloadKind::Class: + Payload.Class = T.Payload.Class; + break; + case PayloadKind::Enum: + Payload.Enum = T.Payload.Enum; + break; + case PayloadKind::InheritedClauseEntry: + new (&Payload.InheritedClauseEntry) std::pair, unsigned>(T.Payload.InheritedClauseEntry); + break; + case PayloadKind::Protocol: + Payload.Protocol = T.Payload.Protocol; + break; + case PayloadKind::DeclContextLookup: + new (&Payload.DeclContextLookup) DeclContextLookupInfo(T.Payload.DeclContextLookup); + break; + case PayloadKind::TypeResolution: + new (&Payload.TypeResolution) std::tuple(T.Payload.TypeResolution); + break; + case PayloadKind::TypeDeclResolution: + Payload.TypeDeclResolution = T.Payload.TypeDeclResolution; + break; +#if 0 + default: + llvm_unreachable("unknown kind"); +#endif + } + return *this; + } + /// Determine the kind of type check request. Kind getKind() const { return TheKind; }