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