Skip to content

Commit cef57de

Browse files
authored
Add attribute to support inline namespaces in C++/CLI. (#781)
* 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. * Add [CppInlineNamespace] to refs.
1 parent fc06054 commit cef57de

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/libraries/System.Runtime.CompilerServices.VisualC/ref/System.Runtime.CompilerServices.VisualC.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ public sealed partial class NativeCppClassAttribute : System.Attribute
6666
{
6767
public NativeCppClassAttribute() { }
6868
}
69+
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true)]
70+
public sealed class CppInlineNamespaceAttribute : Attribute
71+
{
72+
public CppInlineNamespaceAttribute(string dottedName) {}
73+
}
6974
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Enum | System.AttributeTargets.Interface | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
7075
public sealed partial class RequiredAttributeAttribute : System.Attribute
7176
{

src/libraries/System.Runtime.CompilerServices.VisualC/src/System/Runtime/CompilerServices/Attributes.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ public sealed class NativeCppClassAttribute : Attribute
121121
public NativeCppClassAttribute() { }
122122
}
123123

124+
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple=true)]
125+
public sealed class CppInlineNamespaceAttribute : Attribute
126+
{
127+
public CppInlineNamespaceAttribute(string dottedName) {}
128+
}
129+
124130
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
125131
public sealed class RequiredAttributeAttribute : Attribute
126132
{

0 commit comments

Comments
 (0)