Skip to content

Commit b9efb2d

Browse files
committed
Add parameter attributes
1 parent 3f56975 commit b9efb2d

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/CppAst/CppModelBuilder.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,6 +1659,8 @@ private CppFunction VisitFunctionDecl(CXCursor cursor, CXCursor parent, void* da
16591659

16601660
var parameter = new CppParameter(GetCppType(argCursor.Type.Declaration, argCursor.Type, argCursor, clientData), argName);
16611661

1662+
ParseAttributes(argCursor, parameter, true);
1663+
16621664
cppFunction.Parameters.Add(parameter);
16631665

16641666
// Visit default parameter value

src/CppAst/CppParameter.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
// See license.txt file in the project root for full license information.
44

55
using System;
6+
using System.Collections.Generic;
67

78
namespace CppAst
89
{
910
/// <summary>
1011
/// A C++ function parameter.
1112
/// </summary>
12-
public sealed class CppParameter : CppDeclaration, ICppMember
13+
public sealed class CppParameter : CppDeclaration, ICppMember, ICppAttributeContainer
1314
{
1415
/// <summary>
1516
/// Creates a new instance of a C++ function parameter.
@@ -20,6 +21,9 @@ public CppParameter(CppType type, string name)
2021
{
2122
Type = type ?? throw new ArgumentNullException(nameof(type));
2223
Name = name ?? throw new ArgumentNullException(nameof(name));
24+
Attributes = new List<CppAttribute>();
25+
TokenAttributes = new List<CppAttribute>();
26+
MetaAttributes = new MetaAttributeMap();
2327
}
2428

2529
/// <summary>
@@ -51,5 +55,14 @@ public override string ToString()
5155

5256
return InitExpression != null ? $"{Type.GetDisplayName()} {Name} = {InitExpression}" : $"{Type.GetDisplayName()} {Name}";
5357
}
58+
59+
/// <inheritdoc/>
60+
public List<CppAttribute> Attributes { get; }
61+
62+
/// <inheritdoc/>
63+
public List<CppAttribute> TokenAttributes { get; }
64+
65+
/// <inheritdoc/>
66+
public MetaAttributeMap MetaAttributes { get; }
5467
}
5568
}

0 commit comments

Comments
 (0)