Skip to content

Conversation

@tannergooding
Copy link
Member

This does some additional cleanup of the P/Invoke Binding Generator and allowed dotnet/LLVMSharp#93 to be regenerated and fixed to work end to end.

The primary changes are:

  • Start carrying around a "ConfigurationOptions" for the writer
  • Change node traversal to be a two pass process, rather than a 4 pass process
    • This has an added "benefit" that the output more closely mirrors the input files in terms of ordering
  • Some small fixes around typedefs and parameters that weren't being handled
  • Basic support for generating unsafe code or decide to not generate wrapper types

using System;
using System.Runtime.InteropServices;

public partial struct CXTargetInfoImpl
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes here are a side effect of doing two passes. I validated manually there was zero diff without that commit.

using System.Diagnostics;
using ClangSharp;

namespace ClangSharpPInvokeGenerator
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These all got moved into CursorWriter so they could depend on the ConfigurationOptions

"commandName": "Project",
"commandLineArgs": "--m clang --p clang_ --namespace ClangSharp --output ../../../../ClangSharp/Generated.cs --libraryPath $(LibClangName) --include $(LLVMIncludePath) --file $(LLVMIncludePath)/clang-c/Index.h --file $(LLVMIncludePath)/clang-c/CXString.h --file $(LLVMIncludePath)/clang-c/Documentation.h --file $(LLVMIncludePath)/clang-c/CXErrorCode.h --file $(LLVMIncludePath)/clang-c/BuildSystem.h --file $(LLVMIncludePath)/clang-c/CXCompilationDatabase.h --excludeFunctions clang_index_getClientEntity,clang_index_setClientEntity,clang_createTranslationUnitFromSourceFile,clang_parseTranslationUnit,clang_parseTranslationUnit2,clang_parseTranslationUnit2FullArgv,clang_reparseTranslationUnit,clang_codeCompleteAt,clang_indexSourceFile,clang_indexSourceFileFullArgv,clang_disposeSourceRangeList,clang_annotateTokens,clang_annotateTokens,clang_disposeTokens,clang_tokenize,clang_disposeStringSet,clang_getCompletionParent,clang_disposeCXPlatformAvailability,clang_getCursorPlatformAvailability",
"environmentVariables": {
"LLVMIncludePath": "C:\\Program Files\\LLVM\\include"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These weren't needed as the actual setting was coming from the csproj file, which is probably better.

@tannergooding tannergooding merged commit b218e4f into dotnet:master Apr 29, 2019
@tannergooding tannergooding deleted the rewrite-fixups branch April 30, 2019 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants