Skip to content

Commit

Permalink
Merge pull request #2 from libimobiledevice-win32/fixes/fixed-array
Browse files Browse the repository at this point in the history
Be explicit about arrays
  • Loading branch information
GordenOu authored May 17, 2018
2 parents 2a40bb1 + 3e3c72d commit 38ef66d
Show file tree
Hide file tree
Showing 9 changed files with 255 additions and 27 deletions.
142 changes: 142 additions & 0 deletions Core.Clang/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,5 +1423,147 @@ public static extern uint clang_Type_visitFields(
CXType T,
IntPtr visitor,
CXClientDataImpl* client_data);

[DllImport(dllName)]
public static extern CXComment clang_Cursor_getParsedComment(
CXCursor C);

[DllImport(dllName)]
public static extern CXCommentKind clang_Comment_getKind(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_Comment_getNumChildren(
CXComment Comment);

[DllImport(dllName)]
public static extern CXComment clang_Comment_getChild(
CXComment Comment,
uint ChildIdx);

[DllImport(dllName)]
public static extern uint clang_Comment_isWhitespace(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_InlineContentComment_hasTrailingNewline(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_TextComment_getText(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_InlineCommandComment_getCommandName(
CXComment Comment);

[DllImport(dllName)]
public static extern CXCommentInlineCommandRenderKind clang_InlineCommandComment_getRenderKind(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_InlineCommandComment_getNumArgs(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_InlineCommandComment_getArgText(
CXComment Comment,
uint ArgIdx);

[DllImport(dllName)]
public static extern CXString clang_HTMLTagComment_getTagName(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_HTMLStartTagComment_isSelfClosing(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_HTMLStartTag_getNumAttrs(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_HTMLStartTag_getAttrName(
CXComment Comment,
uint AttrIdx);

[DllImport(dllName)]
public static extern CXString clang_HTMLStartTag_getAttrValue(
CXComment Comment,
uint AttrIdx);

[DllImport(dllName)]
public static extern CXString clang_BlockCommandComment_getCommandName(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_BlockCommandComment_getNumArgs(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_BlockCommandComment_getArgText(
CXComment Comment,
uint ArgIdx);

[DllImport(dllName)]
public static extern CXComment clang_BlockCommandComment_getParagraph(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_ParamCommandComment_getParamName(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_ParamCommandComment_isParamIndexValid(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_ParamCommandComment_getParamIndex(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_ParamCommandComment_isDirectionExplicit(
CXComment Comment);

[DllImport(dllName)]
public static extern CXCommentParamPassDirection clang_ParamCommandComment_getDirection(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_TParamCommandComment_getParamName(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_TParamCommandComment_isParamPositionValid(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_TParamCommandComment_getDepth(
CXComment Comment);

[DllImport(dllName)]
public static extern uint clang_TParamCommandComment_getIndex(
CXComment Comment,
uint Depth);

[DllImport(dllName)]
public static extern CXString clang_VerbatimBlockLineComment_getText(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_VerbatimLineComment_getText(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_HTMLTagComment_getAsString(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_FullComment_getAsHTML(
CXComment Comment);

[DllImport(dllName)]
public static extern CXString clang_FullComment_getAsXML(
CXComment Comment);
}
}
64 changes: 57 additions & 7 deletions Core.Clang/NativeTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,24 @@ internal struct CXFileImpl { }
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct CXFileUniqueID
{
public fixed ulong data[3];
public ulong data_0;
public ulong data_1;
public ulong data_2;
}

[StructLayout(LayoutKind.Sequential)]
internal unsafe struct CXSourceLocation
{
public fixed ulong ptr_data[2];
public ulong ptr_data_0;
public ulong ptr_data_1;
public uint int_data;
}

[StructLayout(LayoutKind.Sequential)]
internal unsafe struct CXSourceRange
{
public fixed ulong ptr_data[2];
public ulong ptr_data_0;
public ulong ptr_data_1;
public uint begin_int_data;
public uint end_int_data;
}
Expand Down Expand Up @@ -461,7 +465,9 @@ internal unsafe struct CXCursor
{
public CXCursorKind kind;
public int xdata;
public fixed ulong data[3];
public ulong data_0;
public ulong data_1;
public ulong data_2;
}

internal enum CXLinkageKind
Expand Down Expand Up @@ -629,7 +635,8 @@ internal enum CXCallingConv
internal unsafe struct CXType
{
public CXTypeKind kind;
public fixed ulong data[2];
public ulong data_0;
public ulong data_1;
}

internal enum CXTemplateArgumentKind
Expand Down Expand Up @@ -739,7 +746,10 @@ internal enum CXTokenKind
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct CXToken
{
public fixed uint int_data[4];
public uint int_data_0;
public uint int_data_1;
public uint int_data_2;
public uint int_data_3;
public void* ptr_data;
}

Expand Down Expand Up @@ -865,7 +875,8 @@ internal struct CXIdxClientASTFileImpl { }
[StructLayout(LayoutKind.Sequential)]
internal unsafe struct CXIdxLoc
{
public fixed ulong ptr_data[2];
public ulong ptr_data_0;
public ulong ptr_data_1;
public uint int_data;
}

Expand Down Expand Up @@ -1116,4 +1127,43 @@ internal enum CXIndexOptFlags
CXIndexOpt_SuppressWarnings = 0x8,
CXIndexOpt_SkipParsedBodiesInSession = 0x10
}

[StructLayout(LayoutKind.Sequential)]
internal unsafe struct CXComment
{
public void* ASTNode;
public CXTranslationUnitImpl* TranslationUnit;
}

internal enum CXCommentKind
{
CXComment_Null = 0,
CXComment_Text = 1,
CXComment_InlineCommand = 2,
CXComment_HTMLStartTag = 3,
CXComment_HTMLEndTag = 4,
CXComment_Paragraph = 5,
CXComment_BlockCommand = 6,
CXComment_ParamCommand = 7,
CXComment_TParamCommand = 8,
CXComment_VerbatimBlockCommand = 9,
CXComment_VerbatimBlockLine = 10,
CXComment_VerbatimLine = 11,
CXComment_FullComment = 12
}

internal enum CXCommentInlineCommandRenderKind
{
CXCommentInlineCommandRenderKind_Normal,
CXCommentInlineCommandRenderKind_Bold,
CXCommentInlineCommandRenderKind_Monospaced,
CXCommentInlineCommandRenderKind_Emphasized
}

internal enum CXCommentParamPassDirection
{
CXCommentParamPassDirection_In,
CXCommentParamPassDirection_Out,
CXCommentParamPassDirection_InOut
}
}
2 changes: 1 addition & 1 deletion Core.Clang/SourceFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public override int GetHashCode()
}

var value = id.Value;
return value.data[0].GetHashCode() ^ value.data[1].GetHashCode();
return value.data_0.GetHashCode() ^ value.data_1.GetHashCode();
}

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions Core.Clang/SourceLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ public override int GetHashCode()

var cxSourceLocation = Struct;
return
cxSourceLocation.ptr_data[0].GetHashCode() ^
cxSourceLocation.ptr_data[1].GetHashCode() ^
cxSourceLocation.ptr_data_0.GetHashCode() ^
cxSourceLocation.ptr_data_1.GetHashCode() ^
cxSourceLocation.int_data.GetHashCode();
}

Expand Down
4 changes: 2 additions & 2 deletions Core.Clang/SourceRange.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ public override int GetHashCode()
ThrowIfDisposed();

var cxSourceRange = Struct;
return cxSourceRange.ptr_data[0].GetHashCode() ^
cxSourceRange.ptr_data[1].GetHashCode() ^
return cxSourceRange.ptr_data_0.GetHashCode() ^
cxSourceRange.ptr_data_1.GetHashCode() ^
cxSourceRange.begin_int_data.GetHashCode() ^
cxSourceRange.end_int_data.GetHashCode();
}
Expand Down
2 changes: 1 addition & 1 deletion Core.Clang/TypeInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public override int GetHashCode()
ThrowIfDisposed();

var cxType = Struct;
return cxType.data[0].GetHashCode() ^ cxType.data[1].GetHashCode();
return cxType.data_0.GetHashCode() ^ cxType.data_1.GetHashCode();
}

/// <summary>
Expand Down
Loading

0 comments on commit 38ef66d

Please sign in to comment.