From 8bc378d2b26192172478520565fad91c985798c6 Mon Sep 17 00:00:00 2001 From: Tanveer Gani Date: Wed, 11 Dec 2019 15:51:14 -0800 Subject: [PATCH 1/2] Add attribute to support inline namespaces in C++/CLI. A new assembly-scope custom attribute [CppInlineNamespace(string dottedName)] has been added to implement inline namespaces in C++/CLI. For every inline namespace encountered in a translation unit, the C++ compiler will emit this attribute with the fully scoped name, in CLR dotted form, as the argument for the attribute. --- .../src/System/Runtime/CompilerServices/Attributes.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/libraries/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs b/src/libraries/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs index ec989201762df5..18dad6f87f40bb 100644 --- a/src/libraries/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs +++ b/src/libraries/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs @@ -121,6 +121,12 @@ public sealed class NativeCppClassAttribute : Attribute public NativeCppClassAttribute() { } } + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true)] + public sealed class CppInlineNamespaceAttribute : Attribute + { + public CppInlineNamespaceAttribute(string dottedName) {} + } + [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)] public sealed class RequiredAttributeAttribute : Attribute { From a1c8f1c00476f63ae023fb17f4cf8895083688c7 Mon Sep 17 00:00:00 2001 From: Tanveer Gani Date: Wed, 29 Jan 2020 12:09:22 -0800 Subject: [PATCH 2/2] Add [CppInlineNamespace] to refs. --- .../ref/System.Runtime.CompilerServices.VisualC.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.cs b/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.cs index 7600470f413dba..1d5079f52cdf1c 100644 --- a/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.cs +++ b/src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.cs @@ -66,6 +66,11 @@ public sealed partial class NativeCppClassAttribute : System.Attribute { public NativeCppClassAttribute() { } } + [AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true)] + public sealed class CppInlineNamespaceAttribute : Attribute + { + public CppInlineNamespaceAttribute(string dottedName) {} + } [System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)] public sealed partial class RequiredAttributeAttribute : System.Attribute {