@@ -2808,22 +2808,80 @@ struct TargetExtensionContextDescriptor final
2808
2808
2809
2809
using ExtensionContextDescriptor = TargetExtensionContextDescriptor<InProcess>;
2810
2810
2811
+ template <typename Runtime>
2812
+ struct TargetMangledContextName {
2813
+ // / The mangled name of the context.
2814
+ TargetRelativeDirectPointer<Runtime, const char , /* nullable*/ false > name;
2815
+ };
2816
+
2811
2817
template <typename Runtime>
2812
2818
struct TargetAnonymousContextDescriptor final
2813
2819
: TargetContextDescriptor<Runtime>,
2814
- TrailingGenericContextObjects<TargetAnonymousContextDescriptor<Runtime>>
2820
+ TrailingGenericContextObjects<TargetAnonymousContextDescriptor<Runtime>,
2821
+ TargetGenericContextDescriptorHeader,
2822
+ TargetMangledContextName<Runtime>>
2815
2823
{
2816
2824
private:
2817
2825
using TrailingGenericContextObjects
2818
- = TrailingGenericContextObjects<TargetAnonymousContextDescriptor<Runtime>>;
2826
+ = TrailingGenericContextObjects<TargetAnonymousContextDescriptor<Runtime>,
2827
+ TargetGenericContextDescriptorHeader,
2828
+ TargetMangledContextName<Runtime>>;
2829
+ using TrailingObjects =
2830
+ typename TrailingGenericContextObjects::TrailingObjects;
2831
+ friend TrailingObjects;
2819
2832
2820
2833
public:
2834
+ using MangledContextName = TargetMangledContextName<Runtime>;
2835
+
2821
2836
using TrailingGenericContextObjects::getGenericContext;
2837
+ using TrailingGenericContextObjects::getGenericContextHeader;
2838
+ using TrailingGenericContextObjects::getFullGenericContextHeader;
2839
+ using TrailingGenericContextObjects::getGenericParams;
2840
+
2841
+ AnonymousContextDescriptorFlags getAnonymousContextDescriptorFlags () const {
2842
+ return AnonymousContextDescriptorFlags (this ->Flags .getKindSpecificFlags ());
2843
+ }
2822
2844
2845
+ // / Whether this anonymous context descriptor contains a full mangled name,
2846
+ // / which can be used to match the anonymous type to its textual form.
2847
+ bool hasMangledName () const {
2848
+ return getAnonymousContextDescriptorFlags ().hasMangledName ();
2849
+ }
2850
+
2851
+ // / Retrieve the mangled name of this context, or NULL if it was not
2852
+ // / recorded in the metadata.
2853
+ ConstTargetPointer<Runtime, char > getMangledName () const {
2854
+ if (!hasMangledName ())
2855
+ return ConstTargetPointer<Runtime, char >();
2856
+
2857
+ return this ->template getTrailingObjects <MangledContextName>()->name ;
2858
+ }
2859
+
2860
+ // / Retrieve a pointer to the mangled context name structure.
2861
+ const MangledContextName *getMangledContextName () const {
2862
+ if (!hasMangledName ())
2863
+ return nullptr ;
2864
+
2865
+ return this ->template getTrailingObjects <MangledContextName>();
2866
+ }
2867
+
2868
+ private:
2869
+ template <typename T>
2870
+ using OverloadToken =
2871
+ typename TrailingGenericContextObjects::template OverloadToken<T>;
2872
+
2873
+ using TrailingGenericContextObjects::numTrailingObjects;
2874
+
2875
+ size_t numTrailingObjects (OverloadToken<MangledContextName>) const {
2876
+ return this ->hasMangledNam () ? 1 : 0 ;
2877
+ }
2878
+
2879
+ public:
2823
2880
static bool classof (const TargetContextDescriptor<Runtime> *cd) {
2824
2881
return cd->getKind () == ContextDescriptorKind::Anonymous;
2825
2882
}
2826
2883
};
2884
+ using AnonymousContextDescriptor = TargetAnonymousContextDescriptor<InProcess>;
2827
2885
2828
2886
// / A protocol descriptor.
2829
2887
// /
0 commit comments