From b81585260c217ccc020d8e84bb395b000f496915 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Wed, 14 Sep 2022 19:33:15 -0700 Subject: [PATCH 1/6] Updating version information to llvmorg-15.0.0 --- CMakeLists.txt | 2 +- ClangSharp.sln | 32 ++++++++++++++++--- Directory.Build.props | 2 +- Directory.Build.targets | 4 +-- README.md | 6 ++-- ...ibClangSharp.runtime.freebsd.12-x64.nuspec | 2 +- ...ibClangSharp.runtime.freebsd.13-x64.nuspec | 2 +- .../libClangSharp.runtime.linux-arm64.nuspec | 2 +- .../libClangSharp.runtime.linux-x64.nuspec | 20 ++++++++++++ .../libClangSharp.runtime.osx-arm64.nuspec | 20 ++++++++++++ .../libClangSharp.runtime.osx-x64.nuspec | 2 +- ...ClangSharp.runtime.ubuntu.18.04-x64.nuspec | 2 +- ...ClangSharp.runtime.ubuntu.20.04-x64.nuspec | 2 +- ...langSharp.runtime.ubuntu.22.04-x64.nuspec} | 8 ++--- .../libClangSharp.runtime.win-arm64.nuspec | 2 +- .../libClangSharp.runtime.win-x64.nuspec | 2 +- .../libClangSharp.runtime.win-x86.nuspec | 2 +- .../libClangSharp/libClangSharp.nuspec | 5 +-- .../libClangSharp/libClangSharp/runtime.json | 32 ++++++++++++------- .../libclang.runtime.freebsd.12-x64.nuspec | 4 +-- .../libclang.runtime.freebsd.13-x64.nuspec | 4 +-- .../libclang.runtime.linux-arm64.nuspec | 4 +-- .../libclang.runtime.linux-x64.nuspec | 19 +++++++++++ .../libclang.runtime.osx-arm64.nuspec | 19 +++++++++++ .../libclang.runtime.osx-x64.nuspec | 4 +-- .../libclang.runtime.ubuntu.18.04-x64.nuspec | 4 +-- .../libclang.runtime.ubuntu.20.04-x64.nuspec | 4 +-- .../libclang.runtime.ubuntu.22.04-x64.nuspec} | 10 +++--- .../libclang.runtime.win-arm64.nuspec | 4 +-- .../libclang.runtime.win-x64.nuspec | 4 +-- .../libclang.runtime.win-x86.nuspec | 4 +-- packages/libclang/libclang/LICENSE.TXT | 2 +- packages/libclang/libclang/libclang.nuspec | 7 ++-- packages/libclang/libclang/runtime.json | 32 ++++++++++++------- .../ClangSharp.Interop/CXAvailabilityKind.cs | 2 +- sources/ClangSharp.Interop/CXCallingConv.cs | 2 +- .../ClangSharp.Interop/CXChildVisitResult.cs | 2 +- .../CXCodeCompleteResults.cs | 2 +- .../CXCodeComplete_Flags.cs | 2 +- sources/ClangSharp.Interop/CXComment.cs | 2 +- .../CXCommentInlineCommandRenderKind.cs | 2 +- sources/ClangSharp.Interop/CXCommentKind.cs | 2 +- .../CXCommentParamPassDirection.cs | 2 +- .../CXCompilationDatabase_Error.cs | 2 +- .../CXCompletionChunkKind.cs | 2 +- .../ClangSharp.Interop/CXCompletionContext.cs | 2 +- .../ClangSharp.Interop/CXCompletionResult.cs | 2 +- sources/ClangSharp.Interop/CXCursor.cs | 2 +- .../CXCursorAndRangeVisitor.cs | 2 +- sources/ClangSharp.Interop/CXCursorKind.cs | 2 +- sources/ClangSharp.Interop/CXCursorSetImpl.cs | 2 +- sources/ClangSharp.Interop/CXCursorVisitor.cs | 2 +- .../CXCursor_ExceptionSpecificationKind.cs | 2 +- .../CXDiagnosticDisplayOptions.cs | 2 +- .../CXDiagnosticSeverity.cs | 2 +- sources/ClangSharp.Interop/CXErrorCode.cs | 2 +- .../ClangSharp.Interop/CXEvalResultKind.cs | 2 +- sources/ClangSharp.Interop/CXFieldVisitor.cs | 2 +- sources/ClangSharp.Interop/CXFileUniqueID.cs | 2 +- .../ClangSharp.Interop/CXGlobalOptFlags.cs | 2 +- sources/ClangSharp.Interop/CXIdxAttrInfo.cs | 2 +- sources/ClangSharp.Interop/CXIdxAttrKind.cs | 2 +- .../ClangSharp.Interop/CXIdxBaseClassInfo.cs | 2 +- .../CXIdxCXXClassDeclInfo.cs | 2 +- .../ClangSharp.Interop/CXIdxContainerInfo.cs | 2 +- sources/ClangSharp.Interop/CXIdxDeclInfo.cs | 2 +- .../ClangSharp.Interop/CXIdxDeclInfoFlags.cs | 2 +- .../CXIdxEntityCXXTemplateKind.cs | 2 +- sources/ClangSharp.Interop/CXIdxEntityInfo.cs | 2 +- sources/ClangSharp.Interop/CXIdxEntityKind.cs | 2 +- .../ClangSharp.Interop/CXIdxEntityLanguage.cs | 2 +- .../ClangSharp.Interop/CXIdxEntityRefInfo.cs | 2 +- .../ClangSharp.Interop/CXIdxEntityRefKind.cs | 2 +- .../CXIdxIBOutletCollectionAttrInfo.cs | 2 +- .../CXIdxImportedASTFileInfo.cs | 2 +- .../CXIdxIncludedFileInfo.cs | 2 +- sources/ClangSharp.Interop/CXIdxLoc.cs | 2 +- .../CXIdxObjCCategoryDeclInfo.cs | 2 +- .../CXIdxObjCContainerDeclInfo.cs | 2 +- .../CXIdxObjCContainerKind.cs | 2 +- .../CXIdxObjCInterfaceDeclInfo.cs | 2 +- .../CXIdxObjCPropertyDeclInfo.cs | 2 +- .../CXIdxObjCProtocolRefInfo.cs | 2 +- .../CXIdxObjCProtocolRefListInfo.cs | 2 +- .../ClangSharp.Interop/CXInclusionVisitor.cs | 2 +- sources/ClangSharp.Interop/CXIndexOptFlags.cs | 2 +- sources/ClangSharp.Interop/CXLanguageKind.cs | 2 +- sources/ClangSharp.Interop/CXLinkageKind.cs | 2 +- .../ClangSharp.Interop/CXLoadDiag_Error.cs | 2 +- .../CXModuleMapDescriptorImpl.cs | 2 +- sources/ClangSharp.Interop/CXNameRefFlags.cs | 2 +- .../CXObjCDeclQualifierKind.cs | 2 +- .../CXObjCPropertyAttrKind.cs | 2 +- .../CXPlatformAvailability.cs | 2 +- .../CXPrintingPolicyProperty.cs | 2 +- .../ClangSharp.Interop/CXRefQualifierKind.cs | 2 +- sources/ClangSharp.Interop/CXReparse_Flags.cs | 2 +- sources/ClangSharp.Interop/CXResult.cs | 2 +- sources/ClangSharp.Interop/CXSaveError.cs | 2 +- .../CXSaveTranslationUnit_Flags.cs | 2 +- .../ClangSharp.Interop/CXSourceLocation.cs | 2 +- sources/ClangSharp.Interop/CXSourceRange.cs | 2 +- .../ClangSharp.Interop/CXSourceRangeList.cs | 2 +- sources/ClangSharp.Interop/CXString.cs | 2 +- sources/ClangSharp.Interop/CXStringSet.cs | 2 +- sources/ClangSharp.Interop/CXSymbolRole.cs | 2 +- sources/ClangSharp.Interop/CXTLSKind.cs | 2 +- .../ClangSharp.Interop/CXTUResourceUsage.cs | 2 +- .../CXTUResourceUsageEntry.cs | 2 +- .../CXTUResourceUsageKind.cs | 2 +- .../ClangSharp.Interop/CXTargetInfoImpl.cs | 2 +- .../CXTemplateArgumentKind.cs | 2 +- sources/ClangSharp.Interop/CXToken.cs | 2 +- sources/ClangSharp.Interop/CXTokenKind.cs | 2 +- .../CXTranslationUnitImpl.cs | 2 +- .../CXTranslationUnit_Flags.cs | 2 +- sources/ClangSharp.Interop/CXType.cs | 2 +- sources/ClangSharp.Interop/CXTypeKind.cs | 2 +- .../ClangSharp.Interop/CXTypeLayoutError.cs | 2 +- .../CXTypeNullabilityKind.cs | 2 +- sources/ClangSharp.Interop/CXUnsavedFile.cs | 2 +- sources/ClangSharp.Interop/CXVersion.cs | 2 +- .../CXVirtualFileOverlayImpl.cs | 2 +- .../ClangSharp.Interop/CXVisibilityKind.cs | 2 +- sources/ClangSharp.Interop/CXVisitorResult.cs | 2 +- .../CX_CXXAccessSpecifier.cs | 2 +- sources/ClangSharp.Interop/CX_StorageClass.cs | 2 +- .../ClangSharp.Interop/IndexerCallbacks.cs | 2 +- sources/ClangSharp.Interop/clang.cs | 2 +- .../PInvokeGenerator.cs | 2 +- .../Properties/GenerateClang-LICENSE.txt | 2 +- .../Properties/GenerateLLVM-LICENSE.txt | 2 +- sources/libClangSharp/CIndexDiagnostic.cpp | 2 +- sources/libClangSharp/CIndexDiagnostic.h | 2 +- sources/libClangSharp/CXCursor.cpp | 2 +- sources/libClangSharp/CXCursor.h | 2 +- sources/libClangSharp/CXLoadedDiagnostic.cpp | 2 +- sources/libClangSharp/CXLoadedDiagnostic.h | 2 +- sources/libClangSharp/CXSourceLocation.cpp | 2 +- sources/libClangSharp/CXSourceLocation.h | 2 +- sources/libClangSharp/CXString.cpp | 2 +- sources/libClangSharp/CXString.h | 2 +- sources/libClangSharp/CXTranslationUnit.cpp | 2 +- sources/libClangSharp/CXTranslationUnit.h | 2 +- sources/libClangSharp/CXType.cpp | 2 +- sources/libClangSharp/CXType.h | 2 +- sources/libClangSharp/ClangSharp.cpp | 2 +- .../CXCodeCompleteResultsTests.cs | 2 +- .../InteropTests/CXCommentTests.cs | 2 +- .../InteropTests/CXCompletionResultTests.cs | 2 +- .../CXCursorAndRangeVisitorTests.cs | 2 +- .../InteropTests/CXCursorSetImplTests.cs | 2 +- .../InteropTests/CXCursorTests.cs | 2 +- .../InteropTests/CXFileUniqueIDTests.cs | 2 +- .../InteropTests/CXIdxAttrInfoTests.cs | 2 +- .../InteropTests/CXIdxBaseClassInfoTests.cs | 2 +- .../CXIdxCXXClassDeclInfoTests.cs | 2 +- .../InteropTests/CXIdxContainerInfoTests.cs | 2 +- .../InteropTests/CXIdxDeclInfoTests.cs | 2 +- .../InteropTests/CXIdxEntityInfoTests.cs | 2 +- .../InteropTests/CXIdxEntityRefInfoTests.cs | 2 +- .../CXIdxIBOutletCollectionAttrInfoTests.cs | 2 +- .../CXIdxImportedASTFileInfoTests.cs | 2 +- .../CXIdxIncludedFileInfoTests.cs | 2 +- .../InteropTests/CXIdxLocTests.cs | 2 +- .../CXIdxObjCCategoryDeclInfoTests.cs | 2 +- .../CXIdxObjCContainerDeclInfoTests.cs | 2 +- .../CXIdxObjCInterfaceDeclInfoTests.cs | 2 +- .../CXIdxObjCPropertyDeclInfoTests.cs | 2 +- .../CXIdxObjCProtocolRefInfoTests.cs | 2 +- .../CXIdxObjCProtocolRefListInfoTests.cs | 2 +- .../CXModuleMapDescriptorImplTests.cs | 2 +- .../CXPlatformAvailabilityTests.cs | 2 +- .../InteropTests/CXSourceLocationTests.cs | 2 +- .../InteropTests/CXSourceRangeListTests.cs | 2 +- .../InteropTests/CXSourceRangeTests.cs | 2 +- .../InteropTests/CXStringSetTests.cs | 2 +- .../InteropTests/CXStringTests.cs | 2 +- .../CXTUResourceUsageEntryTests.cs | 2 +- .../InteropTests/CXTUResourceUsageTests.cs | 2 +- .../InteropTests/CXTargetInfoImplTests.cs | 2 +- .../InteropTests/CXTokenTests.cs | 2 +- .../CXTranslationUnitImplTests.cs | 2 +- .../InteropTests/CXTypeTests.cs | 2 +- .../InteropTests/CXUnsavedFileTests.cs | 2 +- .../InteropTests/CXVersionTests.cs | 2 +- .../CXVirtualFileOverlayImplTests.cs | 2 +- .../InteropTests/IndexerCallbacksTests.cs | 2 +- 188 files changed, 349 insertions(+), 233 deletions(-) create mode 100644 packages/libClangSharp/libClangSharp.runtime.linux-x64/libClangSharp.runtime.linux-x64.nuspec create mode 100644 packages/libClangSharp/libClangSharp.runtime.osx-arm64/libClangSharp.runtime.osx-arm64.nuspec rename packages/libClangSharp/{libClangSharp.runtime.ubuntu.21.10-x64/libClangSharp.runtime.ubuntu.21.10-x64.nuspec => libClangSharp.runtime.ubuntu.22.04-x64/libClangSharp.runtime.ubuntu.22.04-x64.nuspec} (78%) create mode 100644 packages/libclang/libclang.runtime.linux-x64/libclang.runtime.linux-x64.nuspec create mode 100644 packages/libclang/libclang.runtime.osx-arm64/libclang.runtime.osx-arm64.nuspec rename packages/libclang/{libclang.runtime.ubuntu.21.10-x64/libclang.runtime.ubuntu.21.10-x64.nuspec => libclang.runtime.ubuntu.22.04-x64/libclang.runtime.ubuntu.22.04-x64.nuspec} (75%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9d303ac5..08aef577 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.13) -project(ClangSharp VERSION 14.0.0) +project(ClangSharp VERSION 15.0.0) set(CMAKE_CXX_STANDARD 17) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) diff --git a/ClangSharp.sln b/ClangSharp.sln index f354198a..276efdf9 100644 --- a/ClangSharp.sln +++ b/ClangSharp.sln @@ -165,9 +165,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libclang.runtime.ubuntu.20. packages\libclang\libclang.runtime.ubuntu.20.04-x64\libclang.runtime.ubuntu.20.04-x64.nuspec = packages\libclang\libclang.runtime.ubuntu.20.04-x64\libclang.runtime.ubuntu.20.04-x64.nuspec EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libclang.runtime.ubuntu.21.10-x64", "libclang.runtime.ubuntu.21.10-x64", "{F3254760-351E-4886-A243-FF3778837C40}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libclang.runtime.ubuntu.22.04-x64", "libclang.runtime.ubuntu.22.04-x64", "{F3254760-351E-4886-A243-FF3778837C40}" ProjectSection(SolutionItems) = preProject - packages\libclang\libclang.runtime.ubuntu.21.10-x64\libclang.runtime.ubuntu.21.10-x64.nuspec = packages\libclang\libclang.runtime.ubuntu.21.10-x64\libclang.runtime.ubuntu.21.10-x64.nuspec + packages\libclang\libclang.runtime.ubuntu.22.04-x64\libclang.runtime.ubuntu.22.04-x64.nuspec = packages\libclang\libclang.runtime.ubuntu.22.04-x64\libclang.runtime.ubuntu.22.04-x64.nuspec EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libclang.runtime.win-arm64", "libclang.runtime.win-arm64", "{B3F3A831-DA09-40A2-A25C-DE47A58BB93B}" @@ -175,9 +175,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libclang.runtime.win-arm64" packages\libclang\libclang.runtime.win-arm64\libclang.runtime.win-arm64.nuspec = packages\libclang\libclang.runtime.win-arm64\libclang.runtime.win-arm64.nuspec EndProjectSection EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libClangSharp.runtime.ubuntu.21.10-x64", "libClangSharp.runtime.ubuntu.21.10-x64", "{D90C3C52-DA8D-44BB-B8B0-3E4EF4CBF4DC}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libClangSharp.runtime.ubuntu.22.04-x64", "libClangSharp.runtime.ubuntu.22.04-x64", "{D90C3C52-DA8D-44BB-B8B0-3E4EF4CBF4DC}" ProjectSection(SolutionItems) = preProject - packages\libClangSharp\libClangSharp.runtime.ubuntu.21.10-x64\libClangSharp.runtime.ubuntu.21.10-x64.nuspec = packages\libClangSharp\libClangSharp.runtime.ubuntu.21.10-x64\libClangSharp.runtime.ubuntu.21.10-x64.nuspec + packages\libClangSharp\libClangSharp.runtime.ubuntu.22.04-x64\libClangSharp.runtime.ubuntu.22.04-x64.nuspec = packages\libClangSharp\libClangSharp.runtime.ubuntu.22.04-x64\libClangSharp.runtime.ubuntu.22.04-x64.nuspec EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libClangSharp.runtime.win-arm64", "libClangSharp.runtime.win-arm64", "{69B805C6-230D-49A2-A569-3CAC2EC9F293}" @@ -204,6 +204,26 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ .github\workflows\ci.yml = .github\workflows\ci.yml EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libclang.runtime.osx-arm64", "libclang.runtime.osx-arm64", "{7A12C7A3-3152-49C2-A831-3DA77922BF2A}" + ProjectSection(SolutionItems) = preProject + packages\libclang\libclang.runtime.osx-arm64\libclang.runtime.osx-arm64.nuspec = packages\libclang\libclang.runtime.osx-arm64\libclang.runtime.osx-arm64.nuspec + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libclang.runtime.linux-x64", "libclang.runtime.linux-x64", "{1CA1A906-1A19-46D5-8AC4-87C13523899B}" + ProjectSection(SolutionItems) = preProject + packages\libclang\libclang.runtime.linux-x64\libclang.runtime.linux-x64.nuspec = packages\libclang\libclang.runtime.linux-x64\libclang.runtime.linux-x64.nuspec + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libClangSharp.runtime.linux-x64", "libClangSharp.runtime.linux-x64", "{3107B5D1-CB86-425E-B756-4FBCE9FB2A86}" + ProjectSection(SolutionItems) = preProject + packages\libClangSharp\libClangSharp.runtime.linux-x64\libClangSharp.runtime.linux-x64.nuspec = packages\libClangSharp\libClangSharp.runtime.linux-x64\libClangSharp.runtime.linux-x64.nuspec + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libClangSharp.runtime.osx-arm64", "libClangSharp.runtime.osx-arm64", "{A693E897-FFB9-4621-A2B1-030EAC9D0810}" + ProjectSection(SolutionItems) = preProject + packages\libClangSharp\libClangSharp.runtime.osx-arm64\libClangSharp.runtime.osx-arm64.nuspec = packages\libClangSharp\libClangSharp.runtime.osx-arm64\libClangSharp.runtime.osx-arm64.nuspec + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -271,6 +291,10 @@ Global {8FD0223B-88AD-4FA9-AE29-0B446FF17922} = {DFACF682-2673-4AE1-8F10-816D025C2D45} {B3A22C21-0699-4963-B665-F9AA74F0AF08} = {EDEC2130-DA14-4415-91A3-225733FB61F8} {034EBD16-E96F-4530-B37D-30B16C4E9876} = {FF42B475-5025-45BA-B278-60F29B53C023} + {7A12C7A3-3152-49C2-A831-3DA77922BF2A} = {DFACF682-2673-4AE1-8F10-816D025C2D45} + {1CA1A906-1A19-46D5-8AC4-87C13523899B} = {DFACF682-2673-4AE1-8F10-816D025C2D45} + {3107B5D1-CB86-425E-B756-4FBCE9FB2A86} = {EDEC2130-DA14-4415-91A3-225733FB61F8} + {A693E897-FFB9-4621-A2B1-030EAC9D0810} = {EDEC2130-DA14-4415-91A3-225733FB61F8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {A9D18E0B-5409-457D-B5F3-0E217136BB01} diff --git a/Directory.Build.props b/Directory.Build.props index a1e4d850..aeaec7f7 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -42,7 +42,7 @@ true $(BaseArtifactsPath)pkg/$(Configuration)/ ClangSharp - 14.0.0 + 15.0.0 rc1 pr diff --git a/Directory.Build.targets b/Directory.Build.targets index c2433f53..ad085668 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -33,8 +33,8 @@ - - + + diff --git a/README.md b/README.md index b77a370c..20ff7740 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ A convenience package which provides the native libClang library for several pla A helper package which exposes many Clang APIs missing from libClang is provided here: https://www.nuget.org/packages/libClangSharp -NOTE: libclang and libClangSharp are meta-packages which point to the platform-specific runtime packages ([e.g.](https://www.nuget.org/packages/libClangSharp.runtime.win-x64/14.0.0-beta1); see others owned by [tannergooding](https://www.nuget.org/profiles/tannergooding)). Several manual steps may be required to use them, see discussion in [#46](https://github.com/dotnet/ClangSharp/issues/46) and [#118](https://github.com/dotnet/ClangSharp/issues/118). +NOTE: libclang and libClangSharp are meta-packages which point to the platform-specific runtime packages ([e.g.](https://www.nuget.org/packages/libClangSharp.runtime.win-x64/15.0.0); see others owned by [tannergooding](https://www.nuget.org/profiles/tannergooding)). Several manual steps may be required to use them, see discussion in [#46](https://github.com/dotnet/ClangSharp/issues/46) and [#118](https://github.com/dotnet/ClangSharp/issues/118). Nightly packages are available via the NuGet Feed URL: https://pkgs.clangsharp.dev/index.json @@ -71,7 +71,7 @@ Building this requires [CMake 3.13 or later](https://cmake.org/download/) as wel To succesfully build `libClangSharp` you must first build Clang (https://clang.llvm.org/get_started.html). The process done on Windows is roughly: ```cmd -git clone --single-branch --branch llvmorg-14.0.0 https://github.com/llvm/llvm-project +git clone --single-branch --branch llvmorg-15.0.0 https://github.com/llvm/llvm-project cd llvm-project mkdir artifacts/bin cd artifacts/bin @@ -116,7 +116,7 @@ This program will take a given set of C or C++ header files and generate C# bind The simplest and recommended setup is to install the generator as a .NET tool and then use response files: ``` -dotnet tool install --global ClangSharpPInvokeGenerator --version 14.0.0-beta3 +dotnet tool install --global ClangSharpPInvokeGenerator --version 15.0.0 ClangSharpPInvokeGenerator @generate.rsp ``` diff --git a/packages/libClangSharp/libClangSharp.runtime.freebsd.12-x64/libClangSharp.runtime.freebsd.12-x64.nuspec b/packages/libClangSharp/libClangSharp.runtime.freebsd.12-x64/libClangSharp.runtime.freebsd.12-x64.nuspec index 50435f6e..340b699a 100644 --- a/packages/libClangSharp/libClangSharp.runtime.freebsd.12-x64/libClangSharp.runtime.freebsd.12-x64.nuspec +++ b/packages/libClangSharp/libClangSharp.runtime.freebsd.12-x64/libClangSharp.runtime.freebsd.12-x64.nuspec @@ -2,7 +2,7 @@ libClangSharp.runtime.freebsd.12-x64 - 14.0.0-beta1 + 15.0.0 Microsoft and Contributors Microsoft and Contributors true diff --git a/packages/libClangSharp/libClangSharp.runtime.freebsd.13-x64/libClangSharp.runtime.freebsd.13-x64.nuspec b/packages/libClangSharp/libClangSharp.runtime.freebsd.13-x64/libClangSharp.runtime.freebsd.13-x64.nuspec index 890dc5fe..def1c760 100644 --- a/packages/libClangSharp/libClangSharp.runtime.freebsd.13-x64/libClangSharp.runtime.freebsd.13-x64.nuspec +++ b/packages/libClangSharp/libClangSharp.runtime.freebsd.13-x64/libClangSharp.runtime.freebsd.13-x64.nuspec @@ -2,7 +2,7 @@ libClangSharp.runtime.freebsd.13-x64 - 14.0.0-beta1 + 15.0.0 Microsoft and Contributors Microsoft and Contributors true diff --git a/packages/libClangSharp/libClangSharp.runtime.linux-arm64/libClangSharp.runtime.linux-arm64.nuspec b/packages/libClangSharp/libClangSharp.runtime.linux-arm64/libClangSharp.runtime.linux-arm64.nuspec index 82dbaec5..fe3fdb41 100644 --- a/packages/libClangSharp/libClangSharp.runtime.linux-arm64/libClangSharp.runtime.linux-arm64.nuspec +++ b/packages/libClangSharp/libClangSharp.runtime.linux-arm64/libClangSharp.runtime.linux-arm64.nuspec @@ -2,7 +2,7 @@ libClangSharp.runtime.linux-arm64 - 14.0.0-beta1 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true diff --git a/packages/libClangSharp/libClangSharp.runtime.linux-x64/libClangSharp.runtime.linux-x64.nuspec b/packages/libClangSharp/libClangSharp.runtime.linux-x64/libClangSharp.runtime.linux-x64.nuspec new file mode 100644 index 00000000..4ba947e2 --- /dev/null +++ b/packages/libClangSharp/libClangSharp.runtime.linux-x64/libClangSharp.runtime.linux-x64.nuspec @@ -0,0 +1,20 @@ + + + + libClangSharp.runtime.linux-x64 + 15.0.0 + .NET Foundation and Contributors + .NET Foundation and Contributors + true + MIT + https://github.com/dotnet/clangsharp + linux x64 native library for libClangSharp. + Copyright © .NET Foundation and Contributors + + + + + + + + diff --git a/packages/libClangSharp/libClangSharp.runtime.osx-arm64/libClangSharp.runtime.osx-arm64.nuspec b/packages/libClangSharp/libClangSharp.runtime.osx-arm64/libClangSharp.runtime.osx-arm64.nuspec new file mode 100644 index 00000000..1835f880 --- /dev/null +++ b/packages/libClangSharp/libClangSharp.runtime.osx-arm64/libClangSharp.runtime.osx-arm64.nuspec @@ -0,0 +1,20 @@ + + + + libClangSharp.runtime.osx-arm64 + 15.0.0 + .NET Foundation and Contributors + .NET Foundation and Contributors + true + MIT + https://github.com/dotnet/clangsharp + osx arm64 native library for libClangSharp. + Copyright © .NET Foundation and Contributors + + + + + + + + diff --git a/packages/libClangSharp/libClangSharp.runtime.osx-x64/libClangSharp.runtime.osx-x64.nuspec b/packages/libClangSharp/libClangSharp.runtime.osx-x64/libClangSharp.runtime.osx-x64.nuspec index 29aa6e26..ac6bd3de 100644 --- a/packages/libClangSharp/libClangSharp.runtime.osx-x64/libClangSharp.runtime.osx-x64.nuspec +++ b/packages/libClangSharp/libClangSharp.runtime.osx-x64/libClangSharp.runtime.osx-x64.nuspec @@ -2,7 +2,7 @@ libClangSharp.runtime.osx-x64 - 14.0.0-beta1 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true diff --git a/packages/libClangSharp/libClangSharp.runtime.ubuntu.18.04-x64/libClangSharp.runtime.ubuntu.18.04-x64.nuspec b/packages/libClangSharp/libClangSharp.runtime.ubuntu.18.04-x64/libClangSharp.runtime.ubuntu.18.04-x64.nuspec index bc379b95..1751d148 100644 --- a/packages/libClangSharp/libClangSharp.runtime.ubuntu.18.04-x64/libClangSharp.runtime.ubuntu.18.04-x64.nuspec +++ b/packages/libClangSharp/libClangSharp.runtime.ubuntu.18.04-x64/libClangSharp.runtime.ubuntu.18.04-x64.nuspec @@ -2,7 +2,7 @@ libClangSharp.runtime.ubuntu.18.04-x64 - 14.0.0-beta1 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true diff --git a/packages/libClangSharp/libClangSharp.runtime.ubuntu.20.04-x64/libClangSharp.runtime.ubuntu.20.04-x64.nuspec b/packages/libClangSharp/libClangSharp.runtime.ubuntu.20.04-x64/libClangSharp.runtime.ubuntu.20.04-x64.nuspec index 9bdef46e..4d85a7ca 100644 --- a/packages/libClangSharp/libClangSharp.runtime.ubuntu.20.04-x64/libClangSharp.runtime.ubuntu.20.04-x64.nuspec +++ b/packages/libClangSharp/libClangSharp.runtime.ubuntu.20.04-x64/libClangSharp.runtime.ubuntu.20.04-x64.nuspec @@ -2,7 +2,7 @@ libClangSharp.runtime.ubuntu.20.04-x64 - 14.0.0-beta1 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true diff --git a/packages/libClangSharp/libClangSharp.runtime.ubuntu.21.10-x64/libClangSharp.runtime.ubuntu.21.10-x64.nuspec b/packages/libClangSharp/libClangSharp.runtime.ubuntu.22.04-x64/libClangSharp.runtime.ubuntu.22.04-x64.nuspec similarity index 78% rename from packages/libClangSharp/libClangSharp.runtime.ubuntu.21.10-x64/libClangSharp.runtime.ubuntu.21.10-x64.nuspec rename to packages/libClangSharp/libClangSharp.runtime.ubuntu.22.04-x64/libClangSharp.runtime.ubuntu.22.04-x64.nuspec index e07338da..6b6d18f8 100644 --- a/packages/libClangSharp/libClangSharp.runtime.ubuntu.21.10-x64/libClangSharp.runtime.ubuntu.21.10-x64.nuspec +++ b/packages/libClangSharp/libClangSharp.runtime.ubuntu.22.04-x64/libClangSharp.runtime.ubuntu.22.04-x64.nuspec @@ -1,20 +1,20 @@ - libClangSharp.runtime.ubuntu.21.10-x64 - 14.0.0-beta1 + libClangSharp.runtime.ubuntu.22.04-x64 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true MIT https://github.com/dotnet/clangsharp - ubuntu 21.10 x64 native library for libClangSharp. + ubuntu 22.04 x64 native library for libClangSharp. Copyright © .NET Foundation and Contributors - + diff --git a/packages/libClangSharp/libClangSharp.runtime.win-arm64/libClangSharp.runtime.win-arm64.nuspec b/packages/libClangSharp/libClangSharp.runtime.win-arm64/libClangSharp.runtime.win-arm64.nuspec index b14dc91d..8c6774e0 100644 --- a/packages/libClangSharp/libClangSharp.runtime.win-arm64/libClangSharp.runtime.win-arm64.nuspec +++ b/packages/libClangSharp/libClangSharp.runtime.win-arm64/libClangSharp.runtime.win-arm64.nuspec @@ -2,7 +2,7 @@ libClangSharp.runtime.win-arm64 - 14.0.0-beta1 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true diff --git a/packages/libClangSharp/libClangSharp.runtime.win-x64/libClangSharp.runtime.win-x64.nuspec b/packages/libClangSharp/libClangSharp.runtime.win-x64/libClangSharp.runtime.win-x64.nuspec index 7f701a3f..e04fbd79 100644 --- a/packages/libClangSharp/libClangSharp.runtime.win-x64/libClangSharp.runtime.win-x64.nuspec +++ b/packages/libClangSharp/libClangSharp.runtime.win-x64/libClangSharp.runtime.win-x64.nuspec @@ -2,7 +2,7 @@ libClangSharp.runtime.win-x64 - 14.0.0-beta1 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true diff --git a/packages/libClangSharp/libClangSharp.runtime.win-x86/libClangSharp.runtime.win-x86.nuspec b/packages/libClangSharp/libClangSharp.runtime.win-x86/libClangSharp.runtime.win-x86.nuspec index b7b2dcf9..bf3cbf61 100644 --- a/packages/libClangSharp/libClangSharp.runtime.win-x86/libClangSharp.runtime.win-x86.nuspec +++ b/packages/libClangSharp/libClangSharp.runtime.win-x86/libClangSharp.runtime.win-x86.nuspec @@ -2,7 +2,7 @@ libClangSharp.runtime.win-x86 - 14.0.0-beta1 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true diff --git a/packages/libClangSharp/libClangSharp/libClangSharp.nuspec b/packages/libClangSharp/libClangSharp/libClangSharp.nuspec index 51ad6b10..81ed9464 100644 --- a/packages/libClangSharp/libClangSharp/libClangSharp.nuspec +++ b/packages/libClangSharp/libClangSharp/libClangSharp.nuspec @@ -2,7 +2,7 @@ libClangSharp - 14.0.0-beta1 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true @@ -12,9 +12,6 @@ Copyright © .NET Foundation and Contributors - - - diff --git a/packages/libClangSharp/libClangSharp/runtime.json b/packages/libClangSharp/libClangSharp/runtime.json index 680eaae4..1f416faf 100644 --- a/packages/libClangSharp/libClangSharp/runtime.json +++ b/packages/libClangSharp/libClangSharp/runtime.json @@ -2,52 +2,62 @@ "runtimes": { "freebsd.12-x64": { "libClangSharp": { - "libClangSharp.runtime.freebsd.12-x64": "14.0.0-beta1" + "libClangSharp.runtime.freebsd.12-x64": "15.0.0" } }, "freebsd.13-x64": { "libClangSharp": { - "libClangSharp.runtime.freebsd.13-x64": "14.0.0-beta1" + "libClangSharp.runtime.freebsd.13-x64": "15.0.0" } }, "linux-arm64": { "libClangSharp": { - "libClangSharp.runtime.linux-arm64": "14.0.0-beta1" + "libClangSharp.runtime.linux-arm64": "15.0.0" + } + }, + "linux-x64": { + "libClangSharp": { + "libClangSharp.runtime.linux-x64": "15.0.0" + } + }, + "osx-arm64": { + "libClangSharp": { + "libClangSharp.runtime.osx-arm64": "15.0.0" } }, "osx-x64": { "libClangSharp": { - "libClangSharp.runtime.osx-x64": "14.0.0-beta1" + "libClangSharp.runtime.osx-x64": "15.0.0" } }, "ubuntu.18.04-x64": { "libClangSharp": { - "libClangSharp.runtime.ubuntu.18.04-x64": "14.0.0-beta1" + "libClangSharp.runtime.ubuntu.18.04-x64": "15.0.0" } }, "ubuntu.20.04-x64": { "libClangSharp": { - "libClangSharp.runtime.ubuntu.20.04-x64": "14.0.0-beta1" + "libClangSharp.runtime.ubuntu.20.04-x64": "15.0.0" } }, - "ubuntu.21.10-x64": { + "ubuntu.22.04-x64": { "libClangSharp": { - "libClangSharp.runtime.ubuntu.21.10-x64": "14.0.0-beta1" + "libClangSharp.runtime.ubuntu.22.04-x64": "15.0.0" } }, "win-arm64": { "libClangSharp": { - "libClangSharp.runtime.win-arm64": "14.0.0-beta1" + "libClangSharp.runtime.win-arm64": "15.0.0" } }, "win-x64": { "libClangSharp": { - "libClangSharp.runtime.win-x64": "14.0.0-beta1" + "libClangSharp.runtime.win-x64": "15.0.0" } }, "win-x86": { "libClangSharp": { - "libClangSharp.runtime.win-x86": "14.0.0-beta1" + "libClangSharp.runtime.win-x86": "15.0.0" } } } diff --git a/packages/libclang/libclang.runtime.freebsd.12-x64/libclang.runtime.freebsd.12-x64.nuspec b/packages/libclang/libclang.runtime.freebsd.12-x64/libclang.runtime.freebsd.12-x64.nuspec index b12c2270..64fa87db 100644 --- a/packages/libclang/libclang.runtime.freebsd.12-x64/libclang.runtime.freebsd.12-x64.nuspec +++ b/packages/libclang/libclang.runtime.freebsd.12-x64/libclang.runtime.freebsd.12-x64.nuspec @@ -2,7 +2,7 @@ libclang.runtime.freebsd.12-x64 - 14.0.0 + 15.0.0 Microsoft and Contributors Microsoft and Contributors true @@ -10,7 +10,7 @@ https://github.com/dotnet/clangsharp freebsd 12 x64 native library for libclang. Copyright © LLVM Project - + diff --git a/packages/libclang/libclang.runtime.freebsd.13-x64/libclang.runtime.freebsd.13-x64.nuspec b/packages/libclang/libclang.runtime.freebsd.13-x64/libclang.runtime.freebsd.13-x64.nuspec index a9d2fa4f..d5d6e516 100644 --- a/packages/libclang/libclang.runtime.freebsd.13-x64/libclang.runtime.freebsd.13-x64.nuspec +++ b/packages/libclang/libclang.runtime.freebsd.13-x64/libclang.runtime.freebsd.13-x64.nuspec @@ -2,7 +2,7 @@ libclang.runtime.freebsd.13-x64 - 14.0.0 + 15.0.0 Microsoft and Contributors Microsoft and Contributors true @@ -10,7 +10,7 @@ https://github.com/dotnet/clangsharp freebsd 13 x64 native library for libclang. Copyright © LLVM Project - + diff --git a/packages/libclang/libclang.runtime.linux-arm64/libclang.runtime.linux-arm64.nuspec b/packages/libclang/libclang.runtime.linux-arm64/libclang.runtime.linux-arm64.nuspec index 2fc218e5..59cd3d07 100644 --- a/packages/libclang/libclang.runtime.linux-arm64/libclang.runtime.linux-arm64.nuspec +++ b/packages/libclang/libclang.runtime.linux-arm64/libclang.runtime.linux-arm64.nuspec @@ -2,7 +2,7 @@ libclang.runtime.linux-arm64 - 14.0.0 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true @@ -10,7 +10,7 @@ https://github.com/dotnet/clangsharp linux arm64 native library for libclang. Copyright © LLVM Project - + diff --git a/packages/libclang/libclang.runtime.linux-x64/libclang.runtime.linux-x64.nuspec b/packages/libclang/libclang.runtime.linux-x64/libclang.runtime.linux-x64.nuspec new file mode 100644 index 00000000..98cce586 --- /dev/null +++ b/packages/libclang/libclang.runtime.linux-x64/libclang.runtime.linux-x64.nuspec @@ -0,0 +1,19 @@ + + + + libclang.runtime.linux-x64 + 15.0.0 + .NET Foundation and Contributors + .NET Foundation and Contributors + true + Apache-2.0 WITH LLVM-exception + https://github.com/dotnet/clangsharp + linux x64 native library for libclang. + Copyright © LLVM Project + + + + + + + diff --git a/packages/libclang/libclang.runtime.osx-arm64/libclang.runtime.osx-arm64.nuspec b/packages/libclang/libclang.runtime.osx-arm64/libclang.runtime.osx-arm64.nuspec new file mode 100644 index 00000000..2eeb5a0a --- /dev/null +++ b/packages/libclang/libclang.runtime.osx-arm64/libclang.runtime.osx-arm64.nuspec @@ -0,0 +1,19 @@ + + + + libclang.runtime.osx-arm64 + 15.0.0 + .NET Foundation and Contributors + .NET Foundation and Contributors + true + Apache-2.0 WITH LLVM-exception + https://github.com/dotnet/clangsharp + osx arm64 native library for libclang. + Copyright © LLVM Project + + + + + + + diff --git a/packages/libclang/libclang.runtime.osx-x64/libclang.runtime.osx-x64.nuspec b/packages/libclang/libclang.runtime.osx-x64/libclang.runtime.osx-x64.nuspec index 09eb4714..27b5c62a 100644 --- a/packages/libclang/libclang.runtime.osx-x64/libclang.runtime.osx-x64.nuspec +++ b/packages/libclang/libclang.runtime.osx-x64/libclang.runtime.osx-x64.nuspec @@ -2,7 +2,7 @@ libclang.runtime.osx-x64 - 14.0.0 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true @@ -10,7 +10,7 @@ https://github.com/dotnet/clangsharp osx x64 native library for libclang. Copyright © LLVM Project - + diff --git a/packages/libclang/libclang.runtime.ubuntu.18.04-x64/libclang.runtime.ubuntu.18.04-x64.nuspec b/packages/libclang/libclang.runtime.ubuntu.18.04-x64/libclang.runtime.ubuntu.18.04-x64.nuspec index 564cb8c6..10cbb23d 100644 --- a/packages/libclang/libclang.runtime.ubuntu.18.04-x64/libclang.runtime.ubuntu.18.04-x64.nuspec +++ b/packages/libclang/libclang.runtime.ubuntu.18.04-x64/libclang.runtime.ubuntu.18.04-x64.nuspec @@ -2,7 +2,7 @@ libclang.runtime.ubuntu.18.04-x64 - 14.0.0 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true @@ -10,7 +10,7 @@ https://github.com/dotnet/clangsharp ubuntu 18.04 x64 native library for libclang. Copyright © LLVM Project - + diff --git a/packages/libclang/libclang.runtime.ubuntu.20.04-x64/libclang.runtime.ubuntu.20.04-x64.nuspec b/packages/libclang/libclang.runtime.ubuntu.20.04-x64/libclang.runtime.ubuntu.20.04-x64.nuspec index 01a27106..54a4e942 100644 --- a/packages/libclang/libclang.runtime.ubuntu.20.04-x64/libclang.runtime.ubuntu.20.04-x64.nuspec +++ b/packages/libclang/libclang.runtime.ubuntu.20.04-x64/libclang.runtime.ubuntu.20.04-x64.nuspec @@ -2,7 +2,7 @@ libclang.runtime.ubuntu.20.04-x64 - 14.0.0 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true @@ -10,7 +10,7 @@ https://github.com/dotnet/clangsharp ubuntu 20.04 x64 native library for libclang. Copyright © LLVM Project - + diff --git a/packages/libclang/libclang.runtime.ubuntu.21.10-x64/libclang.runtime.ubuntu.21.10-x64.nuspec b/packages/libclang/libclang.runtime.ubuntu.22.04-x64/libclang.runtime.ubuntu.22.04-x64.nuspec similarity index 75% rename from packages/libclang/libclang.runtime.ubuntu.21.10-x64/libclang.runtime.ubuntu.21.10-x64.nuspec rename to packages/libclang/libclang.runtime.ubuntu.22.04-x64/libclang.runtime.ubuntu.22.04-x64.nuspec index d82a90a0..d573b8ab 100644 --- a/packages/libclang/libclang.runtime.ubuntu.21.10-x64/libclang.runtime.ubuntu.21.10-x64.nuspec +++ b/packages/libclang/libclang.runtime.ubuntu.22.04-x64/libclang.runtime.ubuntu.22.04-x64.nuspec @@ -1,19 +1,19 @@ - libclang.runtime.ubuntu.21.10-x64 - 14.0.0 + libclang.runtime.ubuntu.22.04-x64 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true Apache-2.0 WITH LLVM-exception https://github.com/dotnet/clangsharp - ubuntu 21.10 x64 native library for libclang. + ubuntu 22.04 x64 native library for libclang. Copyright © LLVM Project - + - + diff --git a/packages/libclang/libclang.runtime.win-arm64/libclang.runtime.win-arm64.nuspec b/packages/libclang/libclang.runtime.win-arm64/libclang.runtime.win-arm64.nuspec index 6e9be542..5dce19c2 100644 --- a/packages/libclang/libclang.runtime.win-arm64/libclang.runtime.win-arm64.nuspec +++ b/packages/libclang/libclang.runtime.win-arm64/libclang.runtime.win-arm64.nuspec @@ -2,7 +2,7 @@ libclang.runtime.win-arm64 - 14.0.0 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true @@ -10,7 +10,7 @@ https://github.com/dotnet/clangsharp win arm64 native library for libclang. Copyright © LLVM Project - + diff --git a/packages/libclang/libclang.runtime.win-x64/libclang.runtime.win-x64.nuspec b/packages/libclang/libclang.runtime.win-x64/libclang.runtime.win-x64.nuspec index b92dd1c1..ab14e5e7 100644 --- a/packages/libclang/libclang.runtime.win-x64/libclang.runtime.win-x64.nuspec +++ b/packages/libclang/libclang.runtime.win-x64/libclang.runtime.win-x64.nuspec @@ -2,7 +2,7 @@ libclang.runtime.win-x64 - 14.0.0 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true @@ -10,7 +10,7 @@ https://github.com/dotnet/clangsharp win x64 native library for libclang. Copyright © LLVM Project - + diff --git a/packages/libclang/libclang.runtime.win-x86/libclang.runtime.win-x86.nuspec b/packages/libclang/libclang.runtime.win-x86/libclang.runtime.win-x86.nuspec index a980c73e..01690cf3 100644 --- a/packages/libclang/libclang.runtime.win-x86/libclang.runtime.win-x86.nuspec +++ b/packages/libclang/libclang.runtime.win-x86/libclang.runtime.win-x86.nuspec @@ -2,7 +2,7 @@ libclang.runtime.win-x86 - 14.0.0 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true @@ -10,7 +10,7 @@ https://github.com/dotnet/clangsharp win x86 native library for libclang. Copyright © LLVM Project - + diff --git a/packages/libclang/libclang/LICENSE.TXT b/packages/libclang/libclang/LICENSE.TXT index 24806ab4..57151765 100644 --- a/packages/libclang/libclang/LICENSE.TXT +++ b/packages/libclang/libclang/LICENSE.TXT @@ -239,7 +239,7 @@ Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy): University of Illinois/NCSA Open Source License -Copyright (c) 2007-2019 University of Illinois at Urbana-Champaign. +Copyright (c) 2003-2019 University of Illinois at Urbana-Champaign. All rights reserved. Developed by: diff --git a/packages/libclang/libclang/libclang.nuspec b/packages/libclang/libclang/libclang.nuspec index 9b7c68b9..d43eb5e9 100644 --- a/packages/libclang/libclang/libclang.nuspec +++ b/packages/libclang/libclang/libclang.nuspec @@ -2,7 +2,7 @@ libclang - 14.0.0 + 15.0.0 .NET Foundation and Contributors .NET Foundation and Contributors true @@ -10,11 +10,8 @@ https://github.com/dotnet/clangsharp Multi-platform native library for libclang. Copyright © LLVM Project - + - - - diff --git a/packages/libclang/libclang/runtime.json b/packages/libclang/libclang/runtime.json index 68a6757b..dce538fb 100644 --- a/packages/libclang/libclang/runtime.json +++ b/packages/libclang/libclang/runtime.json @@ -2,52 +2,62 @@ "runtimes": { "freebsd.12-x64": { "libclang": { - "libclang.runtime.freebsd.12-x64": "14.0.0" + "libclang.runtime.freebsd.12-x64": "15.0.0" } }, "freebsd.13-x64": { "libclang": { - "libclang.runtime.freebsd.13-x64": "14.0.0" + "libclang.runtime.freebsd.13-x64": "15.0.0" } }, "linux-arm64": { "libclang": { - "libclang.runtime.linux-arm64": "14.0.0" + "libclang.runtime.linux-arm64": "15.0.0" + } + }, + "linux-x64": { + "libclang": { + "libclang.runtime.linux-x64": "15.0.0" + } + }, + "osx-arm64": { + "libclang": { + "libclang.runtime.osx-arm64": "15.0.0" } }, "osx-x64": { "libclang": { - "libclang.runtime.osx-x64": "14.0.0" + "libclang.runtime.osx-x64": "15.0.0" } }, "ubuntu.18.04-x64": { "libclang": { - "libclang.runtime.ubuntu.18.04-x64": "14.0.0" + "libclang.runtime.ubuntu.18.04-x64": "15.0.0" } }, "ubuntu.20.04-x64": { "libclang": { - "libclang.runtime.ubuntu.20.04-x64": "14.0.0" + "libclang.runtime.ubuntu.20.04-x64": "15.0.0" } }, - "ubuntu.21.10-x64": { + "ubuntu.22.04-x64": { "libclang": { - "libclang.runtime.ubuntu.21.10-x64": "14.0.0" + "libclang.runtime.ubuntu.22.04-x64": "15.0.0" } }, "win-arm64": { "libclang": { - "libclang.runtime.win-arm64": "14.0.0" + "libclang.runtime.win-arm64": "15.0.0" } }, "win-x64": { "libclang": { - "libclang.runtime.win-x64": "14.0.0" + "libclang.runtime.win-x64": "15.0.0" } }, "win-x86": { "libclang": { - "libclang.runtime.win-x86": "14.0.0" + "libclang.runtime.win-x86": "15.0.0" } } } diff --git a/sources/ClangSharp.Interop/CXAvailabilityKind.cs b/sources/ClangSharp.Interop/CXAvailabilityKind.cs index 463b6d4a..f2c076af 100644 --- a/sources/ClangSharp.Interop/CXAvailabilityKind.cs +++ b/sources/ClangSharp.Interop/CXAvailabilityKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCallingConv.cs b/sources/ClangSharp.Interop/CXCallingConv.cs index b6614aa4..6db8e257 100644 --- a/sources/ClangSharp.Interop/CXCallingConv.cs +++ b/sources/ClangSharp.Interop/CXCallingConv.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXChildVisitResult.cs b/sources/ClangSharp.Interop/CXChildVisitResult.cs index 20405710..6b4a39d2 100644 --- a/sources/ClangSharp.Interop/CXChildVisitResult.cs +++ b/sources/ClangSharp.Interop/CXChildVisitResult.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCodeCompleteResults.cs b/sources/ClangSharp.Interop/CXCodeCompleteResults.cs index ed1b5ad0..ad36429c 100644 --- a/sources/ClangSharp.Interop/CXCodeCompleteResults.cs +++ b/sources/ClangSharp.Interop/CXCodeCompleteResults.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCodeComplete_Flags.cs b/sources/ClangSharp.Interop/CXCodeComplete_Flags.cs index b2186a94..33e37cb5 100644 --- a/sources/ClangSharp.Interop/CXCodeComplete_Flags.cs +++ b/sources/ClangSharp.Interop/CXCodeComplete_Flags.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXComment.cs b/sources/ClangSharp.Interop/CXComment.cs index a623e7ba..7db6e596 100644 --- a/sources/ClangSharp.Interop/CXComment.cs +++ b/sources/ClangSharp.Interop/CXComment.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCommentInlineCommandRenderKind.cs b/sources/ClangSharp.Interop/CXCommentInlineCommandRenderKind.cs index de769b0c..9f9e8280 100644 --- a/sources/ClangSharp.Interop/CXCommentInlineCommandRenderKind.cs +++ b/sources/ClangSharp.Interop/CXCommentInlineCommandRenderKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCommentKind.cs b/sources/ClangSharp.Interop/CXCommentKind.cs index 60909df0..f416866d 100644 --- a/sources/ClangSharp.Interop/CXCommentKind.cs +++ b/sources/ClangSharp.Interop/CXCommentKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCommentParamPassDirection.cs b/sources/ClangSharp.Interop/CXCommentParamPassDirection.cs index 6a1e667c..38e15ded 100644 --- a/sources/ClangSharp.Interop/CXCommentParamPassDirection.cs +++ b/sources/ClangSharp.Interop/CXCommentParamPassDirection.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCompilationDatabase_Error.cs b/sources/ClangSharp.Interop/CXCompilationDatabase_Error.cs index fe30ede2..4b3e1fc3 100644 --- a/sources/ClangSharp.Interop/CXCompilationDatabase_Error.cs +++ b/sources/ClangSharp.Interop/CXCompilationDatabase_Error.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCompletionChunkKind.cs b/sources/ClangSharp.Interop/CXCompletionChunkKind.cs index 98bdaa9f..b7281b90 100644 --- a/sources/ClangSharp.Interop/CXCompletionChunkKind.cs +++ b/sources/ClangSharp.Interop/CXCompletionChunkKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCompletionContext.cs b/sources/ClangSharp.Interop/CXCompletionContext.cs index 7fc5e4fa..ce038ce3 100644 --- a/sources/ClangSharp.Interop/CXCompletionContext.cs +++ b/sources/ClangSharp.Interop/CXCompletionContext.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCompletionResult.cs b/sources/ClangSharp.Interop/CXCompletionResult.cs index 811dc9fe..43635e5e 100644 --- a/sources/ClangSharp.Interop/CXCompletionResult.cs +++ b/sources/ClangSharp.Interop/CXCompletionResult.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCursor.cs b/sources/ClangSharp.Interop/CXCursor.cs index 51314399..0b77825a 100644 --- a/sources/ClangSharp.Interop/CXCursor.cs +++ b/sources/ClangSharp.Interop/CXCursor.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCursorAndRangeVisitor.cs b/sources/ClangSharp.Interop/CXCursorAndRangeVisitor.cs index 9dec40af..90b94211 100644 --- a/sources/ClangSharp.Interop/CXCursorAndRangeVisitor.cs +++ b/sources/ClangSharp.Interop/CXCursorAndRangeVisitor.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using System; diff --git a/sources/ClangSharp.Interop/CXCursorKind.cs b/sources/ClangSharp.Interop/CXCursorKind.cs index 2f9c2004..7cea5489 100644 --- a/sources/ClangSharp.Interop/CXCursorKind.cs +++ b/sources/ClangSharp.Interop/CXCursorKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCursorSetImpl.cs b/sources/ClangSharp.Interop/CXCursorSetImpl.cs index ecdcea20..e3156661 100644 --- a/sources/ClangSharp.Interop/CXCursorSetImpl.cs +++ b/sources/ClangSharp.Interop/CXCursorSetImpl.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXCursorVisitor.cs b/sources/ClangSharp.Interop/CXCursorVisitor.cs index d5be796a..001e10c3 100644 --- a/sources/ClangSharp.Interop/CXCursorVisitor.cs +++ b/sources/ClangSharp.Interop/CXCursorVisitor.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using System.Runtime.InteropServices; diff --git a/sources/ClangSharp.Interop/CXCursor_ExceptionSpecificationKind.cs b/sources/ClangSharp.Interop/CXCursor_ExceptionSpecificationKind.cs index a7684407..5eed6f8c 100644 --- a/sources/ClangSharp.Interop/CXCursor_ExceptionSpecificationKind.cs +++ b/sources/ClangSharp.Interop/CXCursor_ExceptionSpecificationKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXDiagnosticDisplayOptions.cs b/sources/ClangSharp.Interop/CXDiagnosticDisplayOptions.cs index d280514b..e5f13fb2 100644 --- a/sources/ClangSharp.Interop/CXDiagnosticDisplayOptions.cs +++ b/sources/ClangSharp.Interop/CXDiagnosticDisplayOptions.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXDiagnosticSeverity.cs b/sources/ClangSharp.Interop/CXDiagnosticSeverity.cs index 0635bd08..49a021aa 100644 --- a/sources/ClangSharp.Interop/CXDiagnosticSeverity.cs +++ b/sources/ClangSharp.Interop/CXDiagnosticSeverity.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXErrorCode.cs b/sources/ClangSharp.Interop/CXErrorCode.cs index c1545866..3ff4d5c0 100644 --- a/sources/ClangSharp.Interop/CXErrorCode.cs +++ b/sources/ClangSharp.Interop/CXErrorCode.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXEvalResultKind.cs b/sources/ClangSharp.Interop/CXEvalResultKind.cs index a873fcd1..5ec32ab4 100644 --- a/sources/ClangSharp.Interop/CXEvalResultKind.cs +++ b/sources/ClangSharp.Interop/CXEvalResultKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXFieldVisitor.cs b/sources/ClangSharp.Interop/CXFieldVisitor.cs index dc8a993c..893b1870 100644 --- a/sources/ClangSharp.Interop/CXFieldVisitor.cs +++ b/sources/ClangSharp.Interop/CXFieldVisitor.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using System.Runtime.InteropServices; diff --git a/sources/ClangSharp.Interop/CXFileUniqueID.cs b/sources/ClangSharp.Interop/CXFileUniqueID.cs index f75e074b..cedc8079 100644 --- a/sources/ClangSharp.Interop/CXFileUniqueID.cs +++ b/sources/ClangSharp.Interop/CXFileUniqueID.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXGlobalOptFlags.cs b/sources/ClangSharp.Interop/CXGlobalOptFlags.cs index 4d663842..979288ca 100644 --- a/sources/ClangSharp.Interop/CXGlobalOptFlags.cs +++ b/sources/ClangSharp.Interop/CXGlobalOptFlags.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxAttrInfo.cs b/sources/ClangSharp.Interop/CXIdxAttrInfo.cs index 03522a0a..dc2087cd 100644 --- a/sources/ClangSharp.Interop/CXIdxAttrInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxAttrInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxAttrKind.cs b/sources/ClangSharp.Interop/CXIdxAttrKind.cs index b65c1fe2..6b60b5af 100644 --- a/sources/ClangSharp.Interop/CXIdxAttrKind.cs +++ b/sources/ClangSharp.Interop/CXIdxAttrKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxBaseClassInfo.cs b/sources/ClangSharp.Interop/CXIdxBaseClassInfo.cs index ed98fdd8..bade6a6e 100644 --- a/sources/ClangSharp.Interop/CXIdxBaseClassInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxBaseClassInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxCXXClassDeclInfo.cs b/sources/ClangSharp.Interop/CXIdxCXXClassDeclInfo.cs index 745d41b6..cc01747d 100644 --- a/sources/ClangSharp.Interop/CXIdxCXXClassDeclInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxCXXClassDeclInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxContainerInfo.cs b/sources/ClangSharp.Interop/CXIdxContainerInfo.cs index 968a453c..675166ee 100644 --- a/sources/ClangSharp.Interop/CXIdxContainerInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxContainerInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxDeclInfo.cs b/sources/ClangSharp.Interop/CXIdxDeclInfo.cs index cf4c7ab8..4c64f560 100644 --- a/sources/ClangSharp.Interop/CXIdxDeclInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxDeclInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxDeclInfoFlags.cs b/sources/ClangSharp.Interop/CXIdxDeclInfoFlags.cs index ece114b7..fc740c13 100644 --- a/sources/ClangSharp.Interop/CXIdxDeclInfoFlags.cs +++ b/sources/ClangSharp.Interop/CXIdxDeclInfoFlags.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxEntityCXXTemplateKind.cs b/sources/ClangSharp.Interop/CXIdxEntityCXXTemplateKind.cs index 8e889d8e..d39130a9 100644 --- a/sources/ClangSharp.Interop/CXIdxEntityCXXTemplateKind.cs +++ b/sources/ClangSharp.Interop/CXIdxEntityCXXTemplateKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxEntityInfo.cs b/sources/ClangSharp.Interop/CXIdxEntityInfo.cs index d34cd877..e52978b0 100644 --- a/sources/ClangSharp.Interop/CXIdxEntityInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxEntityInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxEntityKind.cs b/sources/ClangSharp.Interop/CXIdxEntityKind.cs index e4b58e2f..e48240b8 100644 --- a/sources/ClangSharp.Interop/CXIdxEntityKind.cs +++ b/sources/ClangSharp.Interop/CXIdxEntityKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxEntityLanguage.cs b/sources/ClangSharp.Interop/CXIdxEntityLanguage.cs index 6cf0251d..d99e56a9 100644 --- a/sources/ClangSharp.Interop/CXIdxEntityLanguage.cs +++ b/sources/ClangSharp.Interop/CXIdxEntityLanguage.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxEntityRefInfo.cs b/sources/ClangSharp.Interop/CXIdxEntityRefInfo.cs index 53324e06..2dce640a 100644 --- a/sources/ClangSharp.Interop/CXIdxEntityRefInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxEntityRefInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxEntityRefKind.cs b/sources/ClangSharp.Interop/CXIdxEntityRefKind.cs index 521757e6..73296e79 100644 --- a/sources/ClangSharp.Interop/CXIdxEntityRefKind.cs +++ b/sources/ClangSharp.Interop/CXIdxEntityRefKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxIBOutletCollectionAttrInfo.cs b/sources/ClangSharp.Interop/CXIdxIBOutletCollectionAttrInfo.cs index cd07a065..29c933e4 100644 --- a/sources/ClangSharp.Interop/CXIdxIBOutletCollectionAttrInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxIBOutletCollectionAttrInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxImportedASTFileInfo.cs b/sources/ClangSharp.Interop/CXIdxImportedASTFileInfo.cs index 2c5f5cfa..3aa59ca0 100644 --- a/sources/ClangSharp.Interop/CXIdxImportedASTFileInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxImportedASTFileInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxIncludedFileInfo.cs b/sources/ClangSharp.Interop/CXIdxIncludedFileInfo.cs index c5c1beb3..26f8fe78 100644 --- a/sources/ClangSharp.Interop/CXIdxIncludedFileInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxIncludedFileInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxLoc.cs b/sources/ClangSharp.Interop/CXIdxLoc.cs index 56329496..759dbaf7 100644 --- a/sources/ClangSharp.Interop/CXIdxLoc.cs +++ b/sources/ClangSharp.Interop/CXIdxLoc.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxObjCCategoryDeclInfo.cs b/sources/ClangSharp.Interop/CXIdxObjCCategoryDeclInfo.cs index 387c14e7..9159a957 100644 --- a/sources/ClangSharp.Interop/CXIdxObjCCategoryDeclInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxObjCCategoryDeclInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxObjCContainerDeclInfo.cs b/sources/ClangSharp.Interop/CXIdxObjCContainerDeclInfo.cs index ecf97ea2..4d0058c1 100644 --- a/sources/ClangSharp.Interop/CXIdxObjCContainerDeclInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxObjCContainerDeclInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxObjCContainerKind.cs b/sources/ClangSharp.Interop/CXIdxObjCContainerKind.cs index 0082e8bc..0b18a9f0 100644 --- a/sources/ClangSharp.Interop/CXIdxObjCContainerKind.cs +++ b/sources/ClangSharp.Interop/CXIdxObjCContainerKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxObjCInterfaceDeclInfo.cs b/sources/ClangSharp.Interop/CXIdxObjCInterfaceDeclInfo.cs index 25629cb6..7a3be461 100644 --- a/sources/ClangSharp.Interop/CXIdxObjCInterfaceDeclInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxObjCInterfaceDeclInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxObjCPropertyDeclInfo.cs b/sources/ClangSharp.Interop/CXIdxObjCPropertyDeclInfo.cs index b8af313e..c6537367 100644 --- a/sources/ClangSharp.Interop/CXIdxObjCPropertyDeclInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxObjCPropertyDeclInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxObjCProtocolRefInfo.cs b/sources/ClangSharp.Interop/CXIdxObjCProtocolRefInfo.cs index 18c7ab38..9c915238 100644 --- a/sources/ClangSharp.Interop/CXIdxObjCProtocolRefInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxObjCProtocolRefInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXIdxObjCProtocolRefListInfo.cs b/sources/ClangSharp.Interop/CXIdxObjCProtocolRefListInfo.cs index dba5e216..0e6ee88c 100644 --- a/sources/ClangSharp.Interop/CXIdxObjCProtocolRefListInfo.cs +++ b/sources/ClangSharp.Interop/CXIdxObjCProtocolRefListInfo.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXInclusionVisitor.cs b/sources/ClangSharp.Interop/CXInclusionVisitor.cs index bdb71e51..01a3ea4c 100644 --- a/sources/ClangSharp.Interop/CXInclusionVisitor.cs +++ b/sources/ClangSharp.Interop/CXInclusionVisitor.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using System.Runtime.InteropServices; diff --git a/sources/ClangSharp.Interop/CXIndexOptFlags.cs b/sources/ClangSharp.Interop/CXIndexOptFlags.cs index 3268b222..6b2372bc 100644 --- a/sources/ClangSharp.Interop/CXIndexOptFlags.cs +++ b/sources/ClangSharp.Interop/CXIndexOptFlags.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXLanguageKind.cs b/sources/ClangSharp.Interop/CXLanguageKind.cs index 4cf8e6ff..311b8d46 100644 --- a/sources/ClangSharp.Interop/CXLanguageKind.cs +++ b/sources/ClangSharp.Interop/CXLanguageKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXLinkageKind.cs b/sources/ClangSharp.Interop/CXLinkageKind.cs index c8ed7fed..19582bdf 100644 --- a/sources/ClangSharp.Interop/CXLinkageKind.cs +++ b/sources/ClangSharp.Interop/CXLinkageKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXLoadDiag_Error.cs b/sources/ClangSharp.Interop/CXLoadDiag_Error.cs index a0a8a3f6..f34dc015 100644 --- a/sources/ClangSharp.Interop/CXLoadDiag_Error.cs +++ b/sources/ClangSharp.Interop/CXLoadDiag_Error.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXModuleMapDescriptorImpl.cs b/sources/ClangSharp.Interop/CXModuleMapDescriptorImpl.cs index 566fb33d..df18c491 100644 --- a/sources/ClangSharp.Interop/CXModuleMapDescriptorImpl.cs +++ b/sources/ClangSharp.Interop/CXModuleMapDescriptorImpl.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXNameRefFlags.cs b/sources/ClangSharp.Interop/CXNameRefFlags.cs index 11440965..0854aab4 100644 --- a/sources/ClangSharp.Interop/CXNameRefFlags.cs +++ b/sources/ClangSharp.Interop/CXNameRefFlags.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXObjCDeclQualifierKind.cs b/sources/ClangSharp.Interop/CXObjCDeclQualifierKind.cs index 820c6c7c..7b7f0814 100644 --- a/sources/ClangSharp.Interop/CXObjCDeclQualifierKind.cs +++ b/sources/ClangSharp.Interop/CXObjCDeclQualifierKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXObjCPropertyAttrKind.cs b/sources/ClangSharp.Interop/CXObjCPropertyAttrKind.cs index 526615de..b9584a7a 100644 --- a/sources/ClangSharp.Interop/CXObjCPropertyAttrKind.cs +++ b/sources/ClangSharp.Interop/CXObjCPropertyAttrKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXPlatformAvailability.cs b/sources/ClangSharp.Interop/CXPlatformAvailability.cs index f248b9e2..3520ca16 100644 --- a/sources/ClangSharp.Interop/CXPlatformAvailability.cs +++ b/sources/ClangSharp.Interop/CXPlatformAvailability.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXPrintingPolicyProperty.cs b/sources/ClangSharp.Interop/CXPrintingPolicyProperty.cs index ea24c50e..4397b8c3 100644 --- a/sources/ClangSharp.Interop/CXPrintingPolicyProperty.cs +++ b/sources/ClangSharp.Interop/CXPrintingPolicyProperty.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXRefQualifierKind.cs b/sources/ClangSharp.Interop/CXRefQualifierKind.cs index a076b1b5..b10c27b5 100644 --- a/sources/ClangSharp.Interop/CXRefQualifierKind.cs +++ b/sources/ClangSharp.Interop/CXRefQualifierKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXReparse_Flags.cs b/sources/ClangSharp.Interop/CXReparse_Flags.cs index 4dfa3a01..822c3321 100644 --- a/sources/ClangSharp.Interop/CXReparse_Flags.cs +++ b/sources/ClangSharp.Interop/CXReparse_Flags.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXResult.cs b/sources/ClangSharp.Interop/CXResult.cs index 80c7c445..55ef6b65 100644 --- a/sources/ClangSharp.Interop/CXResult.cs +++ b/sources/ClangSharp.Interop/CXResult.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXSaveError.cs b/sources/ClangSharp.Interop/CXSaveError.cs index d22f73f9..e7881ffb 100644 --- a/sources/ClangSharp.Interop/CXSaveError.cs +++ b/sources/ClangSharp.Interop/CXSaveError.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXSaveTranslationUnit_Flags.cs b/sources/ClangSharp.Interop/CXSaveTranslationUnit_Flags.cs index 5c35b3ef..ee1f1972 100644 --- a/sources/ClangSharp.Interop/CXSaveTranslationUnit_Flags.cs +++ b/sources/ClangSharp.Interop/CXSaveTranslationUnit_Flags.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXSourceLocation.cs b/sources/ClangSharp.Interop/CXSourceLocation.cs index ba6dcd9b..b57eb11f 100644 --- a/sources/ClangSharp.Interop/CXSourceLocation.cs +++ b/sources/ClangSharp.Interop/CXSourceLocation.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXSourceRange.cs b/sources/ClangSharp.Interop/CXSourceRange.cs index 28e69953..4ea9fbe5 100644 --- a/sources/ClangSharp.Interop/CXSourceRange.cs +++ b/sources/ClangSharp.Interop/CXSourceRange.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXSourceRangeList.cs b/sources/ClangSharp.Interop/CXSourceRangeList.cs index 4babdf7e..15d4343d 100644 --- a/sources/ClangSharp.Interop/CXSourceRangeList.cs +++ b/sources/ClangSharp.Interop/CXSourceRangeList.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXString.cs b/sources/ClangSharp.Interop/CXString.cs index b5769f22..7dadd22a 100644 --- a/sources/ClangSharp.Interop/CXString.cs +++ b/sources/ClangSharp.Interop/CXString.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXStringSet.cs b/sources/ClangSharp.Interop/CXStringSet.cs index 81758c0c..201b4ef2 100644 --- a/sources/ClangSharp.Interop/CXStringSet.cs +++ b/sources/ClangSharp.Interop/CXStringSet.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXSymbolRole.cs b/sources/ClangSharp.Interop/CXSymbolRole.cs index 24b4bd3c..89c6f06b 100644 --- a/sources/ClangSharp.Interop/CXSymbolRole.cs +++ b/sources/ClangSharp.Interop/CXSymbolRole.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTLSKind.cs b/sources/ClangSharp.Interop/CXTLSKind.cs index cc062b3a..c0dad2f2 100644 --- a/sources/ClangSharp.Interop/CXTLSKind.cs +++ b/sources/ClangSharp.Interop/CXTLSKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTUResourceUsage.cs b/sources/ClangSharp.Interop/CXTUResourceUsage.cs index c685a465..e5571f15 100644 --- a/sources/ClangSharp.Interop/CXTUResourceUsage.cs +++ b/sources/ClangSharp.Interop/CXTUResourceUsage.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTUResourceUsageEntry.cs b/sources/ClangSharp.Interop/CXTUResourceUsageEntry.cs index ddf5bb93..64412509 100644 --- a/sources/ClangSharp.Interop/CXTUResourceUsageEntry.cs +++ b/sources/ClangSharp.Interop/CXTUResourceUsageEntry.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using System; diff --git a/sources/ClangSharp.Interop/CXTUResourceUsageKind.cs b/sources/ClangSharp.Interop/CXTUResourceUsageKind.cs index 5ad0a586..9ed0f335 100644 --- a/sources/ClangSharp.Interop/CXTUResourceUsageKind.cs +++ b/sources/ClangSharp.Interop/CXTUResourceUsageKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTargetInfoImpl.cs b/sources/ClangSharp.Interop/CXTargetInfoImpl.cs index cba81fef..a027540f 100644 --- a/sources/ClangSharp.Interop/CXTargetInfoImpl.cs +++ b/sources/ClangSharp.Interop/CXTargetInfoImpl.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTemplateArgumentKind.cs b/sources/ClangSharp.Interop/CXTemplateArgumentKind.cs index f7ce4797..30cca59d 100644 --- a/sources/ClangSharp.Interop/CXTemplateArgumentKind.cs +++ b/sources/ClangSharp.Interop/CXTemplateArgumentKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXToken.cs b/sources/ClangSharp.Interop/CXToken.cs index 591a125d..d547bc38 100644 --- a/sources/ClangSharp.Interop/CXToken.cs +++ b/sources/ClangSharp.Interop/CXToken.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTokenKind.cs b/sources/ClangSharp.Interop/CXTokenKind.cs index 1b91361c..ab4610e1 100644 --- a/sources/ClangSharp.Interop/CXTokenKind.cs +++ b/sources/ClangSharp.Interop/CXTokenKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTranslationUnitImpl.cs b/sources/ClangSharp.Interop/CXTranslationUnitImpl.cs index 2a505185..c6690648 100644 --- a/sources/ClangSharp.Interop/CXTranslationUnitImpl.cs +++ b/sources/ClangSharp.Interop/CXTranslationUnitImpl.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTranslationUnit_Flags.cs b/sources/ClangSharp.Interop/CXTranslationUnit_Flags.cs index 3d9f2561..76b81270 100644 --- a/sources/ClangSharp.Interop/CXTranslationUnit_Flags.cs +++ b/sources/ClangSharp.Interop/CXTranslationUnit_Flags.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXType.cs b/sources/ClangSharp.Interop/CXType.cs index 4b19a645..9197a3c7 100644 --- a/sources/ClangSharp.Interop/CXType.cs +++ b/sources/ClangSharp.Interop/CXType.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTypeKind.cs b/sources/ClangSharp.Interop/CXTypeKind.cs index 6b661e57..379f0ed8 100644 --- a/sources/ClangSharp.Interop/CXTypeKind.cs +++ b/sources/ClangSharp.Interop/CXTypeKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTypeLayoutError.cs b/sources/ClangSharp.Interop/CXTypeLayoutError.cs index 1d301ac7..9b8a1b22 100644 --- a/sources/ClangSharp.Interop/CXTypeLayoutError.cs +++ b/sources/ClangSharp.Interop/CXTypeLayoutError.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXTypeNullabilityKind.cs b/sources/ClangSharp.Interop/CXTypeNullabilityKind.cs index 42800797..e364c7a9 100644 --- a/sources/ClangSharp.Interop/CXTypeNullabilityKind.cs +++ b/sources/ClangSharp.Interop/CXTypeNullabilityKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXUnsavedFile.cs b/sources/ClangSharp.Interop/CXUnsavedFile.cs index 2c889ce3..9e43afee 100644 --- a/sources/ClangSharp.Interop/CXUnsavedFile.cs +++ b/sources/ClangSharp.Interop/CXUnsavedFile.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using System; diff --git a/sources/ClangSharp.Interop/CXVersion.cs b/sources/ClangSharp.Interop/CXVersion.cs index d291b6a1..0504d0f1 100644 --- a/sources/ClangSharp.Interop/CXVersion.cs +++ b/sources/ClangSharp.Interop/CXVersion.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXVirtualFileOverlayImpl.cs b/sources/ClangSharp.Interop/CXVirtualFileOverlayImpl.cs index 3d5f3376..6435c586 100644 --- a/sources/ClangSharp.Interop/CXVirtualFileOverlayImpl.cs +++ b/sources/ClangSharp.Interop/CXVirtualFileOverlayImpl.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXVisibilityKind.cs b/sources/ClangSharp.Interop/CXVisibilityKind.cs index 8da6a109..c3c63bb8 100644 --- a/sources/ClangSharp.Interop/CXVisibilityKind.cs +++ b/sources/ClangSharp.Interop/CXVisibilityKind.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CXVisitorResult.cs b/sources/ClangSharp.Interop/CXVisitorResult.cs index 2323460f..4161c409 100644 --- a/sources/ClangSharp.Interop/CXVisitorResult.cs +++ b/sources/ClangSharp.Interop/CXVisitorResult.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CX_CXXAccessSpecifier.cs b/sources/ClangSharp.Interop/CX_CXXAccessSpecifier.cs index 745d6281..3aedf1d4 100644 --- a/sources/ClangSharp.Interop/CX_CXXAccessSpecifier.cs +++ b/sources/ClangSharp.Interop/CX_CXXAccessSpecifier.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/CX_StorageClass.cs b/sources/ClangSharp.Interop/CX_StorageClass.cs index 1dd780e1..72faac70 100644 --- a/sources/ClangSharp.Interop/CX_StorageClass.cs +++ b/sources/ClangSharp.Interop/CX_StorageClass.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. namespace ClangSharp.Interop; diff --git a/sources/ClangSharp.Interop/IndexerCallbacks.cs b/sources/ClangSharp.Interop/IndexerCallbacks.cs index f065ff94..8d823bf7 100644 --- a/sources/ClangSharp.Interop/IndexerCallbacks.cs +++ b/sources/ClangSharp.Interop/IndexerCallbacks.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using System; diff --git a/sources/ClangSharp.Interop/clang.cs b/sources/ClangSharp.Interop/clang.cs index db07148f..b584f4cf 100644 --- a/sources/ClangSharp.Interop/clang.cs +++ b/sources/ClangSharp.Interop/clang.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using System; diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs index 23fa78a6..0aae6f8b 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs @@ -3356,7 +3356,7 @@ private void GetTypeSize(Cursor cursor, Type type, ref long alignment32, ref lon if (type is ConstantArrayType or IncompleteArrayType) { var count = Math.Max((arrayType as ConstantArrayType)?.Size ?? 0, 1); - GetTypeSize(cursor, arrayType.ElementType, ref alignment32, ref alignment64, ref has8BytePrimitiveField, out var elementSize32, out var elementSize64); + GetTypeSize(cursor, arrayType.ElementType, ref alignment32, ref alignment64, ref has8BytePrimitiveField, out var elementSize32, out var elementSize64); size32 = elementSize32 * Math.Max(count, 1); size64 = elementSize64 * Math.Max(count, 1); diff --git a/sources/ClangSharpPInvokeGenerator/Properties/GenerateClang-LICENSE.txt b/sources/ClangSharpPInvokeGenerator/Properties/GenerateClang-LICENSE.txt index 6ccf71a1..e1c00120 100644 --- a/sources/ClangSharpPInvokeGenerator/Properties/GenerateClang-LICENSE.txt +++ b/sources/ClangSharpPInvokeGenerator/Properties/GenerateClang-LICENSE.txt @@ -1,4 +1,4 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. diff --git a/sources/ClangSharpPInvokeGenerator/Properties/GenerateLLVM-LICENSE.txt b/sources/ClangSharpPInvokeGenerator/Properties/GenerateLLVM-LICENSE.txt index 3692a69c..8892be70 100644 --- a/sources/ClangSharpPInvokeGenerator/Properties/GenerateLLVM-LICENSE.txt +++ b/sources/ClangSharpPInvokeGenerator/Properties/GenerateLLVM-LICENSE.txt @@ -1,4 +1,4 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/llvm/include/llvm-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/llvm/include/llvm-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. diff --git a/sources/libClangSharp/CIndexDiagnostic.cpp b/sources/libClangSharp/CIndexDiagnostic.cpp index d734457a..7e7dc6fa 100644 --- a/sources/libClangSharp/CIndexDiagnostic.cpp +++ b/sources/libClangSharp/CIndexDiagnostic.cpp @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #include "CIndexDiagnostic.h" diff --git a/sources/libClangSharp/CIndexDiagnostic.h b/sources/libClangSharp/CIndexDiagnostic.h index e30f55ce..78935aea 100644 --- a/sources/libClangSharp/CIndexDiagnostic.h +++ b/sources/libClangSharp/CIndexDiagnostic.h @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #ifndef LIBCLANGSHARP_CINDEXDIAGNOSTIC_H diff --git a/sources/libClangSharp/CXCursor.cpp b/sources/libClangSharp/CXCursor.cpp index db404d57..9b31727b 100644 --- a/sources/libClangSharp/CXCursor.cpp +++ b/sources/libClangSharp/CXCursor.cpp @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #include "ClangSharp.h" diff --git a/sources/libClangSharp/CXCursor.h b/sources/libClangSharp/CXCursor.h index 4125ecfa..b6756b6b 100644 --- a/sources/libClangSharp/CXCursor.h +++ b/sources/libClangSharp/CXCursor.h @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #ifndef LIBCLANGSHARP_CXCURSOR_H diff --git a/sources/libClangSharp/CXLoadedDiagnostic.cpp b/sources/libClangSharp/CXLoadedDiagnostic.cpp index 15ef25d5..3300c6d7 100644 --- a/sources/libClangSharp/CXLoadedDiagnostic.cpp +++ b/sources/libClangSharp/CXLoadedDiagnostic.cpp @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #include "CXLoadedDiagnostic.h" diff --git a/sources/libClangSharp/CXLoadedDiagnostic.h b/sources/libClangSharp/CXLoadedDiagnostic.h index 8ae6bc80..70b93616 100644 --- a/sources/libClangSharp/CXLoadedDiagnostic.h +++ b/sources/libClangSharp/CXLoadedDiagnostic.h @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #ifndef LIBCLANGSHARP_CXLOADEDDIAGNOSTIC_H diff --git a/sources/libClangSharp/CXSourceLocation.cpp b/sources/libClangSharp/CXSourceLocation.cpp index 50f12bbb..43cd0129 100644 --- a/sources/libClangSharp/CXSourceLocation.cpp +++ b/sources/libClangSharp/CXSourceLocation.cpp @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #include "ClangSharp.h" diff --git a/sources/libClangSharp/CXSourceLocation.h b/sources/libClangSharp/CXSourceLocation.h index afc4af9b..3f827221 100644 --- a/sources/libClangSharp/CXSourceLocation.h +++ b/sources/libClangSharp/CXSourceLocation.h @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #ifndef LIBCLANGSHARP_CXSOURCELOCATION_H diff --git a/sources/libClangSharp/CXString.cpp b/sources/libClangSharp/CXString.cpp index 5ff3b728..76fc15f9 100644 --- a/sources/libClangSharp/CXString.cpp +++ b/sources/libClangSharp/CXString.cpp @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #include "CXString.h" diff --git a/sources/libClangSharp/CXString.h b/sources/libClangSharp/CXString.h index e43b552f..38c21182 100644 --- a/sources/libClangSharp/CXString.h +++ b/sources/libClangSharp/CXString.h @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #ifndef LIBCLANGSHARP_CXSTRING_H diff --git a/sources/libClangSharp/CXTranslationUnit.cpp b/sources/libClangSharp/CXTranslationUnit.cpp index bb680a87..af34da48 100644 --- a/sources/libClangSharp/CXTranslationUnit.cpp +++ b/sources/libClangSharp/CXTranslationUnit.cpp @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #include "CXTranslationUnit.h" diff --git a/sources/libClangSharp/CXTranslationUnit.h b/sources/libClangSharp/CXTranslationUnit.h index 03f171cd..900ce279 100644 --- a/sources/libClangSharp/CXTranslationUnit.h +++ b/sources/libClangSharp/CXTranslationUnit.h @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #ifndef LIBCLANGSHARP_CXTRANSLATIONUNIT_H diff --git a/sources/libClangSharp/CXType.cpp b/sources/libClangSharp/CXType.cpp index 47acf2dc..2e839414 100644 --- a/sources/libClangSharp/CXType.cpp +++ b/sources/libClangSharp/CXType.cpp @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #include "ClangSharp.h" diff --git a/sources/libClangSharp/CXType.h b/sources/libClangSharp/CXType.h index 4b70d39d..2029193f 100644 --- a/sources/libClangSharp/CXType.h +++ b/sources/libClangSharp/CXType.h @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/tools/libclang +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/tools/libclang // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. #ifndef LIBCLANGSHARP_CXTYPE_H diff --git a/sources/libClangSharp/ClangSharp.cpp b/sources/libClangSharp/ClangSharp.cpp index f567b9d2..4c7e8ba7 100644 --- a/sources/libClangSharp/ClangSharp.cpp +++ b/sources/libClangSharp/ClangSharp.cpp @@ -4744,7 +4744,7 @@ int64_t clangsharp_Cursor_getVtblIdx(CXCursor C) { } CXString clangsharp_getVersion() { - return cxstring::createDup("clangsharp version 14.0.0"); + return cxstring::createDup("clangsharp version 15.0.0"); } void clangsharp_TemplateArgument_dispose(CX_TemplateArgument T) { diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXCodeCompleteResultsTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXCodeCompleteResultsTests.cs index 4abca447..2d4763aa 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXCodeCompleteResultsTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXCodeCompleteResultsTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXCommentTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXCommentTests.cs index 641b9bde..b2f36ee2 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXCommentTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXCommentTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXCompletionResultTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXCompletionResultTests.cs index 14a7fd54..b60ff848 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXCompletionResultTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXCompletionResultTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXCursorAndRangeVisitorTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXCursorAndRangeVisitorTests.cs index 93f48fdd..a876764b 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXCursorAndRangeVisitorTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXCursorAndRangeVisitorTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXCursorSetImplTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXCursorSetImplTests.cs index b46e15e8..4fe9d6fb 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXCursorSetImplTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXCursorSetImplTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXCursorTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXCursorTests.cs index ac3b36a1..7dcc4ace 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXCursorTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXCursorTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXFileUniqueIDTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXFileUniqueIDTests.cs index a6506fa4..d4445e39 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXFileUniqueIDTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXFileUniqueIDTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxAttrInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxAttrInfoTests.cs index 276244f3..f8a51172 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxAttrInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxAttrInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxBaseClassInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxBaseClassInfoTests.cs index 86819f94..023e400c 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxBaseClassInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxBaseClassInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxCXXClassDeclInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxCXXClassDeclInfoTests.cs index 0f30cffd..2b92c5f4 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxCXXClassDeclInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxCXXClassDeclInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxContainerInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxContainerInfoTests.cs index d008b0cd..055f3bc8 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxContainerInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxContainerInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxDeclInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxDeclInfoTests.cs index d94390c1..3e1b8905 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxDeclInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxDeclInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxEntityInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxEntityInfoTests.cs index 5b76839b..c34dec95 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxEntityInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxEntityInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxEntityRefInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxEntityRefInfoTests.cs index 22c58435..75f2b7e1 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxEntityRefInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxEntityRefInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxIBOutletCollectionAttrInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxIBOutletCollectionAttrInfoTests.cs index 946d04bd..d4ba2e60 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxIBOutletCollectionAttrInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxIBOutletCollectionAttrInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxImportedASTFileInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxImportedASTFileInfoTests.cs index 63d3a7ff..ba9dc345 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxImportedASTFileInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxImportedASTFileInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxIncludedFileInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxIncludedFileInfoTests.cs index d90eee9c..8789ab71 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxIncludedFileInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxIncludedFileInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxLocTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxLocTests.cs index a0f4b9e0..43cd4e35 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxLocTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxLocTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCCategoryDeclInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCCategoryDeclInfoTests.cs index 9faa6b86..18532b27 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCCategoryDeclInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCCategoryDeclInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCContainerDeclInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCContainerDeclInfoTests.cs index e7fe51f9..994eeeee 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCContainerDeclInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCContainerDeclInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCInterfaceDeclInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCInterfaceDeclInfoTests.cs index 266c2a42..3135b9b3 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCInterfaceDeclInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCInterfaceDeclInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCPropertyDeclInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCPropertyDeclInfoTests.cs index ae4429bc..e9abdf5d 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCPropertyDeclInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCPropertyDeclInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCProtocolRefInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCProtocolRefInfoTests.cs index 26c6dbe7..0e47c6f5 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCProtocolRefInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCProtocolRefInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCProtocolRefListInfoTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCProtocolRefListInfoTests.cs index da91d7eb..20c08c2d 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCProtocolRefListInfoTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXIdxObjCProtocolRefListInfoTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXModuleMapDescriptorImplTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXModuleMapDescriptorImplTests.cs index 28c2e1a0..e014209c 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXModuleMapDescriptorImplTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXModuleMapDescriptorImplTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXPlatformAvailabilityTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXPlatformAvailabilityTests.cs index dd95fe43..39e7d30a 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXPlatformAvailabilityTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXPlatformAvailabilityTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXSourceLocationTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXSourceLocationTests.cs index 98e3c3c0..34bbbdfe 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXSourceLocationTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXSourceLocationTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXSourceRangeListTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXSourceRangeListTests.cs index ba23ed7b..2b4441aa 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXSourceRangeListTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXSourceRangeListTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXSourceRangeTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXSourceRangeTests.cs index 535b1615..76f75b3b 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXSourceRangeTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXSourceRangeTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXStringSetTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXStringSetTests.cs index ab5de4cc..bd3d4402 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXStringSetTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXStringSetTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXStringTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXStringTests.cs index ca69e3b6..3a234d65 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXStringTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXStringTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXTUResourceUsageEntryTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXTUResourceUsageEntryTests.cs index 60c7bbb7..d34225c6 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXTUResourceUsageEntryTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXTUResourceUsageEntryTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXTUResourceUsageTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXTUResourceUsageTests.cs index 99efff9b..41853c90 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXTUResourceUsageTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXTUResourceUsageTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXTargetInfoImplTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXTargetInfoImplTests.cs index ed31e4f5..6d11e51d 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXTargetInfoImplTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXTargetInfoImplTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXTokenTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXTokenTests.cs index a02aaba4..f0c23088 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXTokenTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXTokenTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXTranslationUnitImplTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXTranslationUnitImplTests.cs index 9975adf3..3ba72036 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXTranslationUnitImplTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXTranslationUnitImplTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXTypeTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXTypeTests.cs index ba7d78b7..d2f91f79 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXTypeTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXTypeTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXUnsavedFileTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXUnsavedFileTests.cs index f132fbf2..10894692 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXUnsavedFileTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXUnsavedFileTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXVersionTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXVersionTests.cs index 220c71f6..eff31ab9 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXVersionTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXVersionTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/CXVirtualFileOverlayImplTests.cs b/tests/ClangSharp.UnitTests/InteropTests/CXVirtualFileOverlayImplTests.cs index b4c5366c..d045c5e5 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/CXVirtualFileOverlayImplTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/CXVirtualFileOverlayImplTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/InteropTests/IndexerCallbacksTests.cs b/tests/ClangSharp.UnitTests/InteropTests/IndexerCallbacksTests.cs index ab17e840..e157038d 100644 --- a/tests/ClangSharp.UnitTests/InteropTests/IndexerCallbacksTests.cs +++ b/tests/ClangSharp.UnitTests/InteropTests/IndexerCallbacksTests.cs @@ -1,6 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-14.0.0/clang/include/clang-c +// Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. using NUnit.Framework; From 889b3c4e75eb154e799e54b4b372a02baf4a6051 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Wed, 14 Sep 2022 19:53:04 -0700 Subject: [PATCH 2/6] Update to support .NET 7 and other basic infrastructure updates --- .editorconfig | 1 + ClangSharp.sln | 3 ++ Directory.Build.props | 11 ++++--- Directory.Build.targets | 31 +++++++------------ Directory.Packages.props | 26 ++++++++++++++++ NuGet.config | 12 +++++++ scripts/build.ps1 | 1 + scripts/build.sh | 1 + .../ClangSharp.Interop.csproj | 2 +- .../ClangSharp.PInvokeGenerator.csproj | 2 +- sources/ClangSharp/ClangSharp.csproj | 2 +- .../ClangSharpPInvokeGenerator.csproj | 2 +- sources/Directory.Build.props | 3 +- sources/Directory.Build.targets | 12 ++----- ...angSharp.PInvokeGenerator.UnitTests.csproj | 2 +- .../ClangSharp.UnitTests.csproj | 2 +- tests/Directory.Build.props | 11 ++----- tests/Directory.Build.targets | 4 --- 18 files changed, 75 insertions(+), 53 deletions(-) create mode 100644 Directory.Packages.props create mode 100644 NuGet.config diff --git a/.editorconfig b/.editorconfig index e0151b57..4abf354c 100644 --- a/.editorconfig +++ b/.editorconfig @@ -450,4 +450,5 @@ csharp_using_directive_placement = outside_namespace:error # Set dotnet analyzer rules to: # disable CA1401: P/Invoke method '*' should not be visible ############################################################################### +[*.cs] dotnet_diagnostic.CA1401.severity = silent diff --git a/ClangSharp.sln b/ClangSharp.sln index 276efdf9..9775fc13 100644 --- a/ClangSharp.sln +++ b/ClangSharp.sln @@ -13,8 +13,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md Directory.Build.props = Directory.Build.props Directory.Build.targets = Directory.Build.targets + Directory.Packages.props = Directory.Packages.props LICENSE.md = LICENSE.md NOTICE.md = NOTICE.md + NuGet.config = NuGet.config + Open.snk = Open.snk pack.cmd = pack.cmd pack.sh = pack.sh README.md = README.md diff --git a/Directory.Build.props b/Directory.Build.props index aeaec7f7..1974167d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -14,16 +14,18 @@ $(MSBuildThisFileDirectory)artifacts/ $(ClangSharpProjectCategory)/$(MSBuildProjectName) - https://github.com/dotnet/ClangSharp/ + https://github.com/dotnet/clangsharp/ true + preview $(BaseArtifactsPath)obj/$(BaseArtifactsPathSuffix)/ embedded false - CS0659;$(NoWarn) + true + enable true true true @@ -42,6 +44,7 @@ true $(BaseArtifactsPath)pkg/$(Configuration)/ ClangSharp + ClangSharp 15.0.0 rc1 pr @@ -65,9 +68,7 @@ true false git - - https://api.nuget.org/v3/index.json; - + $(MSBuildThisFileDirectory)NuGet.config true diff --git a/Directory.Build.targets b/Directory.Build.targets index ad085668..16eb8e06 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -12,7 +12,7 @@ - $(DefineConstants);$(OS) + $(NoWarn) @@ -20,28 +20,21 @@ $(Version).$(GITHUB_RUN_ID) + + + true + + + + + true + true + + $(NETCoreSdkRuntimeIdentifier) $(OVERRIDE_RUNTIME_IDENTIFIER) - - - - - - - - - - - - - - - - - - diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 00000000..b45d2ecd --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + diff --git a/NuGet.config b/NuGet.config new file mode 100644 index 00000000..804d4684 --- /dev/null +++ b/NuGet.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 4c18851b..523c91b1 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -173,6 +173,7 @@ try { Create-Directory -Path $DotNetInstallDirectory & $DotNetInstallScript -Channel 6.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture + & $DotNetInstallScript -Channel 7.0 -Version latest -InstallDir $DotNetInstallDirectory -Architecture $architecture -Quality preview $env:PATH="$DotNetInstallDirectory;$env:PATH" } diff --git a/scripts/build.sh b/scripts/build.sh index cd3e9262..371a6792 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -205,6 +205,7 @@ if [[ ! -z "$architecture" ]]; then CreateDirectory "$DotNetInstallDirectory" . "$DotNetInstallScript" --channel 6.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture" + . "$DotNetInstallScript" --channel 7.0 --version latest --install-dir "$DotNetInstallDirectory" --architecture "$architecture" --quality preview PATH="$DotNetInstallDirectory:$PATH:" fi diff --git a/sources/ClangSharp.Interop/ClangSharp.Interop.csproj b/sources/ClangSharp.Interop/ClangSharp.Interop.csproj index 55335147..d207d05c 100644 --- a/sources/ClangSharp.Interop/ClangSharp.Interop.csproj +++ b/sources/ClangSharp.Interop/ClangSharp.Interop.csproj @@ -2,7 +2,7 @@ - net6.0;netstandard2.0 + net6.0;net7.0;netstandard2.0 diff --git a/sources/ClangSharp.PInvokeGenerator/ClangSharp.PInvokeGenerator.csproj b/sources/ClangSharp.PInvokeGenerator/ClangSharp.PInvokeGenerator.csproj index 419d5b43..26e4eef3 100644 --- a/sources/ClangSharp.PInvokeGenerator/ClangSharp.PInvokeGenerator.csproj +++ b/sources/ClangSharp.PInvokeGenerator/ClangSharp.PInvokeGenerator.csproj @@ -3,7 +3,7 @@ ClangSharp - net6.0 + net6.0;net7.0 diff --git a/sources/ClangSharp/ClangSharp.csproj b/sources/ClangSharp/ClangSharp.csproj index 9a713f17..efccad82 100644 --- a/sources/ClangSharp/ClangSharp.csproj +++ b/sources/ClangSharp/ClangSharp.csproj @@ -2,7 +2,7 @@ - net6.0;netstandard2.0 + net6.0;net7.0;netstandard2.0 diff --git a/sources/ClangSharpPInvokeGenerator/ClangSharpPInvokeGenerator.csproj b/sources/ClangSharpPInvokeGenerator/ClangSharpPInvokeGenerator.csproj index 68946adf..26d13ac9 100644 --- a/sources/ClangSharpPInvokeGenerator/ClangSharpPInvokeGenerator.csproj +++ b/sources/ClangSharpPInvokeGenerator/ClangSharpPInvokeGenerator.csproj @@ -3,7 +3,7 @@ Exe - net6.0 + net6.0;net7.0 diff --git a/sources/Directory.Build.props b/sources/Directory.Build.props index 5abe6ce1..abe39a9c 100644 --- a/sources/Directory.Build.props +++ b/sources/Directory.Build.props @@ -12,7 +12,6 @@ true - $(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.props sources @@ -23,7 +22,7 @@ - + diff --git a/sources/Directory.Build.targets b/sources/Directory.Build.targets index 15a9ad2e..0450ebcb 100644 --- a/sources/Directory.Build.targets +++ b/sources/Directory.Build.targets @@ -10,16 +10,8 @@ MSBuildAllProjects, as that is done by the file that imports us. --> - - $(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.targets - - - - $(IntermediateOutputPath)$(MSBuildProjectName).InternalsVisibleTo$(DefaultLanguageSourceExtension) - - $(IntermediateOutputPath)$(MSBuildProjectName).SkipLocalsInit$(DefaultLanguageSourceExtension) @@ -31,7 +23,9 @@ // the code is regenerated. // //------------------------------------------------------------------------------ + [module: System.Runtime.CompilerServices.SkipLocalsInitAttribute] + // Generated by the MSBuild WriteLinesToFile class.]]> @@ -39,7 +33,7 @@ diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/ClangSharp.PInvokeGenerator.UnitTests.csproj b/tests/ClangSharp.PInvokeGenerator.UnitTests/ClangSharp.PInvokeGenerator.UnitTests.csproj index 056a520e..9f83f9d7 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/ClangSharp.PInvokeGenerator.UnitTests.csproj +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/ClangSharp.PInvokeGenerator.UnitTests.csproj @@ -3,7 +3,7 @@ ClangSharp.UnitTests - net6.0 + net6.0;net7.0 diff --git a/tests/ClangSharp.UnitTests/ClangSharp.UnitTests.csproj b/tests/ClangSharp.UnitTests/ClangSharp.UnitTests.csproj index 13148c9d..3b69112c 100644 --- a/tests/ClangSharp.UnitTests/ClangSharp.UnitTests.csproj +++ b/tests/ClangSharp.UnitTests/ClangSharp.UnitTests.csproj @@ -2,7 +2,7 @@ - net6.0 + net6.0;net7.0 diff --git a/tests/Directory.Build.props b/tests/Directory.Build.props index fbce7e06..7d5962df 100644 --- a/tests/Directory.Build.props +++ b/tests/Directory.Build.props @@ -11,7 +11,6 @@ --> - $(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.props tests @@ -23,13 +22,9 @@ - - - - - - - + + + diff --git a/tests/Directory.Build.targets b/tests/Directory.Build.targets index f8a4936e..1269bf1f 100644 --- a/tests/Directory.Build.targets +++ b/tests/Directory.Build.targets @@ -10,10 +10,6 @@ MSBuildAllProjects, as that is done by the file that imports us. --> - - $(MSBuildAllProjects);$(MSBuildThisFileDirectory)..\Directory.Build.targets - - From 8acaaf0d6182b16760a8fa3d4ea5b60a74e85e8c Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Sat, 17 Sep 2022 09:52:12 -0700 Subject: [PATCH 3/6] Regenerating ClangSharp bindings for v15.0.0 --- .editorconfig | 2 + Directory.Build.props | 2 +- sources/ClangSharp.Interop/CXCallingConv.cs | 1 + sources/ClangSharp.Interop/CXCursor.cs | 3 + .../CXCursorAndRangeVisitor.cs | 4 +- sources/ClangSharp.Interop/CXCursorKind.cs | 20 +- sources/ClangSharp.Interop/CXFileUniqueID.cs | 2 +- sources/ClangSharp.Interop/CXIdxEntityKind.cs | 1 + sources/ClangSharp.Interop/CXIdxLoc.cs | 3 + .../ClangSharp.Interop/CXSourceLocation.cs | 3 + sources/ClangSharp.Interop/CXSourceRange.cs | 3 + .../CXTUResourceUsageEntry.cs | 4 +- sources/ClangSharp.Interop/CXToken.cs | 2 +- sources/ClangSharp.Interop/CXType.cs | 3 + sources/ClangSharp.Interop/CXTypeKind.cs | 1 + sources/ClangSharp.Interop/CXUnsavedFile.cs | 4 +- sources/ClangSharp.Interop/CX_AttrKind.cs | 22 ++- .../ClangSharp.Interop/CX_ConstructionKind.cs | 2 +- sources/ClangSharp.Interop/CX_DeclKind.cs | 1 + .../ClangSharp.Interop/CX_DestructorType.cs | 2 +- sources/ClangSharp.Interop/CX_StmtClass.cs | 11 +- .../ClangSharp.Interop/CX_TemplateNameKind.cs | 14 +- sources/ClangSharp.Interop/CX_TypeClass.cs | 1 + .../CX_VariableCaptureKind.cs | 2 +- .../ClangSharp.Interop.csproj | 4 +- .../ClangSharp.Interop/Extensions/CXCursor.cs | 181 +++++++++++++++--- .../Extensions/CXTranslationUnit.cs | 9 +- .../ClangSharp.Interop/Extensions/CXType.cs | 16 +- .../Extensions/clang.ResolveLibrary.cs | 4 +- .../ClangSharp.Interop/IndexerCallbacks.cs | 20 +- .../{ => Manual}/CXCursorSetImpl.cs | 0 .../{ => Manual}/CXCursorVisitor.cs | 0 .../{ => Manual}/CXFieldVisitor.cs | 0 .../{ => Manual}/CXInclusionVisitor.cs | 0 .../{ => Manual}/CXModuleMapDescriptorImpl.cs | 0 .../{ => Manual}/CXTargetInfoImpl.cs | 0 .../{ => Manual}/CXTranslationUnitImpl.cs | 0 .../{ => Manual}/CXVirtualFileOverlayImpl.cs | 0 .../Shims/SkipLocalsInitAttribute.cs | 8 + sources/ClangSharp.Interop/clang.cs | 15 +- sources/ClangSharp.Interop/clangsharp.cs | 2 +- .../Abstractions/FunctionOrDelegateDesc.cs | 2 +- .../ClangSharp.PInvokeGenerator/Diagnostic.cs | 7 +- .../Extensions/StringExtensions.cs | 4 +- sources/ClangSharp/Cursors/Attrs/Attr.cs | 14 +- sources/ClangSharp/Cursors/Cursor.cs | 21 +- .../ClangSharp/Cursors/Decls/ConceptDecl.cs | 2 +- sources/ClangSharp/Cursors/Decls/Decl.cs | 1 + .../Decls/UnnamedGlobalConstantDecl.cs | 12 ++ .../Exprs/ConceptSpecializationExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/RequiresExpr.cs | 2 +- .../Stmts/OMPMaskedTaskLoopDirective.cs | 12 ++ .../Stmts/OMPMaskedTaskLoopSimdDirective.cs | 12 ++ .../Stmts/OMPParallelGenericLoopDirective.cs | 12 ++ .../Stmts/OMPParallelMaskedDirective.cs | 12 ++ .../OMPParallelMaskedTaskLoopDirective.cs | 12 ++ .../OMPParallelMaskedTaskLoopSimdDirective.cs | 12 ++ .../OMPTargetParallelGenericLoopDirective.cs | 12 ++ .../OMPTargetTeamsGenericLoopDirective.cs | 12 ++ .../Stmts/OMPTeamsGenericLoopDirective.cs | 12 ++ sources/ClangSharp/Cursors/Stmts/Stmt.cs | 9 + .../ClangSharp/Types/BTFTagAttributedType.cs | 12 ++ sources/ClangSharp/Types/Type.cs | 3 +- .../Properties/GenerateClang.rsp | 16 ++ .../Properties/GenerateClangSharp.rsp | 17 ++ .../Properties/GenerateLLVM.rsp | 19 +- 66 files changed, 514 insertions(+), 109 deletions(-) rename sources/ClangSharp.Interop/{ => Manual}/CXCursorSetImpl.cs (100%) rename sources/ClangSharp.Interop/{ => Manual}/CXCursorVisitor.cs (100%) rename sources/ClangSharp.Interop/{ => Manual}/CXFieldVisitor.cs (100%) rename sources/ClangSharp.Interop/{ => Manual}/CXInclusionVisitor.cs (100%) rename sources/ClangSharp.Interop/{ => Manual}/CXModuleMapDescriptorImpl.cs (100%) rename sources/ClangSharp.Interop/{ => Manual}/CXTargetInfoImpl.cs (100%) rename sources/ClangSharp.Interop/{ => Manual}/CXTranslationUnitImpl.cs (100%) rename sources/ClangSharp.Interop/{ => Manual}/CXVirtualFileOverlayImpl.cs (100%) create mode 100644 sources/ClangSharp.Interop/Shims/SkipLocalsInitAttribute.cs create mode 100644 sources/ClangSharp/Cursors/Decls/UnnamedGlobalConstantDecl.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/OMPMaskedTaskLoopDirective.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/OMPMaskedTaskLoopSimdDirective.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/OMPParallelGenericLoopDirective.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedDirective.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedTaskLoopDirective.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedTaskLoopSimdDirective.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/OMPTargetParallelGenericLoopDirective.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsGenericLoopDirective.cs create mode 100644 sources/ClangSharp/Cursors/Stmts/OMPTeamsGenericLoopDirective.cs create mode 100644 sources/ClangSharp/Types/BTFTagAttributedType.cs diff --git a/.editorconfig b/.editorconfig index 4abf354c..4c5dd203 100644 --- a/.editorconfig +++ b/.editorconfig @@ -449,6 +449,8 @@ csharp_using_directive_placement = outside_namespace:error ############################################################################### # Set dotnet analyzer rules to: # disable CA1401: P/Invoke method '*' should not be visible +# disable SYSLIB1054: Mark the method '*' with 'LibraryImportAttribute' instead of 'DllImportAttribute' to generate P/Invoke marshalling code at compile time ############################################################################### [*.cs] dotnet_diagnostic.CA1401.severity = silent +dotnet_diagnostic.SYSLIB1054.severity = silent diff --git a/Directory.Build.props b/Directory.Build.props index 1974167d..e224fb0c 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -25,7 +25,7 @@ embedded false true - enable + true true true diff --git a/sources/ClangSharp.Interop/CXCallingConv.cs b/sources/ClangSharp.Interop/CXCallingConv.cs index 6db8e257..3abf8e14 100644 --- a/sources/ClangSharp.Interop/CXCallingConv.cs +++ b/sources/ClangSharp.Interop/CXCallingConv.cs @@ -26,6 +26,7 @@ public enum CXCallingConv CXCallingConv_PreserveAll = 15, CXCallingConv_AArch64VectorCall = 16, CXCallingConv_SwiftAsync = 17, + CXCallingConv_AArch64SVEPCS = 18, CXCallingConv_Invalid = 100, CXCallingConv_Unexposed = 200, } diff --git a/sources/ClangSharp.Interop/CXCursor.cs b/sources/ClangSharp.Interop/CXCursor.cs index 0b77825a..a1d4dea9 100644 --- a/sources/ClangSharp.Interop/CXCursor.cs +++ b/sources/ClangSharp.Interop/CXCursor.cs @@ -3,6 +3,8 @@ // Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. +using System.Runtime.CompilerServices; + namespace ClangSharp.Interop; public partial struct CXCursor @@ -23,6 +25,7 @@ public unsafe partial struct _data_e__FixedBuffer public ref void* this[int index] { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { fixed (void** pThis = &e0) diff --git a/sources/ClangSharp.Interop/CXCursorAndRangeVisitor.cs b/sources/ClangSharp.Interop/CXCursorAndRangeVisitor.cs index 90b94211..5980970a 100644 --- a/sources/ClangSharp.Interop/CXCursorAndRangeVisitor.cs +++ b/sources/ClangSharp.Interop/CXCursorAndRangeVisitor.cs @@ -3,8 +3,6 @@ // Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. -using System; - namespace ClangSharp.Interop; public unsafe partial struct CXCursorAndRangeVisitor @@ -12,5 +10,5 @@ public unsafe partial struct CXCursorAndRangeVisitor public void* context; [NativeTypeName("enum CXVisitorResult (*)(void *, CXCursor, CXSourceRange)")] - public IntPtr visit; + public delegate* unmanaged[Cdecl] visit; } diff --git a/sources/ClangSharp.Interop/CXCursorKind.cs b/sources/ClangSharp.Interop/CXCursorKind.cs index 7cea5489..9967cf4d 100644 --- a/sources/ClangSharp.Interop/CXCursorKind.cs +++ b/sources/ClangSharp.Interop/CXCursorKind.cs @@ -121,7 +121,9 @@ public enum CXCursorKind CXCursor_OMPArrayShapingExpr = 150, CXCursor_OMPIteratorExpr = 151, CXCursor_CXXAddrspaceCastExpr = 152, - CXCursor_LastExpr = CXCursor_CXXAddrspaceCastExpr, + CXCursor_ConceptSpecializationExpr = 153, + CXCursor_RequiresExpr = 154, + CXCursor_LastExpr = CXCursor_RequiresExpr, CXCursor_FirstStmt = 200, CXCursor_UnexposedStmt = 200, CXCursor_LabelStmt = 201, @@ -220,8 +222,17 @@ public enum CXCursorKind CXCursor_OMPUnrollDirective = 293, CXCursor_OMPMetaDirective = 294, CXCursor_OMPGenericLoopDirective = 295, - CXCursor_LastStmt = CXCursor_OMPGenericLoopDirective, - CXCursor_TranslationUnit = 300, + CXCursor_OMPTeamsGenericLoopDirective = 296, + CXCursor_OMPTargetTeamsGenericLoopDirective = 297, + CXCursor_OMPParallelGenericLoopDirective = 298, + CXCursor_OMPTargetParallelGenericLoopDirective = 299, + CXCursor_OMPParallelMaskedDirective = 300, + CXCursor_OMPMaskedTaskLoopDirective = 301, + CXCursor_OMPMaskedTaskLoopSimdDirective = 302, + CXCursor_OMPParallelMaskedTaskLoopDirective = 303, + CXCursor_OMPParallelMaskedTaskLoopSimdDirective = 304, + CXCursor_LastStmt = CXCursor_OMPParallelMaskedTaskLoopSimdDirective, + CXCursor_TranslationUnit = 350, CXCursor_FirstAttr = 400, CXCursor_UnexposedAttr = 400, CXCursor_IBActionAttr = 401, @@ -277,7 +288,8 @@ public enum CXCursorKind CXCursor_TypeAliasTemplateDecl = 601, CXCursor_StaticAssert = 602, CXCursor_FriendDecl = 603, + CXCursor_ConceptDecl = 604, CXCursor_FirstExtraDecl = CXCursor_ModuleImportDecl, - CXCursor_LastExtraDecl = CXCursor_FriendDecl, + CXCursor_LastExtraDecl = CXCursor_ConceptDecl, CXCursor_OverloadCandidate = 700, } diff --git a/sources/ClangSharp.Interop/CXFileUniqueID.cs b/sources/ClangSharp.Interop/CXFileUniqueID.cs index cedc8079..497c1b0c 100644 --- a/sources/ClangSharp.Interop/CXFileUniqueID.cs +++ b/sources/ClangSharp.Interop/CXFileUniqueID.cs @@ -7,6 +7,6 @@ namespace ClangSharp.Interop; public unsafe partial struct CXFileUniqueID { - [NativeTypeName("unsigned long long [3]")] + [NativeTypeName("unsigned long long[3]")] public fixed ulong data[3]; } diff --git a/sources/ClangSharp.Interop/CXIdxEntityKind.cs b/sources/ClangSharp.Interop/CXIdxEntityKind.cs index e48240b8..2668ec51 100644 --- a/sources/ClangSharp.Interop/CXIdxEntityKind.cs +++ b/sources/ClangSharp.Interop/CXIdxEntityKind.cs @@ -34,4 +34,5 @@ public enum CXIdxEntityKind CXIdxEntity_CXXConversionFunction = 24, CXIdxEntity_CXXTypeAlias = 25, CXIdxEntity_CXXInterface = 26, + CXIdxEntity_CXXConcept = 27, } diff --git a/sources/ClangSharp.Interop/CXIdxLoc.cs b/sources/ClangSharp.Interop/CXIdxLoc.cs index 759dbaf7..c07b01b0 100644 --- a/sources/ClangSharp.Interop/CXIdxLoc.cs +++ b/sources/ClangSharp.Interop/CXIdxLoc.cs @@ -3,6 +3,8 @@ // Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. +using System.Runtime.CompilerServices; + namespace ClangSharp.Interop; public partial struct CXIdxLoc @@ -20,6 +22,7 @@ public unsafe partial struct _ptr_data_e__FixedBuffer public ref void* this[int index] { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { fixed (void** pThis = &e0) diff --git a/sources/ClangSharp.Interop/CXSourceLocation.cs b/sources/ClangSharp.Interop/CXSourceLocation.cs index b57eb11f..054c5a6a 100644 --- a/sources/ClangSharp.Interop/CXSourceLocation.cs +++ b/sources/ClangSharp.Interop/CXSourceLocation.cs @@ -3,6 +3,8 @@ // Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. +using System.Runtime.CompilerServices; + namespace ClangSharp.Interop; public partial struct CXSourceLocation @@ -20,6 +22,7 @@ public unsafe partial struct _ptr_data_e__FixedBuffer public ref void* this[int index] { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { fixed (void** pThis = &e0) diff --git a/sources/ClangSharp.Interop/CXSourceRange.cs b/sources/ClangSharp.Interop/CXSourceRange.cs index 4ea9fbe5..87eea6eb 100644 --- a/sources/ClangSharp.Interop/CXSourceRange.cs +++ b/sources/ClangSharp.Interop/CXSourceRange.cs @@ -3,6 +3,8 @@ // Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. +using System.Runtime.CompilerServices; + namespace ClangSharp.Interop; public partial struct CXSourceRange @@ -23,6 +25,7 @@ public unsafe partial struct _ptr_data_e__FixedBuffer public ref void* this[int index] { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { fixed (void** pThis = &e0) diff --git a/sources/ClangSharp.Interop/CXTUResourceUsageEntry.cs b/sources/ClangSharp.Interop/CXTUResourceUsageEntry.cs index 64412509..6b70a3db 100644 --- a/sources/ClangSharp.Interop/CXTUResourceUsageEntry.cs +++ b/sources/ClangSharp.Interop/CXTUResourceUsageEntry.cs @@ -3,8 +3,6 @@ // Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. -using System; - namespace ClangSharp.Interop; public partial struct CXTUResourceUsageEntry @@ -13,5 +11,5 @@ public partial struct CXTUResourceUsageEntry public CXTUResourceUsageKind kind; [NativeTypeName("unsigned long")] - public UIntPtr amount; + public nuint amount; } diff --git a/sources/ClangSharp.Interop/CXToken.cs b/sources/ClangSharp.Interop/CXToken.cs index d547bc38..000fd739 100644 --- a/sources/ClangSharp.Interop/CXToken.cs +++ b/sources/ClangSharp.Interop/CXToken.cs @@ -7,7 +7,7 @@ namespace ClangSharp.Interop; public unsafe partial struct CXToken { - [NativeTypeName("unsigned int [4]")] + [NativeTypeName("unsigned int[4]")] public fixed uint int_data[4]; public void* ptr_data; diff --git a/sources/ClangSharp.Interop/CXType.cs b/sources/ClangSharp.Interop/CXType.cs index 9197a3c7..072fbb49 100644 --- a/sources/ClangSharp.Interop/CXType.cs +++ b/sources/ClangSharp.Interop/CXType.cs @@ -3,6 +3,8 @@ // Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. +using System.Runtime.CompilerServices; + namespace ClangSharp.Interop; public partial struct CXType @@ -20,6 +22,7 @@ public unsafe partial struct _data_e__FixedBuffer public ref void* this[int index] { + [MethodImpl(MethodImplOptions.AggressiveInlining)] get { fixed (void** pThis = &e0) diff --git a/sources/ClangSharp.Interop/CXTypeKind.cs b/sources/ClangSharp.Interop/CXTypeKind.cs index 379f0ed8..1d8585f6 100644 --- a/sources/ClangSharp.Interop/CXTypeKind.cs +++ b/sources/ClangSharp.Interop/CXTypeKind.cs @@ -128,4 +128,5 @@ public enum CXTypeKind CXType_OCLIntelSubgroupAVCImeDualRefStreamin = 175, CXType_ExtVector = 176, CXType_Atomic = 177, + CXType_BTFTagAttributed = 178, } diff --git a/sources/ClangSharp.Interop/CXUnsavedFile.cs b/sources/ClangSharp.Interop/CXUnsavedFile.cs index 9e43afee..a2b64f0c 100644 --- a/sources/ClangSharp.Interop/CXUnsavedFile.cs +++ b/sources/ClangSharp.Interop/CXUnsavedFile.cs @@ -3,8 +3,6 @@ // Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. -using System; - namespace ClangSharp.Interop; public unsafe partial struct CXUnsavedFile @@ -16,5 +14,5 @@ public unsafe partial struct CXUnsavedFile public sbyte* Contents; [NativeTypeName("unsigned long")] - public UIntPtr Length; + public nuint Length; } diff --git a/sources/ClangSharp.Interop/CX_AttrKind.cs b/sources/ClangSharp.Interop/CX_AttrKind.cs index b56644ad..ebbee323 100644 --- a/sources/ClangSharp.Interop/CX_AttrKind.cs +++ b/sources/ClangSharp.Interop/CX_AttrKind.cs @@ -7,6 +7,7 @@ public enum CX_AttrKind { CX_AttrKind_Invalid, CX_AttrKind_AddressSpace, + CX_AttrKind_AnnotateType, CX_AttrKind_ArmMveStrictPolymorphism, CX_AttrKind_BTFTypeTag, CX_AttrKind_CmseNSCall, @@ -35,8 +36,12 @@ public enum CX_AttrKind CX_AttrKind_OpenCLUnrollHint, CX_AttrKind_Suppress, CX_AttrKind_Unlikely, + CX_AttrKind_AlwaysInline, + CX_AttrKind_NoInline, CX_AttrKind_NoMerge, + CX_AttrKind_AArch64SVEPcs, CX_AttrKind_AArch64VectorPcs, + CX_AttrKind_AMDGPUKernelCall, CX_AttrKind_AcquireHandle, CX_AttrKind_AnyX86NoCfCheck, CX_AttrKind_CDecl, @@ -86,7 +91,6 @@ public enum CX_AttrKind CX_AttrKind_AllocAlign, CX_AttrKind_AllocSize, CX_AttrKind_AlwaysDestroy, - CX_AttrKind_AlwaysInline, CX_AttrKind_AnalyzerNoReturn, CX_AttrKind_AnyX86Interrupt, CX_AttrKind_AnyX86NoCallerSavedRegisters, @@ -164,10 +168,14 @@ public enum CX_AttrKind CX_AttrKind_Flatten, CX_AttrKind_Format, CX_AttrKind_FormatArg, + CX_AttrKind_FunctionReturnThunks, CX_AttrKind_GNUInline, CX_AttrKind_GuardedBy, CX_AttrKind_GuardedVar, CX_AttrKind_HIPManaged, + CX_AttrKind_HLSLNumThreads, + CX_AttrKind_HLSLSV_GroupIndex, + CX_AttrKind_HLSLShader, CX_AttrKind_Hot, CX_AttrKind_IBAction, CX_AttrKind_IBOutlet, @@ -206,11 +214,11 @@ public enum CX_AttrKind CX_AttrKind_NoDebug, CX_AttrKind_NoDestroy, CX_AttrKind_NoDuplicate, - CX_AttrKind_NoInline, CX_AttrKind_NoInstrumentFunction, CX_AttrKind_NoMicroMips, CX_AttrKind_NoMips16, CX_AttrKind_NoProfileFunction, + CX_AttrKind_NoRandomizeLayout, CX_AttrKind_NoReturn, CX_AttrKind_NoSanitize, CX_AttrKind_NoSpeculativeLoadHardening, @@ -265,6 +273,7 @@ public enum CX_AttrKind CX_AttrKind_PtGuardedVar, CX_AttrKind_Pure, CX_AttrKind_RISCVInterrupt, + CX_AttrKind_RandomizeLayout, CX_AttrKind_Reinitializes, CX_AttrKind_ReleaseCapability, CX_AttrKind_ReqdWorkGroupSize, @@ -325,6 +334,7 @@ public enum CX_AttrKind CX_AttrKind_X86ForceAlignArgPointer, CX_AttrKind_XRayInstrument, CX_AttrKind_XRayLogArgs, + CX_AttrKind_ZeroCallUsedRegs, CX_AttrKind_AbiTag, CX_AttrKind_Alias, CX_AttrKind_AlignValue, @@ -360,11 +370,11 @@ public enum CX_AttrKind CX_AttrKind_LastTypeAttr = CX_AttrKind_UPtr, CX_AttrKind_FirstStmtAttr = CX_AttrKind_FallThrough, CX_AttrKind_LastStmtAttr = CX_AttrKind_Unlikely, - CX_AttrKind_FirstDeclOrStmtAttr = CX_AttrKind_NoMerge, + CX_AttrKind_FirstDeclOrStmtAttr = CX_AttrKind_AlwaysInline, CX_AttrKind_LastDeclOrStmtAttr = CX_AttrKind_NoMerge, - CX_AttrKind_FirstInheritableAttr = CX_AttrKind_NoMerge, - CX_AttrKind_LastInheritableAttr = CX_AttrKind_XRayLogArgs, - CX_AttrKind_FirstDeclOrTypeAttr = CX_AttrKind_AArch64VectorPcs, + CX_AttrKind_FirstInheritableAttr = CX_AttrKind_AlwaysInline, + CX_AttrKind_LastInheritableAttr = CX_AttrKind_ZeroCallUsedRegs, + CX_AttrKind_FirstDeclOrTypeAttr = CX_AttrKind_AArch64SVEPcs, CX_AttrKind_LastDeclOrTypeAttr = CX_AttrKind_VectorCall, CX_AttrKind_FirstInheritableParamAttr = CX_AttrKind_SwiftAsyncContext, CX_AttrKind_LastInheritableParamAttr = CX_AttrKind_UseHandle, diff --git a/sources/ClangSharp.Interop/CX_ConstructionKind.cs b/sources/ClangSharp.Interop/CX_ConstructionKind.cs index 0e42bf67..440489ae 100644 --- a/sources/ClangSharp.Interop/CX_ConstructionKind.cs +++ b/sources/ClangSharp.Interop/CX_ConstructionKind.cs @@ -9,5 +9,5 @@ public enum CX_ConstructionKind CX_CK_Complete, CX_CK_NonVirtualBase, CX_CK_VirtualBase, - CX_CK_Delegating + CX_CK_Delegating, } diff --git a/sources/ClangSharp.Interop/CX_DeclKind.cs b/sources/ClangSharp.Interop/CX_DeclKind.cs index cdb81287..72ea6229 100644 --- a/sources/ClangSharp.Interop/CX_DeclKind.cs +++ b/sources/ClangSharp.Interop/CX_DeclKind.cs @@ -115,6 +115,7 @@ public enum CX_DeclKind CX_DeclKind_OMPDeclareMapper, CX_DeclKind_OMPDeclareReduction, CX_DeclKind_TemplateParamObject, + CX_DeclKind_UnnamedGlobalConstant, CX_DeclKind_UnresolvedUsingValue, CX_DeclKind_FirstValue = CX_DeclKind_Binding, CX_DeclKind_LastValue = CX_DeclKind_UnresolvedUsingValue, diff --git a/sources/ClangSharp.Interop/CX_DestructorType.cs b/sources/ClangSharp.Interop/CX_DestructorType.cs index ef974db1..5c0a6c85 100644 --- a/sources/ClangSharp.Interop/CX_DestructorType.cs +++ b/sources/ClangSharp.Interop/CX_DestructorType.cs @@ -8,5 +8,5 @@ public enum CX_DestructorType Deleting, Complete, Base, - Comdat + Comdat, } diff --git a/sources/ClangSharp.Interop/CX_StmtClass.cs b/sources/ClangSharp.Interop/CX_StmtClass.cs index 83efbad0..b33741c2 100644 --- a/sources/ClangSharp.Interop/CX_StmtClass.cs +++ b/sources/ClangSharp.Interop/CX_StmtClass.cs @@ -44,27 +44,35 @@ public enum CX_StmtClass CX_StmtClass_OMPForDirective, CX_StmtClass_OMPForSimdDirective, CX_StmtClass_OMPGenericLoopDirective, + CX_StmtClass_OMPMaskedTaskLoopDirective, + CX_StmtClass_OMPMaskedTaskLoopSimdDirective, CX_StmtClass_OMPMasterTaskLoopDirective, CX_StmtClass_OMPMasterTaskLoopSimdDirective, CX_StmtClass_OMPParallelForDirective, CX_StmtClass_OMPParallelForSimdDirective, + CX_StmtClass_OMPParallelGenericLoopDirective, + CX_StmtClass_OMPParallelMaskedTaskLoopDirective, + CX_StmtClass_OMPParallelMaskedTaskLoopSimdDirective, CX_StmtClass_OMPParallelMasterTaskLoopDirective, CX_StmtClass_OMPParallelMasterTaskLoopSimdDirective, CX_StmtClass_OMPSimdDirective, CX_StmtClass_OMPTargetParallelForSimdDirective, + CX_StmtClass_OMPTargetParallelGenericLoopDirective, CX_StmtClass_OMPTargetSimdDirective, CX_StmtClass_OMPTargetTeamsDistributeDirective, CX_StmtClass_OMPTargetTeamsDistributeParallelForDirective, CX_StmtClass_OMPTargetTeamsDistributeParallelForSimdDirective, CX_StmtClass_OMPTargetTeamsDistributeSimdDirective, + CX_StmtClass_OMPTargetTeamsGenericLoopDirective, CX_StmtClass_OMPTaskLoopDirective, CX_StmtClass_OMPTaskLoopSimdDirective, CX_StmtClass_OMPTeamsDistributeDirective, CX_StmtClass_OMPTeamsDistributeParallelForDirective, CX_StmtClass_OMPTeamsDistributeParallelForSimdDirective, CX_StmtClass_OMPTeamsDistributeSimdDirective, + CX_StmtClass_OMPTeamsGenericLoopDirective, CX_StmtClass_FirstOMPLoopDirective = CX_StmtClass_OMPDistributeDirective, - CX_StmtClass_LastOMPLoopDirective = CX_StmtClass_OMPTeamsDistributeSimdDirective, + CX_StmtClass_LastOMPLoopDirective = CX_StmtClass_OMPTeamsGenericLoopDirective, CX_StmtClass_OMPTileDirective, CX_StmtClass_OMPUnrollDirective, CX_StmtClass_FirstOMPLoopTransformationDirective = CX_StmtClass_OMPTileDirective, @@ -76,6 +84,7 @@ public enum CX_StmtClass CX_StmtClass_OMPMetaDirective, CX_StmtClass_OMPOrderedDirective, CX_StmtClass_OMPParallelDirective, + CX_StmtClass_OMPParallelMaskedDirective, CX_StmtClass_OMPParallelMasterDirective, CX_StmtClass_OMPParallelSectionsDirective, CX_StmtClass_OMPScanDirective, diff --git a/sources/ClangSharp.Interop/CX_TemplateNameKind.cs b/sources/ClangSharp.Interop/CX_TemplateNameKind.cs index d72a5abc..5c44aa3a 100644 --- a/sources/ClangSharp.Interop/CX_TemplateNameKind.cs +++ b/sources/ClangSharp.Interop/CX_TemplateNameKind.cs @@ -6,11 +6,11 @@ namespace ClangSharp.Interop; public enum CX_TemplateNameKind { CX_TNK_Invalid, - CX_TNK_Template = 1, - CX_TNK_OverloadedTemplate = 2, - CX_TNK_AssumedTemplate = 3, - CX_TNK_QualifiedTemplate = 4, - CX_TNK_DependentTemplate = 5, - CX_TNK_SubstTemplateTemplateParm = 6, - CX_TNK_SubstTemplateTemplateParmPack = 7 + CX_TNK_Template, + CX_TNK_OverloadedTemplate, + CX_TNK_AssumedTemplate, + CX_TNK_QualifiedTemplate, + CX_TNK_DependentTemplate, + CX_TNK_SubstTemplateTemplateParm, + CX_TNK_SubstTemplateTemplateParmPack, } diff --git a/sources/ClangSharp.Interop/CX_TypeClass.cs b/sources/ClangSharp.Interop/CX_TypeClass.cs index 0710d558..f6a7e4c7 100644 --- a/sources/ClangSharp.Interop/CX_TypeClass.cs +++ b/sources/ClangSharp.Interop/CX_TypeClass.cs @@ -14,6 +14,7 @@ public enum CX_TypeClass CX_TypeClass_VariableArray, CX_TypeClass_Atomic, CX_TypeClass_Attributed, + CX_TypeClass_BTFTagAttributed, CX_TypeClass_BitInt, CX_TypeClass_BlockPointer, CX_TypeClass_Builtin, diff --git a/sources/ClangSharp.Interop/CX_VariableCaptureKind.cs b/sources/ClangSharp.Interop/CX_VariableCaptureKind.cs index 417622d6..76350795 100644 --- a/sources/ClangSharp.Interop/CX_VariableCaptureKind.cs +++ b/sources/ClangSharp.Interop/CX_VariableCaptureKind.cs @@ -9,5 +9,5 @@ public enum CX_VariableCaptureKind CX_VCK_This, CX_VCK_ByRef, CX_VCK_ByCopy, - CX_VCK_VLAType + CX_VCK_VLAType, } diff --git a/sources/ClangSharp.Interop/ClangSharp.Interop.csproj b/sources/ClangSharp.Interop/ClangSharp.Interop.csproj index d207d05c..91901ea9 100644 --- a/sources/ClangSharp.Interop/ClangSharp.Interop.csproj +++ b/sources/ClangSharp.Interop/ClangSharp.Interop.csproj @@ -11,8 +11,8 @@ - - + + diff --git a/sources/ClangSharp.Interop/Extensions/CXCursor.cs b/sources/ClangSharp.Interop/Extensions/CXCursor.cs index 18e755b4..9f99df20 100644 --- a/sources/ClangSharp.Interop/Extensions/CXCursor.cs +++ b/sources/ClangSharp.Interop/Extensions/CXCursor.cs @@ -25,25 +25,36 @@ public string AttrKindSpelling { get { - Debug.Assert(CX_AttrKind.CX_AttrKind_FirstDeclOrTypeAttr == CX_AttrKind.CX_AttrKind_AArch64VectorPcs); - Debug.Assert(CX_AttrKind.CX_AttrKind_LastDeclOrTypeAttr == CX_AttrKind.CX_AttrKind_VectorCall); - Debug.Assert(CX_AttrKind.CX_AttrKind_FirstInheritableParamAttr == CX_AttrKind.CX_AttrKind_SwiftAsyncContext); - Debug.Assert(CX_AttrKind.CX_AttrKind_LastInheritableParamAttr == CX_AttrKind.CX_AttrKind_UseHandle); - Debug.Assert(CX_AttrKind.CX_AttrKind_FirstParameterABIAttr == CX_AttrKind.CX_AttrKind_SwiftAsyncContext); - Debug.Assert(CX_AttrKind.CX_AttrKind_LastParameterABIAttr == CX_AttrKind.CX_AttrKind_SwiftIndirectResult); + Debug.Assert(CX_AttrKind.CX_AttrKind_FirstAttr == CX_AttrKind.CX_AttrKind_AddressSpace); Debug.Assert(CX_AttrKind.CX_AttrKind_LastAttr == CX_AttrKind.CX_AttrKind_Thread); + Debug.Assert(CX_AttrKind.CX_AttrKind_FirstTypeAttr == CX_AttrKind.CX_AttrKind_AddressSpace); Debug.Assert(CX_AttrKind.CX_AttrKind_LastTypeAttr == CX_AttrKind.CX_AttrKind_UPtr); + Debug.Assert(CX_AttrKind.CX_AttrKind_FirstStmtAttr == CX_AttrKind.CX_AttrKind_FallThrough); Debug.Assert(CX_AttrKind.CX_AttrKind_LastStmtAttr == CX_AttrKind.CX_AttrKind_Unlikely); - Debug.Assert(CX_AttrKind.CX_AttrKind_FirstInheritableAttr == CX_AttrKind.CX_AttrKind_NoMerge); - Debug.Assert(CX_AttrKind.CX_AttrKind_LastInheritableAttr == CX_AttrKind.CX_AttrKind_XRayLogArgs); - return AttrKind switch - { + Debug.Assert(CX_AttrKind.CX_AttrKind_FirstDeclOrStmtAttr == CX_AttrKind.CX_AttrKind_AlwaysInline); + Debug.Assert(CX_AttrKind.CX_AttrKind_LastDeclOrStmtAttr == CX_AttrKind.CX_AttrKind_NoMerge); + + Debug.Assert(CX_AttrKind.CX_AttrKind_FirstInheritableAttr == CX_AttrKind.CX_AttrKind_AlwaysInline); + Debug.Assert(CX_AttrKind.CX_AttrKind_LastInheritableAttr == CX_AttrKind.CX_AttrKind_ZeroCallUsedRegs); + + Debug.Assert(CX_AttrKind.CX_AttrKind_FirstDeclOrTypeAttr == CX_AttrKind.CX_AttrKind_AArch64SVEPcs); + Debug.Assert(CX_AttrKind.CX_AttrKind_LastDeclOrTypeAttr == CX_AttrKind.CX_AttrKind_VectorCall); + + Debug.Assert(CX_AttrKind.CX_AttrKind_FirstInheritableParamAttr == CX_AttrKind.CX_AttrKind_SwiftAsyncContext); + Debug.Assert(CX_AttrKind.CX_AttrKind_LastInheritableParamAttr == CX_AttrKind.CX_AttrKind_UseHandle); + + Debug.Assert(CX_AttrKind.CX_AttrKind_FirstParameterABIAttr == CX_AttrKind.CX_AttrKind_SwiftAsyncContext); + Debug.Assert(CX_AttrKind.CX_AttrKind_LastParameterABIAttr == CX_AttrKind.CX_AttrKind_SwiftIndirectResult); + + return AttrKind switch { CX_AttrKind.CX_AttrKind_Invalid => "Invalid", CX_AttrKind.CX_AttrKind_AddressSpace => "AddressSpace", + CX_AttrKind.CX_AttrKind_AnnotateType => "AnnotateType", CX_AttrKind.CX_AttrKind_ArmMveStrictPolymorphism => "ArmMveStrictPolymorphism", + CX_AttrKind.CX_AttrKind_BTFTypeTag => "BTFTypeTag", CX_AttrKind.CX_AttrKind_CmseNSCall => "CmseNSCall", CX_AttrKind.CX_AttrKind_NoDeref => "NoDeref", CX_AttrKind.CX_AttrKind_ObjCGC => "ObjCGC", @@ -52,6 +63,8 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_OpenCLConstantAddressSpace => "OpenCLConstantAddressSpace", CX_AttrKind.CX_AttrKind_OpenCLGenericAddressSpace => "OpenCLGenericAddressSpace", CX_AttrKind.CX_AttrKind_OpenCLGlobalAddressSpace => "OpenCLGlobalAddressSpace", + CX_AttrKind.CX_AttrKind_OpenCLGlobalDeviceAddressSpace => "OpenCLGlobalDeviceAddressSpace", + CX_AttrKind.CX_AttrKind_OpenCLGlobalHostAddressSpace => "OpenCLGlobalHostAddressSpace", CX_AttrKind.CX_AttrKind_OpenCLLocalAddressSpace => "OpenCLLocalAddressSpace", CX_AttrKind.CX_AttrKind_OpenCLPrivateAddressSpace => "OpenCLPrivateAddressSpace", CX_AttrKind.CX_AttrKind_Ptr32 => "Ptr32", @@ -60,11 +73,20 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_TypeNonNull => "TypeNonNull", CX_AttrKind.CX_AttrKind_TypeNullUnspecified => "TypeNullUnspecified", CX_AttrKind.CX_AttrKind_TypeNullable => "TypeNullable", + CX_AttrKind.CX_AttrKind_TypeNullableResult => "TypeNullableResult", CX_AttrKind.CX_AttrKind_UPtr => "UPtr", CX_AttrKind.CX_AttrKind_FallThrough => "FallThrough", - CX_AttrKind.CX_AttrKind_NoMerge => "NoMerge", + CX_AttrKind.CX_AttrKind_Likely => "Likely", + CX_AttrKind.CX_AttrKind_MustTail => "MustTail", + CX_AttrKind.CX_AttrKind_OpenCLUnrollHint => "OpenCLUnrollHint", CX_AttrKind.CX_AttrKind_Suppress => "Suppress", + CX_AttrKind.CX_AttrKind_Unlikely => "Unlikely", + CX_AttrKind.CX_AttrKind_AlwaysInline => "AlwaysInline", + CX_AttrKind.CX_AttrKind_NoInline => "NoInline", + CX_AttrKind.CX_AttrKind_NoMerge => "NoMerge", + CX_AttrKind.CX_AttrKind_AArch64SVEPcs => "AArch64SVEPcs", CX_AttrKind.CX_AttrKind_AArch64VectorPcs => "AArch64VectorPcs", + CX_AttrKind.CX_AttrKind_AMDGPUKernelCall => "AMDGPUKernelCall", CX_AttrKind.CX_AttrKind_AcquireHandle => "AcquireHandle", CX_AttrKind.CX_AttrKind_AnyX86NoCfCheck => "AnyX86NoCfCheck", CX_AttrKind.CX_AttrKind_CDecl => "CDecl", @@ -80,10 +102,12 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_PreserveMost => "PreserveMost", CX_AttrKind.CX_AttrKind_RegCall => "RegCall", CX_AttrKind.CX_AttrKind_StdCall => "StdCall", + CX_AttrKind.CX_AttrKind_SwiftAsyncCall => "SwiftAsyncCall", CX_AttrKind.CX_AttrKind_SwiftCall => "SwiftCall", CX_AttrKind.CX_AttrKind_SysVABI => "SysVABI", CX_AttrKind.CX_AttrKind_ThisCall => "ThisCall", CX_AttrKind.CX_AttrKind_VectorCall => "VectorCall", + CX_AttrKind.CX_AttrKind_SwiftAsyncContext => "SwiftAsyncContext", CX_AttrKind.CX_AttrKind_SwiftContext => "SwiftContext", CX_AttrKind.CX_AttrKind_SwiftErrorResult => "SwiftErrorResult", CX_AttrKind.CX_AttrKind_SwiftIndirectResult => "SwiftIndirectResult", @@ -107,11 +131,11 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_AcquiredAfter => "AcquiredAfter", CX_AttrKind.CX_AttrKind_AcquiredBefore => "AcquiredBefore", CX_AttrKind.CX_AttrKind_AlignMac68k => "AlignMac68k", + CX_AttrKind.CX_AttrKind_AlignNatural => "AlignNatural", CX_AttrKind.CX_AttrKind_Aligned => "Aligned", CX_AttrKind.CX_AttrKind_AllocAlign => "AllocAlign", CX_AttrKind.CX_AttrKind_AllocSize => "AllocSize", CX_AttrKind.CX_AttrKind_AlwaysDestroy => "AlwaysDestroy", - CX_AttrKind.CX_AttrKind_AlwaysInline => "AlwaysInline", CX_AttrKind.CX_AttrKind_AnalyzerNoReturn => "AnalyzerNoReturn", CX_AttrKind.CX_AttrKind_AnyX86Interrupt => "AnyX86Interrupt", CX_AttrKind.CX_AttrKind_AnyX86NoCallerSavedRegisters => "AnyX86NoCallerSavedRegisters", @@ -124,9 +148,12 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_AssertExclusiveLock => "AssertExclusiveLock", CX_AttrKind.CX_AttrKind_AssertSharedLock => "AssertSharedLock", CX_AttrKind.CX_AttrKind_AssumeAligned => "AssumeAligned", + CX_AttrKind.CX_AttrKind_Assumption => "Assumption", CX_AttrKind.CX_AttrKind_Availability => "Availability", CX_AttrKind.CX_AttrKind_BPFPreserveAccessIndex => "BPFPreserveAccessIndex", + CX_AttrKind.CX_AttrKind_BTFDeclTag => "BTFDeclTag", CX_AttrKind.CX_AttrKind_Blocks => "Blocks", + CX_AttrKind.CX_AttrKind_Builtin => "Builtin", CX_AttrKind.CX_AttrKind_C11NoReturn => "C11NoReturn", CX_AttrKind.CX_AttrKind_CFAuditedTransfer => "CFAuditedTransfer", CX_AttrKind.CX_AttrKind_CFGuard => "CFGuard", @@ -168,11 +195,16 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_DLLImportStaticLocal => "DLLImportStaticLocal", CX_AttrKind.CX_AttrKind_Deprecated => "Deprecated", CX_AttrKind.CX_AttrKind_Destructor => "Destructor", + CX_AttrKind.CX_AttrKind_DiagnoseAsBuiltin => "DiagnoseAsBuiltin", CX_AttrKind.CX_AttrKind_DiagnoseIf => "DiagnoseIf", + CX_AttrKind.CX_AttrKind_DisableSanitizerInstrumentation => "DisableSanitizerInstrumentation", CX_AttrKind.CX_AttrKind_DisableTailCalls => "DisableTailCalls", CX_AttrKind.CX_AttrKind_EmptyBases => "EmptyBases", CX_AttrKind.CX_AttrKind_EnableIf => "EnableIf", + CX_AttrKind.CX_AttrKind_EnforceTCB => "EnforceTCB", + CX_AttrKind.CX_AttrKind_EnforceTCBLeaf => "EnforceTCBLeaf", CX_AttrKind.CX_AttrKind_EnumExtensibility => "EnumExtensibility", + CX_AttrKind.CX_AttrKind_Error => "Error", CX_AttrKind.CX_AttrKind_ExcludeFromExplicitInstantiation => "ExcludeFromExplicitInstantiation", CX_AttrKind.CX_AttrKind_ExclusiveTrylockFunction => "ExclusiveTrylockFunction", CX_AttrKind.CX_AttrKind_ExternalSourceSymbol => "ExternalSourceSymbol", @@ -181,9 +213,14 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_Flatten => "Flatten", CX_AttrKind.CX_AttrKind_Format => "Format", CX_AttrKind.CX_AttrKind_FormatArg => "FormatArg", + CX_AttrKind.CX_AttrKind_FunctionReturnThunks => "FunctionReturnThunks", CX_AttrKind.CX_AttrKind_GNUInline => "GNUInline", CX_AttrKind.CX_AttrKind_GuardedBy => "GuardedBy", CX_AttrKind.CX_AttrKind_GuardedVar => "GuardedVar", + CX_AttrKind.CX_AttrKind_HIPManaged => "HIPManaged", + CX_AttrKind.CX_AttrKind_HLSLNumThreads => "HLSLNumThreads", + CX_AttrKind.CX_AttrKind_HLSLSV_GroupIndex => "HLSLSV_GroupIndex", + CX_AttrKind.CX_AttrKind_HLSLShader => "HLSLShader", CX_AttrKind.CX_AttrKind_Hot => "Hot", CX_AttrKind.CX_AttrKind_IBAction => "IBAction", CX_AttrKind.CX_AttrKind_IBOutlet => "IBOutlet", @@ -192,8 +229,10 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_InternalLinkage => "InternalLinkage", CX_AttrKind.CX_AttrKind_LTOVisibilityPublic => "LTOVisibilityPublic", CX_AttrKind.CX_AttrKind_LayoutVersion => "LayoutVersion", + CX_AttrKind.CX_AttrKind_Leaf => "Leaf", CX_AttrKind.CX_AttrKind_LockReturned => "LockReturned", CX_AttrKind.CX_AttrKind_LocksExcluded => "LocksExcluded", + CX_AttrKind.CX_AttrKind_M68kInterrupt => "M68kInterrupt", CX_AttrKind.CX_AttrKind_MIGServerRoutine => "MIGServerRoutine", CX_AttrKind.CX_AttrKind_MSAllocator => "MSAllocator", CX_AttrKind.CX_AttrKind_MSInheritance => "MSInheritance", @@ -211,6 +250,7 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_MipsLongCall => "MipsLongCall", CX_AttrKind.CX_AttrKind_MipsShortCall => "MipsShortCall", CX_AttrKind.CX_AttrKind_NSConsumesSelf => "NSConsumesSelf", + CX_AttrKind.CX_AttrKind_NSErrorDomain => "NSErrorDomain", CX_AttrKind.CX_AttrKind_NSReturnsAutoreleased => "NSReturnsAutoreleased", CX_AttrKind.CX_AttrKind_NSReturnsNotRetained => "NSReturnsNotRetained", CX_AttrKind.CX_AttrKind_Naked => "Naked", @@ -219,10 +259,11 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_NoDebug => "NoDebug", CX_AttrKind.CX_AttrKind_NoDestroy => "NoDestroy", CX_AttrKind.CX_AttrKind_NoDuplicate => "NoDuplicate", - CX_AttrKind.CX_AttrKind_NoInline => "NoInline", CX_AttrKind.CX_AttrKind_NoInstrumentFunction => "NoInstrumentFunction", CX_AttrKind.CX_AttrKind_NoMicroMips => "NoMicroMips", CX_AttrKind.CX_AttrKind_NoMips16 => "NoMips16", + CX_AttrKind.CX_AttrKind_NoProfileFunction => "NoProfileFunction", + CX_AttrKind.CX_AttrKind_NoRandomizeLayout => "NoRandomizeLayout", CX_AttrKind.CX_AttrKind_NoReturn => "NoReturn", CX_AttrKind.CX_AttrKind_NoSanitize => "NoSanitize", CX_AttrKind.CX_AttrKind_NoSpeculativeLoadHardening => "NoSpeculativeLoadHardening", @@ -259,7 +300,6 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_ObjCSubclassingRestricted => "ObjCSubclassingRestricted", CX_AttrKind.CX_AttrKind_OpenCLIntelReqdSubGroupSize => "OpenCLIntelReqdSubGroupSize", CX_AttrKind.CX_AttrKind_OpenCLKernel => "OpenCLKernel", - CX_AttrKind.CX_AttrKind_OpenCLUnrollHint => "OpenCLUnrollHint", CX_AttrKind.CX_AttrKind_OptimizeNone => "OptimizeNone", CX_AttrKind.CX_AttrKind_Override => "Override", CX_AttrKind.CX_AttrKind_Owner => "Owner", @@ -273,19 +313,23 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_PragmaClangRelroSection => "PragmaClangRelroSection", CX_AttrKind.CX_AttrKind_PragmaClangRodataSection => "PragmaClangRodataSection", CX_AttrKind.CX_AttrKind_PragmaClangTextSection => "PragmaClangTextSection", + CX_AttrKind.CX_AttrKind_PreferredName => "PreferredName", CX_AttrKind.CX_AttrKind_PtGuardedBy => "PtGuardedBy", CX_AttrKind.CX_AttrKind_PtGuardedVar => "PtGuardedVar", CX_AttrKind.CX_AttrKind_Pure => "Pure", CX_AttrKind.CX_AttrKind_RISCVInterrupt => "RISCVInterrupt", + CX_AttrKind.CX_AttrKind_RandomizeLayout => "RandomizeLayout", CX_AttrKind.CX_AttrKind_Reinitializes => "Reinitializes", CX_AttrKind.CX_AttrKind_ReleaseCapability => "ReleaseCapability", CX_AttrKind.CX_AttrKind_ReqdWorkGroupSize => "ReqdWorkGroupSize", CX_AttrKind.CX_AttrKind_RequiresCapability => "RequiresCapability", CX_AttrKind.CX_AttrKind_Restrict => "Restrict", + CX_AttrKind.CX_AttrKind_Retain => "Retain", CX_AttrKind.CX_AttrKind_ReturnTypestate => "ReturnTypestate", CX_AttrKind.CX_AttrKind_ReturnsNonNull => "ReturnsNonNull", CX_AttrKind.CX_AttrKind_ReturnsTwice => "ReturnsTwice", CX_AttrKind.CX_AttrKind_SYCLKernel => "SYCLKernel", + CX_AttrKind.CX_AttrKind_SYCLSpecialClass => "SYCLSpecialClass", CX_AttrKind.CX_AttrKind_ScopedLockable => "ScopedLockable", CX_AttrKind.CX_AttrKind_Section => "Section", CX_AttrKind.CX_AttrKind_SelectAny => "SelectAny", @@ -293,8 +337,21 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_SetTypestate => "SetTypestate", CX_AttrKind.CX_AttrKind_SharedTrylockFunction => "SharedTrylockFunction", CX_AttrKind.CX_AttrKind_SpeculativeLoadHardening => "SpeculativeLoadHardening", + CX_AttrKind.CX_AttrKind_StandaloneDebug => "StandaloneDebug", + CX_AttrKind.CX_AttrKind_StrictFP => "StrictFP", + CX_AttrKind.CX_AttrKind_SwiftAsync => "SwiftAsync", + CX_AttrKind.CX_AttrKind_SwiftAsyncError => "SwiftAsyncError", + CX_AttrKind.CX_AttrKind_SwiftAsyncName => "SwiftAsyncName", + CX_AttrKind.CX_AttrKind_SwiftAttr => "SwiftAttr", + CX_AttrKind.CX_AttrKind_SwiftBridge => "SwiftBridge", + CX_AttrKind.CX_AttrKind_SwiftBridgedTypedef => "SwiftBridgedTypedef", + CX_AttrKind.CX_AttrKind_SwiftError => "SwiftError", + CX_AttrKind.CX_AttrKind_SwiftName => "SwiftName", + CX_AttrKind.CX_AttrKind_SwiftNewType => "SwiftNewType", + CX_AttrKind.CX_AttrKind_SwiftPrivate => "SwiftPrivate", CX_AttrKind.CX_AttrKind_TLSModel => "TLSModel", CX_AttrKind.CX_AttrKind_Target => "Target", + CX_AttrKind.CX_AttrKind_TargetClones => "TargetClones", CX_AttrKind.CX_AttrKind_TestTypestate => "TestTypestate", CX_AttrKind.CX_AttrKind_TransparentUnion => "TransparentUnion", CX_AttrKind.CX_AttrKind_TrivialABI => "TrivialABI", @@ -305,6 +362,7 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_Uninitialized => "Uninitialized", CX_AttrKind.CX_AttrKind_Unused => "Unused", CX_AttrKind.CX_AttrKind_Used => "Used", + CX_AttrKind.CX_AttrKind_UsingIfExists => "UsingIfExists", CX_AttrKind.CX_AttrKind_Uuid => "Uuid", CX_AttrKind.CX_AttrKind_VecReturn => "VecReturn", CX_AttrKind.CX_AttrKind_VecTypeHint => "VecTypeHint", @@ -321,9 +379,12 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_X86ForceAlignArgPointer => "X86ForceAlignArgPointer", CX_AttrKind.CX_AttrKind_XRayInstrument => "XRayInstrument", CX_AttrKind.CX_AttrKind_XRayLogArgs => "XRayLogArgs", + CX_AttrKind.CX_AttrKind_ZeroCallUsedRegs => "ZeroCallUsedRegs", CX_AttrKind.CX_AttrKind_AbiTag => "AbiTag", CX_AttrKind.CX_AttrKind_Alias => "Alias", CX_AttrKind.CX_AttrKind_AlignValue => "AlignValue", + CX_AttrKind.CX_AttrKind_BuiltinAlias => "BuiltinAlias", + CX_AttrKind.CX_AttrKind_CalledOnce => "CalledOnce", CX_AttrKind.CX_AttrKind_IFunc => "IFunc", CX_AttrKind.CX_AttrKind_InitSeg => "InitSeg", CX_AttrKind.CX_AttrKind_LoaderUninitialized => "LoaderUninitialized", @@ -340,11 +401,13 @@ public string AttrKindSpelling CX_AttrKind.CX_AttrKind_ObjCDirect => "ObjCDirect", CX_AttrKind.CX_AttrKind_ObjCDirectMembers => "ObjCDirectMembers", CX_AttrKind.CX_AttrKind_ObjCNonLazyClass => "ObjCNonLazyClass", + CX_AttrKind.CX_AttrKind_ObjCNonRuntimeProtocol => "ObjCNonRuntimeProtocol", CX_AttrKind.CX_AttrKind_ObjCRuntimeName => "ObjCRuntimeName", CX_AttrKind.CX_AttrKind_ObjCRuntimeVisible => "ObjCRuntimeVisible", CX_AttrKind.CX_AttrKind_OpenCLAccess => "OpenCLAccess", CX_AttrKind.CX_AttrKind_Overloadable => "Overloadable", CX_AttrKind.CX_AttrKind_RenderScriptKernel => "RenderScriptKernel", + CX_AttrKind.CX_AttrKind_SwiftObjCMembers => "SwiftObjCMembers", CX_AttrKind.CX_AttrKind_Thread => "Thread", _ => Kind.ToString()[12..], }; @@ -393,8 +456,7 @@ public string CastKindSpelling { get { - return CastKind switch - { + return CastKind switch { CX_CastKind.CX_CK_Invalid => "Invalid", CX_CastKind.CX_CK_Dependent => "Dependent", CX_CastKind.CX_CK_BitCast => "BitCast", @@ -426,6 +488,8 @@ public string CastKindSpelling CX_CastKind.CX_CK_IntegralCast => "IntegralCast", CX_CastKind.CX_CK_IntegralToBoolean => "IntegralToBoolean", CX_CastKind.CX_CK_IntegralToFloating => "IntegralToFloating", + CX_CastKind.CX_CK_FloatingToFixedPoint => "FloatingToFixedPoint", + CX_CastKind.CX_CK_FixedPointToFloating => "FixedPointToFloating", CX_CastKind.CX_CK_FixedPointCast => "FixedPointCast", CX_CastKind.CX_CK_FixedPointToIntegral => "FixedPointToIntegral", CX_CastKind.CX_CK_IntegralToFixedPoint => "IntegralToFixedPoint", @@ -526,49 +590,70 @@ public string DeclKindSpelling { get { + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstBaseUsing == CX_DeclKind.CX_DeclKind_Using); + Debug.Assert(CX_DeclKind.CX_DeclKind_LastBaseUsing == CX_DeclKind.CX_DeclKind_UsingEnum); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstObjCImpl == CX_DeclKind.CX_DeclKind_ObjCCategoryImpl); Debug.Assert(CX_DeclKind.CX_DeclKind_LastObjCImpl == CX_DeclKind.CX_DeclKind_ObjCImplementation); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstObjCContainer == CX_DeclKind.CX_DeclKind_ObjCCategory); Debug.Assert(CX_DeclKind.CX_DeclKind_LastObjCContainer == CX_DeclKind.CX_DeclKind_ObjCProtocol); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstRedeclarableTemplate == CX_DeclKind.CX_DeclKind_ClassTemplate); Debug.Assert(CX_DeclKind.CX_DeclKind_LastRedeclarableTemplate == CX_DeclKind.CX_DeclKind_VarTemplate); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstTemplate == CX_DeclKind.CX_DeclKind_BuiltinTemplate); Debug.Assert(CX_DeclKind.CX_DeclKind_LastTemplate == CX_DeclKind.CX_DeclKind_TemplateTemplateParm); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstClassTemplateSpecialization == CX_DeclKind.CX_DeclKind_ClassTemplateSpecialization); Debug.Assert(CX_DeclKind.CX_DeclKind_LastClassTemplateSpecialization == CX_DeclKind.CX_DeclKind_ClassTemplatePartialSpecialization); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstCXXRecord == CX_DeclKind.CX_DeclKind_CXXRecord); Debug.Assert(CX_DeclKind.CX_DeclKind_LastCXXRecord == CX_DeclKind.CX_DeclKind_ClassTemplatePartialSpecialization); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstRecord == CX_DeclKind.CX_DeclKind_Record); Debug.Assert(CX_DeclKind.CX_DeclKind_LastRecord == CX_DeclKind.CX_DeclKind_ClassTemplatePartialSpecialization); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstTag == CX_DeclKind.CX_DeclKind_Enum); Debug.Assert(CX_DeclKind.CX_DeclKind_LastTag == CX_DeclKind.CX_DeclKind_ClassTemplatePartialSpecialization); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstTypedefName == CX_DeclKind.CX_DeclKind_ObjCTypeParam); Debug.Assert(CX_DeclKind.CX_DeclKind_LastTypedefName == CX_DeclKind.CX_DeclKind_Typedef); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstType == CX_DeclKind.CX_DeclKind_Enum); Debug.Assert(CX_DeclKind.CX_DeclKind_LastType == CX_DeclKind.CX_DeclKind_UnresolvedUsingTypename); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstUsingShadow == CX_DeclKind.CX_DeclKind_UsingShadow); Debug.Assert(CX_DeclKind.CX_DeclKind_LastUsingShadow == CX_DeclKind.CX_DeclKind_ConstructorUsingShadow); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstField == CX_DeclKind.CX_DeclKind_Field); Debug.Assert(CX_DeclKind.CX_DeclKind_LastField == CX_DeclKind.CX_DeclKind_ObjCIvar); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstCXXMethod == CX_DeclKind.CX_DeclKind_CXXMethod); Debug.Assert(CX_DeclKind.CX_DeclKind_LastCXXMethod == CX_DeclKind.CX_DeclKind_CXXDestructor); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstFunction == CX_DeclKind.CX_DeclKind_Function); Debug.Assert(CX_DeclKind.CX_DeclKind_LastFunction == CX_DeclKind.CX_DeclKind_CXXDestructor); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstVarTemplateSpecialization == CX_DeclKind.CX_DeclKind_VarTemplateSpecialization); Debug.Assert(CX_DeclKind.CX_DeclKind_LastVarTemplateSpecialization == CX_DeclKind.CX_DeclKind_VarTemplatePartialSpecialization); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstVar == CX_DeclKind.CX_DeclKind_Var); Debug.Assert(CX_DeclKind.CX_DeclKind_LastVar == CX_DeclKind.CX_DeclKind_VarTemplatePartialSpecialization); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstDeclarator == CX_DeclKind.CX_DeclKind_Field); Debug.Assert(CX_DeclKind.CX_DeclKind_LastDeclarator == CX_DeclKind.CX_DeclKind_VarTemplatePartialSpecialization); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstValue == CX_DeclKind.CX_DeclKind_Binding); Debug.Assert(CX_DeclKind.CX_DeclKind_LastValue == CX_DeclKind.CX_DeclKind_UnresolvedUsingValue); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstNamed == CX_DeclKind.CX_DeclKind_Using); Debug.Assert(CX_DeclKind.CX_DeclKind_LastNamed == CX_DeclKind.CX_DeclKind_UnresolvedUsingValue); + Debug.Assert(CX_DeclKind.CX_DeclKind_FirstDecl == CX_DeclKind.CX_DeclKind_AccessSpec); Debug.Assert(CX_DeclKind.CX_DeclKind_LastDecl == CX_DeclKind.CX_DeclKind_TranslationUnit); - return DeclKind switch - { + return DeclKind switch { CX_DeclKind.CX_DeclKind_Invalid => "Invalid", CX_DeclKind.CX_DeclKind_AccessSpec => "AccessSpec", CX_DeclKind.CX_DeclKind_Block => "Block", @@ -583,6 +668,8 @@ public string DeclKindSpelling CX_DeclKind.CX_DeclKind_Import => "Import", CX_DeclKind.CX_DeclKind_LifetimeExtendedTemporary => "LifetimeExtendedTemporary", CX_DeclKind.CX_DeclKind_LinkageSpec => "LinkageSpec", + CX_DeclKind.CX_DeclKind_Using => "Using", + CX_DeclKind.CX_DeclKind_UsingEnum => "UsingEnum", CX_DeclKind.CX_DeclKind_Label => "Label", CX_DeclKind.CX_DeclKind_Namespace => "Namespace", CX_DeclKind.CX_DeclKind_NamespaceAlias => "NamespaceAlias", @@ -611,7 +698,7 @@ public string DeclKindSpelling CX_DeclKind.CX_DeclKind_TypeAlias => "TypeAlias", CX_DeclKind.CX_DeclKind_Typedef => "Typedef", CX_DeclKind.CX_DeclKind_UnresolvedUsingTypename => "UnresolvedUsingTypename", - CX_DeclKind.CX_DeclKind_Using => "Using", + CX_DeclKind.CX_DeclKind_UnresolvedUsingIfExists => "UnresolvedUsingIfExists", CX_DeclKind.CX_DeclKind_UsingDirective => "UsingDirective", CX_DeclKind.CX_DeclKind_UsingPack => "UsingPack", CX_DeclKind.CX_DeclKind_UsingShadow => "UsingShadow", @@ -640,6 +727,8 @@ public string DeclKindSpelling CX_DeclKind.CX_DeclKind_MSGuid => "MSGuid", CX_DeclKind.CX_DeclKind_OMPDeclareMapper => "OMPDeclareMapper", CX_DeclKind.CX_DeclKind_OMPDeclareReduction => "OMPDeclareReduction", + CX_DeclKind.CX_DeclKind_TemplateParamObject => "TemplateParamObject", + CX_DeclKind.CX_DeclKind_UnnamedGlobalConstant => "UnnamedGlobalConstant", CX_DeclKind.CX_DeclKind_UnresolvedUsingValue => "UnresolvedUsingValue", CX_DeclKind.CX_DeclKind_OMPAllocate => "OMPAllocate", CX_DeclKind.CX_DeclKind_OMPRequires => "OMPRequires", @@ -1115,41 +1204,62 @@ public string StmtClassSpelling { Debug.Assert(CX_StmtClass.CX_StmtClass_FirstAsmStmt == CX_StmtClass.CX_StmtClass_GCCAsmStmt); Debug.Assert(CX_StmtClass.CX_StmtClass_LastAsmStmt == CX_StmtClass.CX_StmtClass_MSAsmStmt); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstOMPLoopDirective == CX_StmtClass.CX_StmtClass_OMPDistributeDirective); - Debug.Assert(CX_StmtClass.CX_StmtClass_LastOMPLoopDirective == CX_StmtClass.CX_StmtClass_OMPTeamsDistributeSimdDirective); + Debug.Assert(CX_StmtClass.CX_StmtClass_LastOMPLoopDirective == CX_StmtClass.CX_StmtClass_OMPTeamsGenericLoopDirective); + + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstOMPLoopTransformationDirective == CX_StmtClass.CX_StmtClass_OMPTileDirective); + Debug.Assert(CX_StmtClass.CX_StmtClass_LastOMPLoopTransformationDirective == CX_StmtClass.CX_StmtClass_OMPUnrollDirective); + + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstOMPLoopBasedDirective == CX_StmtClass.CX_StmtClass_OMPDistributeDirective); + Debug.Assert(CX_StmtClass.CX_StmtClass_LastOMPLoopBasedDirective == CX_StmtClass.CX_StmtClass_OMPUnrollDirective); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstOMPExecutableDirective == CX_StmtClass.CX_StmtClass_OMPAtomicDirective); Debug.Assert(CX_StmtClass.CX_StmtClass_LastOMPExecutableDirective == CX_StmtClass.CX_StmtClass_OMPTeamsDirective); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstSwitchCase == CX_StmtClass.CX_StmtClass_CaseStmt); Debug.Assert(CX_StmtClass.CX_StmtClass_LastSwitchCase == CX_StmtClass.CX_StmtClass_DefaultStmt); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstAbstractConditionalOperator == CX_StmtClass.CX_StmtClass_BinaryConditionalOperator); Debug.Assert(CX_StmtClass.CX_StmtClass_LastAbstractConditionalOperator == CX_StmtClass.CX_StmtClass_ConditionalOperator); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstBinaryOperator == CX_StmtClass.CX_StmtClass_BinaryOperator); Debug.Assert(CX_StmtClass.CX_StmtClass_LastBinaryOperator == CX_StmtClass.CX_StmtClass_CompoundAssignOperator); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstCXXConstructExpr == CX_StmtClass.CX_StmtClass_CXXConstructExpr); Debug.Assert(CX_StmtClass.CX_StmtClass_LastCXXConstructExpr == CX_StmtClass.CX_StmtClass_CXXTemporaryObjectExpr); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstCallExpr == CX_StmtClass.CX_StmtClass_CallExpr); Debug.Assert(CX_StmtClass.CX_StmtClass_LastCallExpr == CX_StmtClass.CX_StmtClass_UserDefinedLiteral); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstCXXNamedCastExpr == CX_StmtClass.CX_StmtClass_CXXAddrspaceCastExpr); Debug.Assert(CX_StmtClass.CX_StmtClass_LastCXXNamedCastExpr == CX_StmtClass.CX_StmtClass_CXXStaticCastExpr); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstExplicitCastExpr == CX_StmtClass.CX_StmtClass_BuiltinBitCastExpr); Debug.Assert(CX_StmtClass.CX_StmtClass_LastExplicitCastExpr == CX_StmtClass.CX_StmtClass_ObjCBridgedCastExpr); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstCastExpr == CX_StmtClass.CX_StmtClass_BuiltinBitCastExpr); Debug.Assert(CX_StmtClass.CX_StmtClass_LastCastExpr == CX_StmtClass.CX_StmtClass_ImplicitCastExpr); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstCoroutineSuspendExpr == CX_StmtClass.CX_StmtClass_CoawaitExpr); Debug.Assert(CX_StmtClass.CX_StmtClass_LastCoroutineSuspendExpr == CX_StmtClass.CX_StmtClass_CoyieldExpr); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstFullExpr == CX_StmtClass.CX_StmtClass_ConstantExpr); Debug.Assert(CX_StmtClass.CX_StmtClass_LastFullExpr == CX_StmtClass.CX_StmtClass_ExprWithCleanups); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstOverloadExpr == CX_StmtClass.CX_StmtClass_UnresolvedLookupExpr); Debug.Assert(CX_StmtClass.CX_StmtClass_LastOverloadExpr == CX_StmtClass.CX_StmtClass_UnresolvedMemberExpr); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstExpr == CX_StmtClass.CX_StmtClass_BinaryConditionalOperator); Debug.Assert(CX_StmtClass.CX_StmtClass_LastExpr == CX_StmtClass.CX_StmtClass_VAArgExpr); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstValueStmt == CX_StmtClass.CX_StmtClass_AttributedStmt); Debug.Assert(CX_StmtClass.CX_StmtClass_LastValueStmt == CX_StmtClass.CX_StmtClass_LabelStmt); + Debug.Assert(CX_StmtClass.CX_StmtClass_FirstStmt == CX_StmtClass.CX_StmtClass_GCCAsmStmt); Debug.Assert(CX_StmtClass.CX_StmtClass_LastStmt == CX_StmtClass.CX_StmtClass_WhileStmt); - return StmtClass switch - { + return StmtClass switch { CX_StmtClass.CX_StmtClass_Invalid => "Invalid", CX_StmtClass.CX_StmtClass_GCCAsmStmt => "GCCAsmStmt", CX_StmtClass.CX_StmtClass_MSAsmStmt => "MSAsmStmt", @@ -1170,41 +1280,58 @@ public string StmtClassSpelling CX_StmtClass.CX_StmtClass_IndirectGotoStmt => "IndirectGotoStmt", CX_StmtClass.CX_StmtClass_MSDependentExistsStmt => "MSDependentExistsStmt", CX_StmtClass.CX_StmtClass_NullStmt => "NullStmt", + CX_StmtClass.CX_StmtClass_OMPCanonicalLoop => "OMPCanonicalLoop", CX_StmtClass.CX_StmtClass_OMPAtomicDirective => "OMPAtomicDirective", CX_StmtClass.CX_StmtClass_OMPBarrierDirective => "OMPBarrierDirective", CX_StmtClass.CX_StmtClass_OMPCancelDirective => "OMPCancelDirective", CX_StmtClass.CX_StmtClass_OMPCancellationPointDirective => "OMPCancellationPointDirective", CX_StmtClass.CX_StmtClass_OMPCriticalDirective => "OMPCriticalDirective", CX_StmtClass.CX_StmtClass_OMPDepobjDirective => "OMPDepobjDirective", + CX_StmtClass.CX_StmtClass_OMPDispatchDirective => "OMPDispatchDirective", CX_StmtClass.CX_StmtClass_OMPFlushDirective => "OMPFlushDirective", + CX_StmtClass.CX_StmtClass_OMPInteropDirective => "OMPInteropDirective", CX_StmtClass.CX_StmtClass_OMPDistributeDirective => "OMPDistributeDirective", CX_StmtClass.CX_StmtClass_OMPDistributeParallelForDirective => "OMPDistributeParallelForDirective", CX_StmtClass.CX_StmtClass_OMPDistributeParallelForSimdDirective => "OMPDistributeParallelForSimdDirective", CX_StmtClass.CX_StmtClass_OMPDistributeSimdDirective => "OMPDistributeSimdDirective", CX_StmtClass.CX_StmtClass_OMPForDirective => "OMPForDirective", CX_StmtClass.CX_StmtClass_OMPForSimdDirective => "OMPForSimdDirective", + CX_StmtClass.CX_StmtClass_OMPGenericLoopDirective => "OMPGenericLoopDirective", + CX_StmtClass.CX_StmtClass_OMPMaskedTaskLoopDirective => "OMPMaskedTaskLoopDirective", + CX_StmtClass.CX_StmtClass_OMPMaskedTaskLoopSimdDirective => "OMPMaskedTaskLoopSimdDirective", CX_StmtClass.CX_StmtClass_OMPMasterTaskLoopDirective => "OMPMasterTaskLoopDirective", CX_StmtClass.CX_StmtClass_OMPMasterTaskLoopSimdDirective => "OMPMasterTaskLoopSimdDirective", CX_StmtClass.CX_StmtClass_OMPParallelForDirective => "OMPParallelForDirective", CX_StmtClass.CX_StmtClass_OMPParallelForSimdDirective => "OMPParallelForSimdDirective", + CX_StmtClass.CX_StmtClass_OMPParallelGenericLoopDirective => "OMPParallelGenericLoopDirective", + CX_StmtClass.CX_StmtClass_OMPParallelMaskedTaskLoopDirective => "OMPParallelMaskedTaskLoopDirective", + CX_StmtClass.CX_StmtClass_OMPParallelMaskedTaskLoopSimdDirective => "OMPParallelMaskedTaskLoopSimdDirective", CX_StmtClass.CX_StmtClass_OMPParallelMasterTaskLoopDirective => "OMPParallelMasterTaskLoopDirective", CX_StmtClass.CX_StmtClass_OMPParallelMasterTaskLoopSimdDirective => "OMPParallelMasterTaskLoopSimdDirective", CX_StmtClass.CX_StmtClass_OMPSimdDirective => "OMPSimdDirective", CX_StmtClass.CX_StmtClass_OMPTargetParallelForSimdDirective => "OMPTargetParallelForSimdDirective", + CX_StmtClass.CX_StmtClass_OMPTargetParallelGenericLoopDirective => "OMPTargetParallelGenericLoopDirective", CX_StmtClass.CX_StmtClass_OMPTargetSimdDirective => "OMPTargetSimdDirective", CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeDirective => "OMPTargetTeamsDistributeDirective", CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeParallelForDirective => "OMPTargetTeamsDistributeParallelForDirective", CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeParallelForSimdDirective => "OMPTargetTeamsDistributeParallelForSimdDirective", CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeSimdDirective => "OMPTargetTeamsDistributeSimdDirective", + CX_StmtClass.CX_StmtClass_OMPTargetTeamsGenericLoopDirective => "OMPTargetTeamsGenericLoopDirective", CX_StmtClass.CX_StmtClass_OMPTaskLoopDirective => "OMPTaskLoopDirective", CX_StmtClass.CX_StmtClass_OMPTaskLoopSimdDirective => "OMPTaskLoopSimdDirective", CX_StmtClass.CX_StmtClass_OMPTeamsDistributeDirective => "OMPTeamsDistributeDirective", CX_StmtClass.CX_StmtClass_OMPTeamsDistributeParallelForDirective => "OMPTeamsDistributeParallelForDirective", CX_StmtClass.CX_StmtClass_OMPTeamsDistributeParallelForSimdDirective => "OMPTeamsDistributeParallelForSimdDirective", CX_StmtClass.CX_StmtClass_OMPTeamsDistributeSimdDirective => "OMPTeamsDistributeSimdDirective", + CX_StmtClass.CX_StmtClass_OMPTeamsGenericLoopDirective => "OMPTeamsGenericLoopDirective", + CX_StmtClass.CX_StmtClass_OMPTileDirective => "OMPTileDirective", + CX_StmtClass.CX_StmtClass_OMPUnrollDirective => "OMPUnrollDirective", + CX_StmtClass.CX_StmtClass_OMPMaskedDirective => "OMPMaskedDirective", CX_StmtClass.CX_StmtClass_OMPMasterDirective => "OMPMasterDirective", + CX_StmtClass.CX_StmtClass_OMPMetaDirective => "OMPMetaDirective", CX_StmtClass.CX_StmtClass_OMPOrderedDirective => "OMPOrderedDirective", CX_StmtClass.CX_StmtClass_OMPParallelDirective => "OMPParallelDirective", + CX_StmtClass.CX_StmtClass_OMPParallelMaskedDirective => "OMPParallelMaskedDirective", CX_StmtClass.CX_StmtClass_OMPParallelMasterDirective => "OMPParallelMasterDirective", CX_StmtClass.CX_StmtClass_OMPParallelSectionsDirective => "OMPParallelSectionsDirective", CX_StmtClass.CX_StmtClass_OMPScanDirective => "OMPScanDirective", @@ -1350,6 +1477,7 @@ public string StmtClassSpelling CX_StmtClass.CX_StmtClass_PseudoObjectExpr => "PseudoObjectExpr", CX_StmtClass.CX_StmtClass_RecoveryExpr => "RecoveryExpr", CX_StmtClass.CX_StmtClass_RequiresExpr => "RequiresExpr", + CX_StmtClass.CX_StmtClass_SYCLUniqueStableNameExpr => "SYCLUniqueStableNameExpr", CX_StmtClass.CX_StmtClass_ShuffleVectorExpr => "ShuffleVectorExpr", CX_StmtClass.CX_StmtClass_SizeOfPackExpr => "SizeOfPackExpr", CX_StmtClass.CX_StmtClass_SourceLocExpr => "SourceLocExpr", @@ -1614,10 +1742,15 @@ public int GetPlatformAvailability(out bool alwaysDeprecated, out CXString depre public CXChildVisitResult VisitChildren(CXCursorVisitor visitor, CXClientData clientData) { - var pVisitor = Marshal.GetFunctionPointerForDelegate(visitor); - var result = (CXChildVisitResult)clang.visitChildren(this, pVisitor, clientData); + var pVisitor = (delegate* unmanaged[Cdecl])Marshal.GetFunctionPointerForDelegate(visitor); + var result = VisitChildren(pVisitor, clientData); GC.KeepAlive(visitor); return result; } + + public CXChildVisitResult VisitChildren(delegate* unmanaged[Cdecl] visitor, CXClientData clientData) + { + return (CXChildVisitResult)clang.visitChildren(this, visitor, clientData); + } } diff --git a/sources/ClangSharp.Interop/Extensions/CXTranslationUnit.cs b/sources/ClangSharp.Interop/Extensions/CXTranslationUnit.cs index 8bc668fc..cfcf02ec 100644 --- a/sources/ClangSharp.Interop/Extensions/CXTranslationUnit.cs +++ b/sources/ClangSharp.Interop/Extensions/CXTranslationUnit.cs @@ -185,11 +185,16 @@ public ReadOnlySpan GetFileContents(CXFile file, out UIntPtr size) public void GetInclusions(CXInclusionVisitor visitor, CXClientData clientData) { - var pVisitor = Marshal.GetFunctionPointerForDelegate(visitor); - clang.getInclusions(this, pVisitor, clientData); + var pVisitor = (delegate* unmanaged[Cdecl])Marshal.GetFunctionPointerForDelegate(visitor); + GetInclusions(pVisitor, clientData); GC.KeepAlive(visitor); } + public void GetInclusions(delegate* unmanaged[Cdecl] visitor, CXClientData clientData) + { + clang.getInclusions(this, visitor, clientData); + } + public CXSourceLocation GetLocation(CXFile file, uint line, uint column) => clang.getLocation(this, file, line, column); public CXSourceLocation GetLocationForOffset(CXFile file, uint offset) => clang.getLocationForOffset(this, file, offset); diff --git a/sources/ClangSharp.Interop/Extensions/CXType.cs b/sources/ClangSharp.Interop/Extensions/CXType.cs index 21d8b2a5..35502d50 100644 --- a/sources/ClangSharp.Interop/Extensions/CXType.cs +++ b/sources/ClangSharp.Interop/Extensions/CXType.cs @@ -145,8 +145,7 @@ public string TypeClassSpelling Debug.Assert(CX_TypeClass.CX_TypeClass_TagFirst == CX_TypeClass.CX_TypeClass_Record); Debug.Assert(CX_TypeClass.CX_TypeClass_TagLast == CX_TypeClass.CX_TypeClass_Enum); - return TypeClass switch - { + return TypeClass switch { CX_TypeClass.CX_TypeClass_Invalid => "Invalid", CX_TypeClass.CX_TypeClass_Adjusted => "Adjusted", CX_TypeClass.CX_TypeClass_Decayed => "Decayed", @@ -156,6 +155,8 @@ public string TypeClassSpelling CX_TypeClass.CX_TypeClass_VariableArray => "VariableArray", CX_TypeClass.CX_TypeClass_Atomic => "Atomic", CX_TypeClass.CX_TypeClass_Attributed => "Attributed", + CX_TypeClass.CX_TypeClass_BTFTagAttributed => "BTFTagAttributed", + CX_TypeClass.CX_TypeClass_BitInt => "BitInt", CX_TypeClass.CX_TypeClass_BlockPointer => "BlockPointer", CX_TypeClass.CX_TypeClass_Builtin => "Builtin", CX_TypeClass.CX_TypeClass_Complex => "Complex", @@ -169,7 +170,6 @@ public string TypeClassSpelling CX_TypeClass.CX_TypeClass_DependentTemplateSpecialization => "DependentTemplateSpecialization", CX_TypeClass.CX_TypeClass_DependentVector => "DependentVector", CX_TypeClass.CX_TypeClass_Elaborated => "Elaborated", - CX_TypeClass.CX_TypeClass_BitInt => "BitInt", CX_TypeClass.CX_TypeClass_FunctionNoProto => "FunctionNoProto", CX_TypeClass.CX_TypeClass_FunctionProto => "FunctionProto", CX_TypeClass.CX_TypeClass_InjectedClassName => "InjectedClassName", @@ -198,6 +198,7 @@ public string TypeClassSpelling CX_TypeClass.CX_TypeClass_Typedef => "Typedef", CX_TypeClass.CX_TypeClass_UnaryTransform => "UnaryTransform", CX_TypeClass.CX_TypeClass_UnresolvedUsing => "UnresolvedUsing", + CX_TypeClass.CX_TypeClass_Using => "Using", CX_TypeClass.CX_TypeClass_Vector => "Vector", CX_TypeClass.CX_TypeClass_ExtVector => "ExtVector", _ => TypeClass.ToString()[13..], @@ -245,10 +246,15 @@ public long GetOffsetOf(string s) public CXVisitorResult VisitFields(CXFieldVisitor visitor, CXClientData clientData) { - var pVisitor = Marshal.GetFunctionPointerForDelegate(visitor); - var result = (CXVisitorResult)clang.Type_visitFields(this, pVisitor, clientData); + var pVisitor = (delegate* unmanaged[Cdecl])Marshal.GetFunctionPointerForDelegate(visitor); + var result = VisitFields(pVisitor, clientData); GC.KeepAlive(visitor); return result; } + + public CXVisitorResult VisitFields(delegate* unmanaged[Cdecl] visitor, CXClientData clientData) + { + return (CXVisitorResult)clang.Type_visitFields(this, visitor, clientData); + } } diff --git a/sources/ClangSharp.Interop/Extensions/clang.ResolveLibrary.cs b/sources/ClangSharp.Interop/Extensions/clang.ResolveLibrary.cs index 95212acd..2cf49917 100644 --- a/sources/ClangSharp.Interop/Extensions/clang.ResolveLibrary.cs +++ b/sources/ClangSharp.Interop/Extensions/clang.ResolveLibrary.cs @@ -7,11 +7,11 @@ namespace ClangSharp.Interop; -public static unsafe partial class clang +public static unsafe partial class @clang { public static event DllImportResolver ResolveLibrary; - static clang() + static @clang() { NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), OnDllImport); } diff --git a/sources/ClangSharp.Interop/IndexerCallbacks.cs b/sources/ClangSharp.Interop/IndexerCallbacks.cs index 8d823bf7..1c4ee8d1 100644 --- a/sources/ClangSharp.Interop/IndexerCallbacks.cs +++ b/sources/ClangSharp.Interop/IndexerCallbacks.cs @@ -3,33 +3,31 @@ // Ported from https://github.com/llvm/llvm-project/tree/llvmorg-15.0.0/clang/include/clang-c // Original source is Copyright (c) the LLVM Project and Contributors. Licensed under the Apache License v2.0 with LLVM Exceptions. See NOTICE.txt in the project root for license information. -using System; - namespace ClangSharp.Interop; -public partial struct IndexerCallbacks +public unsafe partial struct IndexerCallbacks { [NativeTypeName("int (*)(CXClientData, void *)")] - public IntPtr abortQuery; + public delegate* unmanaged[Cdecl] abortQuery; [NativeTypeName("void (*)(CXClientData, CXDiagnosticSet, void *)")] - public IntPtr diagnostic; + public delegate* unmanaged[Cdecl] diagnostic; [NativeTypeName("CXIdxClientFile (*)(CXClientData, CXFile, void *)")] - public IntPtr enteredMainFile; + public delegate* unmanaged[Cdecl] enteredMainFile; [NativeTypeName("CXIdxClientFile (*)(CXClientData, const CXIdxIncludedFileInfo *)")] - public IntPtr ppIncludedFile; + public delegate* unmanaged[Cdecl] ppIncludedFile; [NativeTypeName("CXIdxClientASTFile (*)(CXClientData, const CXIdxImportedASTFileInfo *)")] - public IntPtr importedASTFile; + public delegate* unmanaged[Cdecl] importedASTFile; [NativeTypeName("CXIdxClientContainer (*)(CXClientData, void *)")] - public IntPtr startedTranslationUnit; + public delegate* unmanaged[Cdecl] startedTranslationUnit; [NativeTypeName("void (*)(CXClientData, const CXIdxDeclInfo *)")] - public IntPtr indexDeclaration; + public delegate* unmanaged[Cdecl] indexDeclaration; [NativeTypeName("void (*)(CXClientData, const CXIdxEntityRefInfo *)")] - public IntPtr indexEntityReference; + public delegate* unmanaged[Cdecl] indexEntityReference; } diff --git a/sources/ClangSharp.Interop/CXCursorSetImpl.cs b/sources/ClangSharp.Interop/Manual/CXCursorSetImpl.cs similarity index 100% rename from sources/ClangSharp.Interop/CXCursorSetImpl.cs rename to sources/ClangSharp.Interop/Manual/CXCursorSetImpl.cs diff --git a/sources/ClangSharp.Interop/CXCursorVisitor.cs b/sources/ClangSharp.Interop/Manual/CXCursorVisitor.cs similarity index 100% rename from sources/ClangSharp.Interop/CXCursorVisitor.cs rename to sources/ClangSharp.Interop/Manual/CXCursorVisitor.cs diff --git a/sources/ClangSharp.Interop/CXFieldVisitor.cs b/sources/ClangSharp.Interop/Manual/CXFieldVisitor.cs similarity index 100% rename from sources/ClangSharp.Interop/CXFieldVisitor.cs rename to sources/ClangSharp.Interop/Manual/CXFieldVisitor.cs diff --git a/sources/ClangSharp.Interop/CXInclusionVisitor.cs b/sources/ClangSharp.Interop/Manual/CXInclusionVisitor.cs similarity index 100% rename from sources/ClangSharp.Interop/CXInclusionVisitor.cs rename to sources/ClangSharp.Interop/Manual/CXInclusionVisitor.cs diff --git a/sources/ClangSharp.Interop/CXModuleMapDescriptorImpl.cs b/sources/ClangSharp.Interop/Manual/CXModuleMapDescriptorImpl.cs similarity index 100% rename from sources/ClangSharp.Interop/CXModuleMapDescriptorImpl.cs rename to sources/ClangSharp.Interop/Manual/CXModuleMapDescriptorImpl.cs diff --git a/sources/ClangSharp.Interop/CXTargetInfoImpl.cs b/sources/ClangSharp.Interop/Manual/CXTargetInfoImpl.cs similarity index 100% rename from sources/ClangSharp.Interop/CXTargetInfoImpl.cs rename to sources/ClangSharp.Interop/Manual/CXTargetInfoImpl.cs diff --git a/sources/ClangSharp.Interop/CXTranslationUnitImpl.cs b/sources/ClangSharp.Interop/Manual/CXTranslationUnitImpl.cs similarity index 100% rename from sources/ClangSharp.Interop/CXTranslationUnitImpl.cs rename to sources/ClangSharp.Interop/Manual/CXTranslationUnitImpl.cs diff --git a/sources/ClangSharp.Interop/CXVirtualFileOverlayImpl.cs b/sources/ClangSharp.Interop/Manual/CXVirtualFileOverlayImpl.cs similarity index 100% rename from sources/ClangSharp.Interop/CXVirtualFileOverlayImpl.cs rename to sources/ClangSharp.Interop/Manual/CXVirtualFileOverlayImpl.cs diff --git a/sources/ClangSharp.Interop/Shims/SkipLocalsInitAttribute.cs b/sources/ClangSharp.Interop/Shims/SkipLocalsInitAttribute.cs new file mode 100644 index 00000000..d9518d5d --- /dev/null +++ b/sources/ClangSharp.Interop/Shims/SkipLocalsInitAttribute.cs @@ -0,0 +1,8 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +namespace System.Runtime.CompilerServices; + +[AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event, Inherited = false)] +internal sealed class SkipLocalsInitAttribute : Attribute +{ +} diff --git a/sources/ClangSharp.Interop/clang.cs b/sources/ClangSharp.Interop/clang.cs index b584f4cf..4fd55e33 100644 --- a/sources/ClangSharp.Interop/clang.cs +++ b/sources/ClangSharp.Interop/clang.cs @@ -8,7 +8,7 @@ namespace ClangSharp.Interop; -public static unsafe partial class clang +public static unsafe partial class @clang { [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_getBuildSessionTimestamp", ExactSpelling = true)] [return: NativeTypeName("unsigned long long")] @@ -275,7 +275,7 @@ public static unsafe partial class clang [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_getFileContents", ExactSpelling = true)] [return: NativeTypeName("const char *")] - public static extern sbyte* getFileContents([NativeTypeName("CXTranslationUnit")] CXTranslationUnitImpl* tu, [NativeTypeName("CXFile")] void* file, [NativeTypeName("size_t *")] UIntPtr* size); + public static extern sbyte* getFileContents([NativeTypeName("CXTranslationUnit")] CXTranslationUnitImpl* tu, [NativeTypeName("CXFile")] void* file, [NativeTypeName("size_t *")] nuint* size); [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_File_isEqual", ExactSpelling = true)] public static extern int File_isEqual([NativeTypeName("CXFile")] void* file1, [NativeTypeName("CXFile")] void* file2); @@ -404,6 +404,7 @@ public static unsafe partial class clang public static extern uint getDiagnosticCategory([NativeTypeName("CXDiagnostic")] void* param0); [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_getDiagnosticCategoryName", ExactSpelling = true)] + [Obsolete] public static extern CXString getDiagnosticCategoryName([NativeTypeName("unsigned int")] uint Category); [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_getDiagnosticCategoryText", ExactSpelling = true)] @@ -889,7 +890,7 @@ public static unsafe partial class clang [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_visitChildren", ExactSpelling = true)] [return: NativeTypeName("unsigned int")] - public static extern uint visitChildren(CXCursor parent, [NativeTypeName("CXCursorVisitor")] IntPtr visitor, [NativeTypeName("CXClientData")] void* client_data); + public static extern uint visitChildren(CXCursor parent, [NativeTypeName("CXCursorVisitor")] delegate* unmanaged[Cdecl] visitor, [NativeTypeName("CXClientData")] void* client_data); [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_getCursorUSR", ExactSpelling = true)] public static extern CXString getCursorUSR(CXCursor param0); @@ -1129,7 +1130,7 @@ public static unsafe partial class clang public static extern void enableStackTraces(); [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_executeOnThread", ExactSpelling = true)] - public static extern void executeOnThread([NativeTypeName("void (*)(void *)")] IntPtr fn, void* user_data, [NativeTypeName("unsigned int")] uint stack_size); + public static extern void executeOnThread([NativeTypeName("void (*)(void *)")] delegate* unmanaged[Cdecl] fn, void* user_data, [NativeTypeName("unsigned int")] uint stack_size); [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_getCompletionChunkKind", ExactSpelling = true)] [return: NativeTypeName("enum CXCompletionChunkKind")] @@ -1220,7 +1221,7 @@ public static unsafe partial class clang public static extern void toggleCrashRecovery([NativeTypeName("unsigned int")] uint isEnabled); [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_getInclusions", ExactSpelling = true)] - public static extern void getInclusions([NativeTypeName("CXTranslationUnit")] CXTranslationUnitImpl* tu, [NativeTypeName("CXInclusionVisitor")] IntPtr visitor, [NativeTypeName("CXClientData")] void* client_data); + public static extern void getInclusions([NativeTypeName("CXTranslationUnit")] CXTranslationUnitImpl* tu, [NativeTypeName("CXInclusionVisitor")] delegate* unmanaged[Cdecl] visitor, [NativeTypeName("CXClientData")] void* client_data); [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_Cursor_Evaluate", ExactSpelling = true)] [return: NativeTypeName("CXEvalResult")] @@ -1347,7 +1348,7 @@ public static unsafe partial class clang [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_Type_visitFields", ExactSpelling = true)] [return: NativeTypeName("unsigned int")] - public static extern uint Type_visitFields(CXType T, [NativeTypeName("CXFieldVisitor")] IntPtr visitor, [NativeTypeName("CXClientData")] void* client_data); + public static extern uint Type_visitFields(CXType T, [NativeTypeName("CXFieldVisitor")] delegate* unmanaged[Cdecl] visitor, [NativeTypeName("CXClientData")] void* client_data); [NativeTypeName("#define CINDEX_VERSION_MAJOR 0")] public const int CINDEX_VERSION_MAJOR = 0; @@ -1359,7 +1360,7 @@ public static unsafe partial class clang public const int CINDEX_VERSION = (((0) * 10000) + ((62) * 1)); [NativeTypeName("#define CINDEX_VERSION_STRING CINDEX_VERSION_STRINGIZE(CINDEX_VERSION_MAJOR, CINDEX_VERSION_MINOR)")] - public static ReadOnlySpan CINDEX_VERSION_STRING => new byte[] { 0x30, 0x2E, 0x36, 0x32, 0x00 }; + public static ReadOnlySpan CINDEX_VERSION_STRING => "0.62"u8; [DllImport("libclang", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clang_CXRewriter_create", ExactSpelling = true)] [return: NativeTypeName("CXRewriter")] diff --git a/sources/ClangSharp.Interop/clangsharp.cs b/sources/ClangSharp.Interop/clangsharp.cs index bab80662..22ac9cf9 100644 --- a/sources/ClangSharp.Interop/clangsharp.cs +++ b/sources/ClangSharp.Interop/clangsharp.cs @@ -6,7 +6,7 @@ namespace ClangSharp.Interop; -public static partial class clangsharp +public static partial class @clangsharp { [DllImport("libClangSharp", CallingConvention = CallingConvention.Cdecl, EntryPoint = "clangsharp_Cursor_getArgument", ExactSpelling = true)] public static extern CXCursor Cursor_getArgument(CXCursor C, [NativeTypeName("unsigned int")] uint i); diff --git a/sources/ClangSharp.PInvokeGenerator/Abstractions/FunctionOrDelegateDesc.cs b/sources/ClangSharp.PInvokeGenerator/Abstractions/FunctionOrDelegateDesc.cs index 8d0dadcf..cbb55b26 100644 --- a/sources/ClangSharp.PInvokeGenerator/Abstractions/FunctionOrDelegateDesc.cs +++ b/sources/ClangSharp.PInvokeGenerator/Abstractions/FunctionOrDelegateDesc.cs @@ -212,7 +212,7 @@ public bool? IsStatic // true - static, false - not static, null - infer true => Flags | (FunctionOrDelegateFlags.IsStatic & ~FunctionOrDelegateFlags.IsNotStatic), false => (Flags & ~FunctionOrDelegateFlags.IsStatic) | FunctionOrDelegateFlags.IsNotStatic, - null => Flags & ~FunctionOrDelegateFlags.IsStatic & ~FunctionOrDelegateFlags.IsNotStatic + null => Flags & ~FunctionOrDelegateFlags.IsStatic & ~FunctionOrDelegateFlags.IsNotStatic, }; } } diff --git a/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs b/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs index 8f2cae50..a11f19bd 100644 --- a/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs +++ b/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs @@ -8,8 +8,8 @@ namespace ClangSharp; public sealed class Diagnostic : IEquatable { private readonly DiagnosticLevel _level; - private readonly string _message; private readonly string _location; + private readonly string _message; public Diagnostic(DiagnosticLevel level, string message) : this(level, message, "") { @@ -46,5 +46,10 @@ public bool Equals(Diagnostic other) && (_message == other.Message); } + public override int GetHashCode() + { + return HashCode.Combine(_level, _location, _message); + } + public override string ToString() => string.IsNullOrWhiteSpace(_location) ? $"{_level}: {_message}" : $"{_level} ({_location}): {_message}"; } diff --git a/sources/ClangSharp.PInvokeGenerator/Extensions/StringExtensions.cs b/sources/ClangSharp.PInvokeGenerator/Extensions/StringExtensions.cs index 18ce4b6d..16c86bd1 100644 --- a/sources/ClangSharp.PInvokeGenerator/Extensions/StringExtensions.cs +++ b/sources/ClangSharp.PInvokeGenerator/Extensions/StringExtensions.cs @@ -13,14 +13,14 @@ public static string Unquote(this string str) ? str[1..^1] : str; - public static string AsString(this AccessSpecifier value) => value switch - { + public static string AsString(this AccessSpecifier value) => value switch { AccessSpecifier.Public => "public", AccessSpecifier.Protected => "protected", AccessSpecifier.ProtectedInternal => "protected internal", AccessSpecifier.Internal => "internal", AccessSpecifier.PrivateProtected => "private protected", AccessSpecifier.Private => "private", + AccessSpecifier.None => "public", _ => "public" }; diff --git a/sources/ClangSharp/Cursors/Attrs/Attr.cs b/sources/ClangSharp/Cursors/Attrs/Attr.cs index c2079d38..2b2550c7 100644 --- a/sources/ClangSharp/Cursors/Attrs/Attr.cs +++ b/sources/ClangSharp/Cursors/Attrs/Attr.cs @@ -18,6 +18,7 @@ private protected Attr(CXCursor handle) : base(handle, handle.Kind) internal static new Attr Create(CXCursor handle) => handle.AttrKind switch { CX_AttrKind.CX_AttrKind_Invalid => new Attr(handle), CX_AttrKind.CX_AttrKind_AddressSpace => new TypeAttr(handle), + CX_AttrKind.CX_AttrKind_AnnotateType => new TypeAttr(handle), CX_AttrKind.CX_AttrKind_ArmMveStrictPolymorphism => new TypeAttr(handle), CX_AttrKind.CX_AttrKind_BTFTypeTag => new TypeAttr(handle), CX_AttrKind.CX_AttrKind_CmseNSCall => new TypeAttr(handle), @@ -46,8 +47,12 @@ private protected Attr(CXCursor handle) : base(handle, handle.Kind) CX_AttrKind.CX_AttrKind_OpenCLUnrollHint => new StmtAttr(handle), CX_AttrKind.CX_AttrKind_Suppress => new StmtAttr(handle), CX_AttrKind.CX_AttrKind_Unlikely => new StmtAttr(handle), + CX_AttrKind.CX_AttrKind_AlwaysInline => new DeclOrStmtAttr(handle), + CX_AttrKind.CX_AttrKind_NoInline => new DeclOrStmtAttr(handle), CX_AttrKind.CX_AttrKind_NoMerge => new DeclOrStmtAttr(handle), + CX_AttrKind.CX_AttrKind_AArch64SVEPcs => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_AArch64VectorPcs => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_AMDGPUKernelCall => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_AcquireHandle => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_AnyX86NoCfCheck => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_CDecl => new InheritableAttr(handle), @@ -97,7 +102,6 @@ private protected Attr(CXCursor handle) : base(handle, handle.Kind) CX_AttrKind.CX_AttrKind_AllocAlign => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_AllocSize => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_AlwaysDestroy => new InheritableAttr(handle), - CX_AttrKind.CX_AttrKind_AlwaysInline => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_AnalyzerNoReturn => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_AnyX86Interrupt => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_AnyX86NoCallerSavedRegisters => new InheritableAttr(handle), @@ -175,10 +179,14 @@ private protected Attr(CXCursor handle) : base(handle, handle.Kind) CX_AttrKind.CX_AttrKind_Flatten => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_Format => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_FormatArg => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_FunctionReturnThunks => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_GNUInline => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_GuardedBy => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_GuardedVar => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_HIPManaged => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_HLSLNumThreads => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_HLSLSV_GroupIndex => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_HLSLShader => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_Hot => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_IBAction => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_IBOutlet => new InheritableAttr(handle), @@ -217,11 +225,11 @@ private protected Attr(CXCursor handle) : base(handle, handle.Kind) CX_AttrKind.CX_AttrKind_NoDebug => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_NoDestroy => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_NoDuplicate => new InheritableAttr(handle), - CX_AttrKind.CX_AttrKind_NoInline => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_NoInstrumentFunction => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_NoMicroMips => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_NoMips16 => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_NoProfileFunction => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_NoRandomizeLayout => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_NoReturn => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_NoSanitize => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_NoSpeculativeLoadHardening => new InheritableAttr(handle), @@ -276,6 +284,7 @@ private protected Attr(CXCursor handle) : base(handle, handle.Kind) CX_AttrKind.CX_AttrKind_PtGuardedVar => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_Pure => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_RISCVInterrupt => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_RandomizeLayout => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_Reinitializes => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_ReleaseCapability => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_ReqdWorkGroupSize => new InheritableAttr(handle), @@ -336,6 +345,7 @@ private protected Attr(CXCursor handle) : base(handle, handle.Kind) CX_AttrKind.CX_AttrKind_X86ForceAlignArgPointer => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_XRayInstrument => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_XRayLogArgs => new InheritableAttr(handle), + CX_AttrKind.CX_AttrKind_ZeroCallUsedRegs => new InheritableAttr(handle), CX_AttrKind.CX_AttrKind_AbiTag => new Attr(handle), CX_AttrKind.CX_AttrKind_Alias => new Attr(handle), CX_AttrKind.CX_AttrKind_AlignValue => new Attr(handle), diff --git a/sources/ClangSharp/Cursors/Cursor.cs b/sources/ClangSharp/Cursors/Cursor.cs index 8ec6ea5a..d007fad6 100644 --- a/sources/ClangSharp/Cursors/Cursor.cs +++ b/sources/ClangSharp/Cursors/Cursor.cs @@ -42,26 +42,25 @@ public IReadOnlyList CursorChildren { var cursorChildren = GCHandle.Alloc(new List()); -#if !NET5_0_OR_GREATER - var visitor = (CXCursorVisitor)Visitor; - var pVisitor = Marshal.GetFunctionPointerForDelegate(visitor); -#else - var pVisitor = (delegate* unmanaged[Cdecl])&Visitor; -#endif - var client_data = stackalloc nint[2] { GCHandle.ToIntPtr(cursorChildren), TranslationUnit.Handle.Handle }; - _ = clang.visitChildren(Handle, (IntPtr)pVisitor, client_data); +#if NET5_0_OR_GREATER + _ = clang.visitChildren(Handle, &Visitor, client_data); +#else + var visitor = (CXCursorVisitor)Visitor; + var pVisitor = (delegate* unmanaged[Cdecl])Marshal.GetFunctionPointerForDelegate(visitor); + + _ = clang.visitChildren(Handle, pVisitor, client_data); + GC.KeepAlive(visitor); +#endif _cursorChildren = (List)cursorChildren.Target; cursorChildren.Free(); -#if !NET5_0_OR_GREATER - GC.KeepAlive(visitor); -#else +#if NET5_0_OR_GREATER [UnmanagedCallersOnly(CallConvs = new System.Type[] { typeof(CallConvCdecl) })] #endif static CXChildVisitResult Visitor(CXCursor cursor, CXCursor parent, void* client_data) diff --git a/sources/ClangSharp/Cursors/Decls/ConceptDecl.cs b/sources/ClangSharp/Cursors/Decls/ConceptDecl.cs index 96330abc..f0baa82d 100644 --- a/sources/ClangSharp/Cursors/Decls/ConceptDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ConceptDecl.cs @@ -9,7 +9,7 @@ public sealed class ConceptDecl : TemplateDecl, IMergeable { private readonly Lazy _constraintExpr; - internal ConceptDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_Concept) + internal ConceptDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ConceptDecl, CX_DeclKind.CX_DeclKind_Concept) { _constraintExpr = new Lazy(() => TranslationUnit.GetOrCreate(Handle.ConstraintExpr)); } diff --git a/sources/ClangSharp/Cursors/Decls/Decl.cs b/sources/ClangSharp/Cursors/Decls/Decl.cs index 72813e37..806f2d18 100644 --- a/sources/ClangSharp/Cursors/Decls/Decl.cs +++ b/sources/ClangSharp/Cursors/Decls/Decl.cs @@ -220,6 +220,7 @@ public bool IsStdNamespace CX_DeclKind.CX_DeclKind_OMPDeclareMapper => new OMPDeclareMapperDecl(handle), CX_DeclKind.CX_DeclKind_OMPDeclareReduction => new OMPDeclareReductionDecl(handle), CX_DeclKind.CX_DeclKind_TemplateParamObject => new TemplateParamObjectDecl(handle), + CX_DeclKind.CX_DeclKind_UnnamedGlobalConstant => new UnnamedGlobalConstantDecl(handle), CX_DeclKind.CX_DeclKind_UnresolvedUsingValue => new UnresolvedUsingValueDecl(handle), CX_DeclKind.CX_DeclKind_OMPAllocate => new OMPAllocateDecl(handle), CX_DeclKind.CX_DeclKind_OMPRequires => new OMPRequiresDecl(handle), diff --git a/sources/ClangSharp/Cursors/Decls/UnnamedGlobalConstantDecl.cs b/sources/ClangSharp/Cursors/Decls/UnnamedGlobalConstantDecl.cs new file mode 100644 index 00000000..1777c209 --- /dev/null +++ b/sources/ClangSharp/Cursors/Decls/UnnamedGlobalConstantDecl.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class UnnamedGlobalConstantDecl : ValueDecl, IMergeable +{ + internal UnnamedGlobalConstantDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedDecl, CX_DeclKind.CX_DeclKind_UnnamedGlobalConstant) + { + } +} diff --git a/sources/ClangSharp/Cursors/Exprs/ConceptSpecializationExpr.cs b/sources/ClangSharp/Cursors/Exprs/ConceptSpecializationExpr.cs index 8ddcd8a6..ac0e31ef 100644 --- a/sources/ClangSharp/Cursors/Exprs/ConceptSpecializationExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ConceptSpecializationExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp; public sealed class ConceptSpecializationExpr : Expr { - internal ConceptSpecializationExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_ConceptSpecializationExpr) + internal ConceptSpecializationExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ConceptSpecializationExpr, CX_StmtClass.CX_StmtClass_ConceptSpecializationExpr) { } } diff --git a/sources/ClangSharp/Cursors/Exprs/RequiresExpr.cs b/sources/ClangSharp/Cursors/Exprs/RequiresExpr.cs index e37e444c..46c68bf8 100644 --- a/sources/ClangSharp/Cursors/Exprs/RequiresExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/RequiresExpr.cs @@ -6,7 +6,7 @@ namespace ClangSharp; public sealed class RequiresExpr : Expr { - internal RequiresExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_RequiresExpr) + internal RequiresExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_RequiresExpr, CX_StmtClass.CX_StmtClass_RequiresExpr) { } } diff --git a/sources/ClangSharp/Cursors/Stmts/OMPMaskedTaskLoopDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPMaskedTaskLoopDirective.cs new file mode 100644 index 00000000..37136480 --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/OMPMaskedTaskLoopDirective.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class OMPMaskedTaskLoopDirective : OMPLoopDirective +{ + internal OMPMaskedTaskLoopDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPMaskedTaskLoopDirective, CX_StmtClass.CX_StmtClass_OMPMaskedTaskLoopDirective) + { + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/OMPMaskedTaskLoopSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPMaskedTaskLoopSimdDirective.cs new file mode 100644 index 00000000..76dd4680 --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/OMPMaskedTaskLoopSimdDirective.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class OMPMaskedTaskLoopSimdDirective : OMPLoopDirective +{ + internal OMPMaskedTaskLoopSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPMaskedTaskLoopSimdDirective, CX_StmtClass.CX_StmtClass_OMPMaskedTaskLoopSimdDirective) + { + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/OMPParallelGenericLoopDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPParallelGenericLoopDirective.cs new file mode 100644 index 00000000..c31a8500 --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/OMPParallelGenericLoopDirective.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class OMPParallelGenericLoopDirective : OMPLoopDirective +{ + internal OMPParallelGenericLoopDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelGenericLoopDirective, CX_StmtClass.CX_StmtClass_OMPParallelGenericLoopDirective) + { + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedDirective.cs new file mode 100644 index 00000000..7a8a38b0 --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedDirective.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class OMPParallelMaskedDirective : OMPLoopDirective +{ + internal OMPParallelMaskedDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelMaskedDirective, CX_StmtClass.CX_StmtClass_OMPParallelMaskedDirective) + { + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedTaskLoopDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedTaskLoopDirective.cs new file mode 100644 index 00000000..8bbaa45b --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedTaskLoopDirective.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class OMPParallelMaskedTaskLoopDirective : OMPLoopDirective +{ + internal OMPParallelMaskedTaskLoopDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelMaskedTaskLoopDirective, CX_StmtClass.CX_StmtClass_OMPParallelMaskedTaskLoopDirective) + { + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedTaskLoopSimdDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedTaskLoopSimdDirective.cs new file mode 100644 index 00000000..fe3ea2d1 --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/OMPParallelMaskedTaskLoopSimdDirective.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class OMPParallelMaskedTaskLoopSimdDirective : OMPLoopDirective +{ + internal OMPParallelMaskedTaskLoopSimdDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPParallelMaskedTaskLoopSimdDirective, CX_StmtClass.CX_StmtClass_OMPParallelMaskedTaskLoopSimdDirective) + { + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelGenericLoopDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelGenericLoopDirective.cs new file mode 100644 index 00000000..1f4bfc4e --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetParallelGenericLoopDirective.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class OMPTargetParallelGenericLoopDirective : OMPLoopDirective +{ + internal OMPTargetParallelGenericLoopDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetParallelGenericLoopDirective, CX_StmtClass.CX_StmtClass_OMPTargetParallelGenericLoopDirective) + { + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsGenericLoopDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsGenericLoopDirective.cs new file mode 100644 index 00000000..ff430612 --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/OMPTargetTeamsGenericLoopDirective.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class OMPTargetTeamsGenericLoopDirective : OMPLoopDirective +{ + internal OMPTargetTeamsGenericLoopDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTargetTeamsGenericLoopDirective, CX_StmtClass.CX_StmtClass_OMPTargetTeamsGenericLoopDirective) + { + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/OMPTeamsGenericLoopDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPTeamsGenericLoopDirective.cs new file mode 100644 index 00000000..ed68f8eb --- /dev/null +++ b/sources/ClangSharp/Cursors/Stmts/OMPTeamsGenericLoopDirective.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class OMPTeamsGenericLoopDirective : OMPLoopDirective +{ + internal OMPTeamsGenericLoopDirective(CXCursor handle) : base(handle, CXCursorKind.CXCursor_OMPTeamsGenericLoopDirective, CX_StmtClass.CX_StmtClass_OMPTeamsGenericLoopDirective) + { + } +} diff --git a/sources/ClangSharp/Cursors/Stmts/Stmt.cs b/sources/ClangSharp/Cursors/Stmts/Stmt.cs index ffcbdd36..1c2e759c 100644 --- a/sources/ClangSharp/Cursors/Stmts/Stmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/Stmt.cs @@ -151,25 +151,33 @@ public Stmt StripLabelLikeStatements() CX_StmtClass.CX_StmtClass_OMPForDirective => new OMPForDirective(handle), CX_StmtClass.CX_StmtClass_OMPForSimdDirective => new OMPForSimdDirective(handle), CX_StmtClass.CX_StmtClass_OMPGenericLoopDirective => new OMPGenericLoopDirective(handle), + CX_StmtClass.CX_StmtClass_OMPMaskedTaskLoopDirective => new OMPMaskedTaskLoopDirective(handle), + CX_StmtClass.CX_StmtClass_OMPMaskedTaskLoopSimdDirective => new OMPMaskedTaskLoopSimdDirective(handle), CX_StmtClass.CX_StmtClass_OMPMasterTaskLoopDirective => new OMPMasterTaskLoopDirective(handle), CX_StmtClass.CX_StmtClass_OMPMasterTaskLoopSimdDirective => new OMPMasterTaskLoopSimdDirective(handle), CX_StmtClass.CX_StmtClass_OMPParallelForDirective => new OMPParallelForDirective(handle), CX_StmtClass.CX_StmtClass_OMPParallelForSimdDirective => new OMPParallelForSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPParallelGenericLoopDirective => new OMPParallelGenericLoopDirective(handle), + CX_StmtClass.CX_StmtClass_OMPParallelMaskedTaskLoopDirective => new OMPParallelMaskedTaskLoopDirective(handle), + CX_StmtClass.CX_StmtClass_OMPParallelMaskedTaskLoopSimdDirective => new OMPParallelMaskedTaskLoopSimdDirective(handle), CX_StmtClass.CX_StmtClass_OMPParallelMasterTaskLoopDirective => new OMPParallelMasterTaskLoopDirective(handle), CX_StmtClass.CX_StmtClass_OMPParallelMasterTaskLoopSimdDirective => new OMPParallelMasterTaskLoopSimdDirective(handle), CX_StmtClass.CX_StmtClass_OMPSimdDirective => new OMPSimdDirective(handle), CX_StmtClass.CX_StmtClass_OMPTargetParallelForSimdDirective => new OMPTargetParallelForSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetParallelGenericLoopDirective => new OMPTargetParallelGenericLoopDirective(handle), CX_StmtClass.CX_StmtClass_OMPTargetSimdDirective => new OMPTargetSimdDirective(handle), CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeDirective => new OMPTargetTeamsDistributeDirective(handle), CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeParallelForDirective => new OMPTargetTeamsDistributeParallelForDirective(handle), CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeParallelForSimdDirective => new OMPTargetTeamsDistributeParallelForSimdDirective(handle), CX_StmtClass.CX_StmtClass_OMPTargetTeamsDistributeSimdDirective => new OMPTargetTeamsDistributeSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTargetTeamsGenericLoopDirective => new OMPTargetTeamsGenericLoopDirective(handle), CX_StmtClass.CX_StmtClass_OMPTaskLoopDirective => new OMPTaskLoopDirective(handle), CX_StmtClass.CX_StmtClass_OMPTaskLoopSimdDirective => new OMPTaskLoopSimdDirective(handle), CX_StmtClass.CX_StmtClass_OMPTeamsDistributeDirective => new OMPTeamsDistributeDirective(handle), CX_StmtClass.CX_StmtClass_OMPTeamsDistributeParallelForDirective => new OMPTeamsDistributeParallelForDirective(handle), CX_StmtClass.CX_StmtClass_OMPTeamsDistributeParallelForSimdDirective => new OMPTeamsDistributeParallelForSimdDirective(handle), CX_StmtClass.CX_StmtClass_OMPTeamsDistributeSimdDirective => new OMPTeamsDistributeSimdDirective(handle), + CX_StmtClass.CX_StmtClass_OMPTeamsGenericLoopDirective => new OMPTeamsGenericLoopDirective(handle), CX_StmtClass.CX_StmtClass_OMPTileDirective => new OMPTileDirective(handle), CX_StmtClass.CX_StmtClass_OMPUnrollDirective => new OMPUnrollDirective(handle), CX_StmtClass.CX_StmtClass_OMPMaskedDirective => new OMPMaskedDirective(handle), @@ -177,6 +185,7 @@ public Stmt StripLabelLikeStatements() CX_StmtClass.CX_StmtClass_OMPMetaDirective => new OMPMetaDirective(handle), CX_StmtClass.CX_StmtClass_OMPOrderedDirective => new OMPOrderedDirective(handle), CX_StmtClass.CX_StmtClass_OMPParallelDirective => new OMPParallelDirective(handle), + CX_StmtClass.CX_StmtClass_OMPParallelMaskedDirective => new OMPParallelMaskedDirective(handle), CX_StmtClass.CX_StmtClass_OMPParallelMasterDirective => new OMPParallelMasterDirective(handle), CX_StmtClass.CX_StmtClass_OMPParallelSectionsDirective => new OMPParallelSectionsDirective(handle), CX_StmtClass.CX_StmtClass_OMPScanDirective => new OMPScanDirective(handle), diff --git a/sources/ClangSharp/Types/BTFTagAttributedType.cs b/sources/ClangSharp/Types/BTFTagAttributedType.cs new file mode 100644 index 00000000..e0d44f3c --- /dev/null +++ b/sources/ClangSharp/Types/BTFTagAttributedType.cs @@ -0,0 +1,12 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +using ClangSharp.Interop; + +namespace ClangSharp; + +public sealed class BTFTagAttributedType : Type +{ + internal BTFTagAttributedType(CXType handle) : base(handle, CXTypeKind.CXType_BTFTagAttributed, CX_TypeClass.CX_TypeClass_BTFTagAttributed) + { + } +} diff --git a/sources/ClangSharp/Types/Type.cs b/sources/ClangSharp/Types/Type.cs index 5f1b84e1..43067565 100644 --- a/sources/ClangSharp/Types/Type.cs +++ b/sources/ClangSharp/Types/Type.cs @@ -124,6 +124,8 @@ public Type UnqualifiedDesugaredType CX_TypeClass.CX_TypeClass_VariableArray => new VariableArrayType(handle), CX_TypeClass.CX_TypeClass_Atomic => new AtomicType(handle), CX_TypeClass.CX_TypeClass_Attributed => new AttributedType(handle), + CX_TypeClass.CX_TypeClass_BTFTagAttributed => new BTFTagAttributedType(handle), + CX_TypeClass.CX_TypeClass_BitInt => new BitIntType(handle), CX_TypeClass.CX_TypeClass_BlockPointer => new BlockPointerType(handle), CX_TypeClass.CX_TypeClass_Builtin => new BuiltinType(handle), CX_TypeClass.CX_TypeClass_Complex => new ComplexType(handle), @@ -137,7 +139,6 @@ public Type UnqualifiedDesugaredType CX_TypeClass.CX_TypeClass_DependentTemplateSpecialization => new DependentTemplateSpecializationType(handle), CX_TypeClass.CX_TypeClass_DependentVector => new DependentVectorType(handle), CX_TypeClass.CX_TypeClass_Elaborated => new ElaboratedType(handle), - CX_TypeClass.CX_TypeClass_BitInt => new BitIntType(handle), CX_TypeClass.CX_TypeClass_FunctionNoProto => new FunctionNoProtoType(handle), CX_TypeClass.CX_TypeClass_FunctionProto => new FunctionProtoType(handle), CX_TypeClass.CX_TypeClass_InjectedClassName => new InjectedClassNameType(handle), diff --git a/sources/ClangSharpPInvokeGenerator/Properties/GenerateClang.rsp b/sources/ClangSharpPInvokeGenerator/Properties/GenerateClang.rsp index 40772d87..46d0ce09 100644 --- a/sources/ClangSharpPInvokeGenerator/Properties/GenerateClang.rsp +++ b/sources/ClangSharpPInvokeGenerator/Properties/GenerateClang.rsp @@ -1,8 +1,24 @@ --config compatible-codegen +exclude-com-proxies +exclude-empty-records +exclude-enum-operators +generate-aggressive-inlining +generate-cpp-attributes generate-macro-bindings +generate-file-scoped-namespaces +generate-guid-member +generate-macro-bindings +generate-marker-interfaces +generate-native-inheritance-attribute +generate-setslastsystemerror-attribute generate-tests-nunit +generate-unmanaged-constants +generate-vtbl-index-attribute +log-potential-typedef-remappings multi-file +preview-codegen +trimmable-vtbls unix-types --exclude CINDEX_VERSION_ENCODE diff --git a/sources/ClangSharpPInvokeGenerator/Properties/GenerateClangSharp.rsp b/sources/ClangSharpPInvokeGenerator/Properties/GenerateClangSharp.rsp index d0910da3..28707fe2 100644 --- a/sources/ClangSharpPInvokeGenerator/Properties/GenerateClangSharp.rsp +++ b/sources/ClangSharpPInvokeGenerator/Properties/GenerateClangSharp.rsp @@ -1,8 +1,25 @@ --config compatible-codegen +exclude-com-proxies +exclude-empty-records +exclude-enum-operators +generate-aggressive-inlining +generate-cpp-attributes generate-macro-bindings +generate-file-scoped-namespaces +generate-guid-member +generate-macro-bindings +generate-marker-interfaces +generate-native-inheritance-attribute +generate-setslastsystemerror-attribute generate-tests-nunit +generate-unmanaged-constants +generate-vtbl-index-attribute +log-potential-typedef-remappings multi-file +preview-codegen +trimmable-vtbls +unix-types --define-macro _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING --file diff --git a/sources/ClangSharpPInvokeGenerator/Properties/GenerateLLVM.rsp b/sources/ClangSharpPInvokeGenerator/Properties/GenerateLLVM.rsp index d8bd943d..989c2e0a 100644 --- a/sources/ClangSharpPInvokeGenerator/Properties/GenerateLLVM.rsp +++ b/sources/ClangSharpPInvokeGenerator/Properties/GenerateLLVM.rsp @@ -1,8 +1,25 @@ --config compatible-codegen +exclude-com-proxies +exclude-empty-records +exclude-enum-operators +generate-aggressive-inlining +generate-cpp-attributes generate-macro-bindings +generate-file-scoped-namespaces +generate-guid-member +generate-macro-bindings +generate-marker-interfaces +generate-native-inheritance-attribute +generate-setslastsystemerror-attribute generate-tests-nunit +generate-unmanaged-constants +generate-vtbl-index-attribute +log-potential-typedef-remappings multi-file +preview-codegen +trimmable-vtbls +unix-types --exclude LLVM_DECLARE_VALUE_CAST LLVM_FOR_EACH_VALUE_SUBCLASS @@ -10,6 +27,7 @@ LLVM_FOR_EACH_VALUE_SUBCLASS llvm-c/Analysis.h llvm-c/BitReader.h llvm-c/BitWriter.h +llvm-c/blake3.h llvm-c/Comdat.h llvm-c/Core.h llvm-c/DataTypes.h @@ -35,7 +53,6 @@ llvm-c/Target.h llvm-c/TargetMachine.h llvm-c/Types.h llvm-c/Transforms/AggressiveInstCombine.h -llvm-c/Transforms/Coroutines.h llvm-c/Transforms/InstCombine.h llvm-c/Transforms/IPO.h llvm-c/Transforms/PassBuilder.h From cfc66ade75134b2bc757381c842f4c8f16661118 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Sat, 17 Sep 2022 19:14:51 -0700 Subject: [PATCH 4/6] Enabling NRTs --- .editorconfig | 13 ++ Directory.Build.props | 2 +- Directory.Build.targets | 2 +- .../ClangSharp.Interop.csproj | 1 + .../Extensions/CXClientData.cs | 2 +- .../Extensions/CXCompilationDatabase.cs | 2 +- .../Extensions/CXCompileCommand.cs | 2 +- .../Extensions/CXCompileCommands.cs | 2 +- .../Extensions/CXCompletionString.cs | 2 +- .../ClangSharp.Interop/Extensions/CXCursor.cs | 2 +- .../Extensions/CXCursorSet.cs | 2 +- .../Extensions/CXDiagnostic.cs | 2 +- .../Extensions/CXDiagnosticSet.cs | 2 +- .../Extensions/CXEvalResult.cs | 2 +- .../ClangSharp.Interop/Extensions/CXFile.cs | 2 +- .../Extensions/CXIdxClientASTFile.cs | 2 +- .../Extensions/CXIdxClientContainer.cs | 2 +- .../Extensions/CXIdxClientEntity.cs | 2 +- .../Extensions/CXIdxClientFile.cs | 2 +- .../ClangSharp.Interop/Extensions/CXIndex.cs | 2 +- .../Extensions/CXIndexAction.cs | 2 +- .../ClangSharp.Interop/Extensions/CXModule.cs | 2 +- .../Extensions/CXModuleMapDescriptor.cs | 2 +- .../Extensions/CXPrintingPolicy.cs | 2 +- .../Extensions/CXRemapping.cs | 2 +- .../Extensions/CXSourceLocation.cs | 2 +- .../Extensions/CXSourceRange.cs | 2 +- .../Extensions/CXTargetInfo.cs | 2 +- .../ClangSharp.Interop/Extensions/CXToken.cs | 2 +- .../Extensions/CXTranslationUnit.cs | 2 +- .../ClangSharp.Interop/Extensions/CXType.cs | 2 +- .../Extensions/CXVirtualFileOverlay.cs | 4 +- .../Extensions/clang.ResolveLibrary.cs | 2 +- .../Internals/MarshaledString.cs | 2 +- .../Internals/MarshaledStringArray.cs | 2 +- .../Shims/MemberNotNullWhenAttribute.cs | 23 ++ .../Abstractions/FieldDesc.cs | 2 +- .../Abstractions/FunctionOrDelegateDesc.cs | 2 +- .../Abstractions/IOutputBuilder.Visit.cs | 2 +- .../Abstractions/IOutputBuilder.VisitDecl.cs | 2 +- .../Abstractions/ParameterDesc.cs | 2 +- .../Abstractions/StructDesc.cs | 6 +- .../Abstractions/ValueDesc.cs | 2 +- .../CSharp/CSharpOutputBuilder.Visit.cs | 2 +- .../CSharp/CSharpOutputBuilder.VisitDecl.cs | 2 +- .../CSharp/CSharpOutputBuilder.cs | 9 +- .../ClangSharp.PInvokeGenerator/Diagnostic.cs | 9 +- .../OutputBuilderFactory.cs | 3 +- .../PInvokeGenerator.VisitDecl.cs | 173 ++++++++++----- .../PInvokeGenerator.VisitStmt.cs | 124 +++++++---- .../PInvokeGenerator.cs | 205 +++++++++++++----- .../PInvokeGeneratorConfiguration.cs | 34 ++- .../XML/XmlOutputBuilder.Visit.cs | 2 +- .../XML/XmlOutputBuilder.VisitDecl.cs | 2 +- sources/ClangSharp/Cursors/Cursor.cs | 49 +++-- sources/ClangSharp/Cursors/Decls/BlockDecl.cs | 2 +- .../Cursors/Decls/CXXConstructorDecl.cs | 4 +- .../ClangSharp/Cursors/Decls/CXXMethodDecl.cs | 3 +- .../ClangSharp/Cursors/Decls/CXXRecordDecl.cs | 9 +- .../Decls/ConstructorUsingShadowDecl.cs | 2 +- sources/ClangSharp/Cursors/Decls/Decl.cs | 47 ++-- .../Cursors/Decls/EnumConstantDecl.cs | 6 +- sources/ClangSharp/Cursors/Decls/EnumDecl.cs | 2 +- sources/ClangSharp/Cursors/Decls/FieldDecl.cs | 2 +- .../Cursors/Decls/ObjCInterfaceDecl.cs | 2 +- .../ClangSharp/Cursors/Decls/RecordDecl.cs | 8 +- sources/ClangSharp/Cursors/Decls/TagDecl.cs | 6 +- .../ClangSharp/Cursors/Exprs/AtomicExpr.cs | 12 +- sources/ClangSharp/Cursors/Exprs/BlockExpr.cs | 2 +- .../Cursors/Exprs/CXXDefaultArgExpr.cs | 6 +- .../Cursors/Exprs/CXXDefaultInitExpr.cs | 6 +- .../Exprs/CXXDependentScopeMemberExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/CXXFoldExpr.cs | 2 +- .../Cursors/Exprs/CXXMemberCallExpr.cs | 15 +- .../ClangSharp/Cursors/Exprs/CXXNewExpr.cs | 6 +- .../ClangSharp/Cursors/Exprs/CXXTypeidExpr.cs | 2 +- .../ClangSharp/Cursors/Exprs/CXXUuidofExpr.cs | 2 +- sources/ClangSharp/Cursors/Exprs/CallExpr.cs | 2 +- sources/ClangSharp/Cursors/Exprs/CastExpr.cs | 8 +- .../ClangSharp/Cursors/Exprs/ChooseExpr.cs | 2 +- sources/ClangSharp/Cursors/Exprs/Expr.cs | 11 +- .../Cursors/Exprs/GenericSelectionExpr.cs | 2 +- .../Cursors/Exprs/MaterializeTemporaryExpr.cs | 2 +- .../Cursors/Exprs/MatrixSubscriptExpr.cs | 2 +- .../Cursors/Exprs/PredefinedExpr.cs | 2 +- .../Cursors/Exprs/PseudoObjectExpr.cs | 2 +- .../Cursors/Exprs/UnresolvedMemberExpr.cs | 2 +- .../Cursors/Stmts/CXXForRangeStmt.cs | 20 +- sources/ClangSharp/Cursors/Stmts/CaseStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/CompoundStmt.cs | 10 +- sources/ClangSharp/Cursors/Stmts/DeclStmt.cs | 2 +- sources/ClangSharp/Cursors/Stmts/ForStmt.cs | 10 +- sources/ClangSharp/Cursors/Stmts/IfStmt.cs | 8 +- .../Cursors/Stmts/ObjCAtCatchStmt.cs | 8 +- .../ClangSharp/Cursors/Stmts/ObjCAtTryStmt.cs | 8 +- .../ClangSharp/Cursors/Stmts/ReturnStmt.cs | 2 +- .../ClangSharp/Cursors/Stmts/SEHTryStmt.cs | 4 +- sources/ClangSharp/Cursors/Stmts/Stmt.cs | 13 +- .../ClangSharp/Cursors/Stmts/SwitchCase.cs | 2 +- .../ClangSharp/Cursors/Stmts/SwitchStmt.cs | 6 +- sources/ClangSharp/Cursors/Stmts/ValueStmt.cs | 2 +- sources/ClangSharp/Cursors/Stmts/WhileStmt.cs | 4 +- sources/ClangSharp/IDeclContext.cs | 6 +- sources/ClangSharp/Index.cs | 8 +- sources/ClangSharp/TemplateArgument.cs | 3 +- sources/ClangSharp/TemplateArgumentLoc.cs | 3 +- sources/ClangSharp/TemplateName.cs | 2 +- sources/ClangSharp/TranslationUnit.cs | 53 +++-- .../Types/TemplateSpecializationType.cs | 4 +- sources/ClangSharp/Types/Type.cs | 20 +- sources/ClangSharp/Types/VectorType.cs | 2 +- .../CustomHelpBuilder.cs | 2 +- sources/ClangSharpPInvokeGenerator/Program.cs | 149 +++++++------ .../FunctionDeclarationBodyImportTest.cs | 2 - .../FunctionDeclarationDllImportTest.cs | 1 - .../FunctionDeclarationBodyImportTest.cs | 2 - .../FunctionDeclarationBodyImportTest.cs | 2 - .../FunctionDeclarationBodyImportTest.cs | 2 - .../FunctionDeclarationBodyImportTest.cs | 2 - .../FunctionDeclarationBodyImportTest.cs | 2 - .../PInvokeGeneratorTest.cs | 29 +-- .../FunctionDeclarationBodyImportTest.cs | 2 - .../FunctionDeclarationBodyImportTest.cs | 2 - .../FunctionDeclarationBodyImportTest.cs | 2 - .../FunctionDeclarationBodyImportTest.cs | 2 - .../FunctionDeclarationBodyImportTest.cs | 2 - .../FunctionDeclarationBodyImportTest.cs | 2 - .../CXModuleMapDescriptorTest.cs | 1 - .../CXVirtualFileOverlayTest.cs | 10 +- 129 files changed, 824 insertions(+), 514 deletions(-) create mode 100644 sources/ClangSharp.Interop/Shims/MemberNotNullWhenAttribute.cs diff --git a/.editorconfig b/.editorconfig index 4c5dd203..3467ebf9 100644 --- a/.editorconfig +++ b/.editorconfig @@ -454,3 +454,16 @@ csharp_using_directive_placement = outside_namespace:error [*.cs] dotnet_diagnostic.CA1401.severity = silent dotnet_diagnostic.SYSLIB1054.severity = silent + +############################################################################### +# Set dotnet analyzer rules to: +# disable various SYSLIB analyzers +# due to unexpected exceptions thrown in the IDE +############################################################################### +[*.cs] +dotnet_diagnostic.SYSLIB1055.severity = silent +dotnet_diagnostic.SYSLIB1056.severity = silent +dotnet_diagnostic.SYSLIB1057.severity = silent +dotnet_diagnostic.SYSLIB1058.severity = silent +dotnet_diagnostic.SYSLIB1060.severity = silent +dotnet_diagnostic.SYSLIB1061.severity = silent diff --git a/Directory.Build.props b/Directory.Build.props index e224fb0c..1974167d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -25,7 +25,7 @@ embedded false true - + enable true true true diff --git a/Directory.Build.targets b/Directory.Build.targets index 16eb8e06..4215864b 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -12,7 +12,7 @@ - $(NoWarn) + $(NoWarn);AD0001 diff --git a/sources/ClangSharp.Interop/ClangSharp.Interop.csproj b/sources/ClangSharp.Interop/ClangSharp.Interop.csproj index 91901ea9..1dc7232a 100644 --- a/sources/ClangSharp.Interop/ClangSharp.Interop.csproj +++ b/sources/ClangSharp.Interop/ClangSharp.Interop.csproj @@ -12,6 +12,7 @@ + diff --git a/sources/ClangSharp.Interop/Extensions/CXClientData.cs b/sources/ClangSharp.Interop/Extensions/CXClientData.cs index e73df948..f26edc2d 100644 --- a/sources/ClangSharp.Interop/Extensions/CXClientData.cs +++ b/sources/ClangSharp.Interop/Extensions/CXClientData.cs @@ -21,7 +21,7 @@ public CXClientData(IntPtr handle) public static bool operator !=(CXClientData left, CXClientData right) => left.Handle != right.Handle; - public override bool Equals(object obj) => (obj is CXClientData other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXClientData other) && Equals(other); public bool Equals(CXClientData other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXCompilationDatabase.cs b/sources/ClangSharp.Interop/Extensions/CXCompilationDatabase.cs index 0e8a18ca..f8f34eac 100644 --- a/sources/ClangSharp.Interop/Extensions/CXCompilationDatabase.cs +++ b/sources/ClangSharp.Interop/Extensions/CXCompilationDatabase.cs @@ -42,7 +42,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXCompilationDatabase other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXCompilationDatabase other) && Equals(other); public bool Equals(CXCompilationDatabase other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXCompileCommand.cs b/sources/ClangSharp.Interop/Extensions/CXCompileCommand.cs index b74185ec..7b0d1601 100644 --- a/sources/ClangSharp.Interop/Extensions/CXCompileCommand.cs +++ b/sources/ClangSharp.Interop/Extensions/CXCompileCommand.cs @@ -29,7 +29,7 @@ public CXCompileCommand(IntPtr handle) public static bool operator !=(CXCompileCommand left, CXCompileCommand right) => left.Handle != right.Handle; - public override bool Equals(object obj) => (obj is CXCompileCommand other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXCompileCommand other) && Equals(other); public bool Equals(CXCompileCommand other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXCompileCommands.cs b/sources/ClangSharp.Interop/Extensions/CXCompileCommands.cs index 05da1260..7c79b242 100644 --- a/sources/ClangSharp.Interop/Extensions/CXCompileCommands.cs +++ b/sources/ClangSharp.Interop/Extensions/CXCompileCommands.cs @@ -38,7 +38,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXCompileCommands other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXCompileCommands other) && Equals(other); public bool Equals(CXCompileCommands other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXCompletionString.cs b/sources/ClangSharp.Interop/Extensions/CXCompletionString.cs index b042a218..39aef731 100644 --- a/sources/ClangSharp.Interop/Extensions/CXCompletionString.cs +++ b/sources/ClangSharp.Interop/Extensions/CXCompletionString.cs @@ -31,7 +31,7 @@ public CXCompletionString(IntPtr handle) public static bool operator !=(CXCompletionString left, CXCompletionString right) => left.Handle != right.Handle; - public override bool Equals(object obj) => (obj is CXCompletionString other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXCompletionString other) && Equals(other); public bool Equals(CXCompletionString other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXCursor.cs b/sources/ClangSharp.Interop/Extensions/CXCursor.cs index 9f99df20..777378bf 100644 --- a/sources/ClangSharp.Interop/Extensions/CXCursor.cs +++ b/sources/ClangSharp.Interop/Extensions/CXCursor.cs @@ -1611,7 +1611,7 @@ public static void DisposeOverriddenCursors(ReadOnlySpan overridden) } } - public override bool Equals(object obj) => (obj is CXCursor other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXCursor other) && Equals(other); public bool Equals(CXCursor other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXCursorSet.cs b/sources/ClangSharp.Interop/Extensions/CXCursorSet.cs index 32829266..f6f76b9c 100644 --- a/sources/ClangSharp.Interop/Extensions/CXCursorSet.cs +++ b/sources/ClangSharp.Interop/Extensions/CXCursorSet.cs @@ -34,7 +34,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXCursorSet other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXCursorSet other) && Equals(other); public bool Equals(CXCursorSet other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXDiagnostic.cs b/sources/ClangSharp.Interop/Extensions/CXDiagnostic.cs index a058a87c..e981b7bf 100644 --- a/sources/ClangSharp.Interop/Extensions/CXDiagnostic.cs +++ b/sources/ClangSharp.Interop/Extensions/CXDiagnostic.cs @@ -48,7 +48,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXDiagnostic other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXDiagnostic other) && Equals(other); public bool Equals(CXDiagnostic other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXDiagnosticSet.cs b/sources/ClangSharp.Interop/Extensions/CXDiagnosticSet.cs index 36ba35ef..ba2df4ff 100644 --- a/sources/ClangSharp.Interop/Extensions/CXDiagnosticSet.cs +++ b/sources/ClangSharp.Interop/Extensions/CXDiagnosticSet.cs @@ -49,7 +49,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXDiagnosticSet other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXDiagnosticSet other) && Equals(other); public bool Equals(CXDiagnosticSet other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXEvalResult.cs b/sources/ClangSharp.Interop/Extensions/CXEvalResult.cs index 70083ad8..a0f7bcc4 100644 --- a/sources/ClangSharp.Interop/Extensions/CXEvalResult.cs +++ b/sources/ClangSharp.Interop/Extensions/CXEvalResult.cs @@ -58,7 +58,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXEvalResult other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXEvalResult other) && Equals(other); public bool Equals(CXEvalResult other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXFile.cs b/sources/ClangSharp.Interop/Extensions/CXFile.cs index 55b7dc47..e6039773 100644 --- a/sources/ClangSharp.Interop/Extensions/CXFile.cs +++ b/sources/ClangSharp.Interop/Extensions/CXFile.cs @@ -25,7 +25,7 @@ public CXFile(IntPtr handle) public static bool operator !=(CXFile left, CXFile right) => clang.File_isEqual(left, right) == 0; - public override bool Equals(object obj) => (obj is CXFile other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXFile other) && Equals(other); public bool Equals(CXFile other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXIdxClientASTFile.cs b/sources/ClangSharp.Interop/Extensions/CXIdxClientASTFile.cs index 17e409f6..2280b3b7 100644 --- a/sources/ClangSharp.Interop/Extensions/CXIdxClientASTFile.cs +++ b/sources/ClangSharp.Interop/Extensions/CXIdxClientASTFile.cs @@ -21,7 +21,7 @@ public CXIdxClientASTFile(IntPtr handle) public static bool operator !=(CXIdxClientASTFile left, CXIdxClientASTFile right) => left.Handle != right.Handle; - public override bool Equals(object obj) => (obj is CXIdxClientASTFile other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXIdxClientASTFile other) && Equals(other); public bool Equals(CXIdxClientASTFile other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXIdxClientContainer.cs b/sources/ClangSharp.Interop/Extensions/CXIdxClientContainer.cs index 03c6fd72..d06146a9 100644 --- a/sources/ClangSharp.Interop/Extensions/CXIdxClientContainer.cs +++ b/sources/ClangSharp.Interop/Extensions/CXIdxClientContainer.cs @@ -21,7 +21,7 @@ public CXIdxClientContainer(IntPtr handle) public static bool operator !=(CXIdxClientContainer left, CXIdxClientContainer right) => left.Handle != right.Handle; - public override bool Equals(object obj) => (obj is CXIdxClientContainer other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXIdxClientContainer other) && Equals(other); public bool Equals(CXIdxClientContainer other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXIdxClientEntity.cs b/sources/ClangSharp.Interop/Extensions/CXIdxClientEntity.cs index af03ab8a..10e6278b 100644 --- a/sources/ClangSharp.Interop/Extensions/CXIdxClientEntity.cs +++ b/sources/ClangSharp.Interop/Extensions/CXIdxClientEntity.cs @@ -21,7 +21,7 @@ public CXIdxClientEntity(IntPtr handle) public static bool operator !=(CXIdxClientEntity left, CXIdxClientEntity right) => left.Handle != right.Handle; - public override bool Equals(object obj) => (obj is CXIdxClientEntity other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXIdxClientEntity other) && Equals(other); public bool Equals(CXIdxClientEntity other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXIdxClientFile.cs b/sources/ClangSharp.Interop/Extensions/CXIdxClientFile.cs index 30ee0d24..77af0e53 100644 --- a/sources/ClangSharp.Interop/Extensions/CXIdxClientFile.cs +++ b/sources/ClangSharp.Interop/Extensions/CXIdxClientFile.cs @@ -21,7 +21,7 @@ public CXIdxClientFile(IntPtr handle) public static bool operator !=(CXIdxClientFile left, CXIdxClientFile right) => left.Handle != right.Handle; - public override bool Equals(object obj) => (obj is CXIdxClientFile other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXIdxClientFile other) && Equals(other); public bool Equals(CXIdxClientFile other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXIndex.cs b/sources/ClangSharp.Interop/Extensions/CXIndex.cs index 68284b36..6f23926e 100644 --- a/sources/ClangSharp.Interop/Extensions/CXIndex.cs +++ b/sources/ClangSharp.Interop/Extensions/CXIndex.cs @@ -38,7 +38,7 @@ public CXGlobalOptFlags GlobalOptions public void Dispose() => clang.disposeIndex(this); - public override bool Equals(object obj) => (obj is CXIndex other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXIndex other) && Equals(other); public bool Equals(CXIndex other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXIndexAction.cs b/sources/ClangSharp.Interop/Extensions/CXIndexAction.cs index 255bd44e..75e6fa98 100644 --- a/sources/ClangSharp.Interop/Extensions/CXIndexAction.cs +++ b/sources/ClangSharp.Interop/Extensions/CXIndexAction.cs @@ -32,7 +32,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXIndexAction other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXIndexAction other) && Equals(other); public bool Equals(CXIndexAction other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXModule.cs b/sources/ClangSharp.Interop/Extensions/CXModule.cs index 72eba8a8..1b2f8925 100644 --- a/sources/ClangSharp.Interop/Extensions/CXModule.cs +++ b/sources/ClangSharp.Interop/Extensions/CXModule.cs @@ -31,7 +31,7 @@ public CXModule(IntPtr handle) public static bool operator !=(CXModule left, CXModule right) => left.Handle != right.Handle; - public override bool Equals(object obj) => (obj is CXModule other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXModule other) && Equals(other); public bool Equals(CXModule other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXModuleMapDescriptor.cs b/sources/ClangSharp.Interop/Extensions/CXModuleMapDescriptor.cs index 237b9b28..bea305e2 100644 --- a/sources/ClangSharp.Interop/Extensions/CXModuleMapDescriptor.cs +++ b/sources/ClangSharp.Interop/Extensions/CXModuleMapDescriptor.cs @@ -32,7 +32,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXModuleMapDescriptor other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXModuleMapDescriptor other) && Equals(other); public bool Equals(CXModuleMapDescriptor other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXPrintingPolicy.cs b/sources/ClangSharp.Interop/Extensions/CXPrintingPolicy.cs index 80a2368c..a2414503 100644 --- a/sources/ClangSharp.Interop/Extensions/CXPrintingPolicy.cs +++ b/sources/ClangSharp.Interop/Extensions/CXPrintingPolicy.cs @@ -30,7 +30,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXPrintingPolicy other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXPrintingPolicy other) && Equals(other); public bool Equals(CXPrintingPolicy other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXRemapping.cs b/sources/ClangSharp.Interop/Extensions/CXRemapping.cs index 878e875a..bba0f1a4 100644 --- a/sources/ClangSharp.Interop/Extensions/CXRemapping.cs +++ b/sources/ClangSharp.Interop/Extensions/CXRemapping.cs @@ -47,7 +47,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXRemapping other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXRemapping other) && Equals(other); public bool Equals(CXRemapping other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXSourceLocation.cs b/sources/ClangSharp.Interop/Extensions/CXSourceLocation.cs index e5f4fec2..0feff371 100644 --- a/sources/ClangSharp.Interop/Extensions/CXSourceLocation.cs +++ b/sources/ClangSharp.Interop/Extensions/CXSourceLocation.cs @@ -16,7 +16,7 @@ public unsafe partial struct CXSourceLocation : IEquatable public static bool operator !=(CXSourceLocation left, CXSourceLocation right) => clang.equalLocations(left, right) == 0; - public override bool Equals(object obj) => (obj is CXSourceLocation other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXSourceLocation other) && Equals(other); public bool Equals(CXSourceLocation other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXSourceRange.cs b/sources/ClangSharp.Interop/Extensions/CXSourceRange.cs index 43480978..cddc8587 100644 --- a/sources/ClangSharp.Interop/Extensions/CXSourceRange.cs +++ b/sources/ClangSharp.Interop/Extensions/CXSourceRange.cs @@ -22,7 +22,7 @@ public partial struct CXSourceRange : IEquatable public static CXSourceRange Create(CXSourceLocation begin, CXSourceLocation end) => clang.getRange(begin, end); - public override bool Equals(object obj) => (obj is CXSourceRange other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXSourceRange other) && Equals(other); public bool Equals(CXSourceRange other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXTargetInfo.cs b/sources/ClangSharp.Interop/Extensions/CXTargetInfo.cs index 49bb1f7e..605f6f37 100644 --- a/sources/ClangSharp.Interop/Extensions/CXTargetInfo.cs +++ b/sources/ClangSharp.Interop/Extensions/CXTargetInfo.cs @@ -34,7 +34,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXTargetInfo other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXTargetInfo other) && Equals(other); public bool Equals(CXTargetInfo other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXToken.cs b/sources/ClangSharp.Interop/Extensions/CXToken.cs index 098975b7..62fcaf55 100644 --- a/sources/ClangSharp.Interop/Extensions/CXToken.cs +++ b/sources/ClangSharp.Interop/Extensions/CXToken.cs @@ -26,7 +26,7 @@ public unsafe partial struct CXToken : IEquatable (left.ptr_data != right.ptr_data); } - public override bool Equals(object obj) => (obj is CXSourceRange other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXSourceRange other) && Equals(other); public bool Equals(CXToken other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXTranslationUnit.cs b/sources/ClangSharp.Interop/Extensions/CXTranslationUnit.cs index cfcf02ec..7cfb391d 100644 --- a/sources/ClangSharp.Interop/Extensions/CXTranslationUnit.cs +++ b/sources/ClangSharp.Interop/Extensions/CXTranslationUnit.cs @@ -148,7 +148,7 @@ public void DisposeTokens(ReadOnlySpan tokens) } } - public override bool Equals(object obj) => (obj is CXTranslationUnit other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXTranslationUnit other) && Equals(other); public bool Equals(CXTranslationUnit other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXType.cs b/sources/ClangSharp.Interop/Extensions/CXType.cs index 35502d50..b2e86fc4 100644 --- a/sources/ClangSharp.Interop/Extensions/CXType.cs +++ b/sources/ClangSharp.Interop/Extensions/CXType.cs @@ -220,7 +220,7 @@ public string TypeClassSpelling public static bool operator !=(CXType left, CXType right) => clang.equalTypes(left, right) == 0; - public override bool Equals(object obj) => (obj is CXType other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXType other) && Equals(other); public bool Equals(CXType other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/CXVirtualFileOverlay.cs b/sources/ClangSharp.Interop/Extensions/CXVirtualFileOverlay.cs index 1eb2d179..208737dd 100644 --- a/sources/ClangSharp.Interop/Extensions/CXVirtualFileOverlay.cs +++ b/sources/ClangSharp.Interop/Extensions/CXVirtualFileOverlay.cs @@ -23,7 +23,7 @@ public CXVirtualFileOverlay(IntPtr handle) public static CXVirtualFileOverlay Create(uint options) => clang.VirtualFileOverlay_create(options); - public CXErrorCode AddFileMapping(string virtualPath, string realPath) + public CXErrorCode AddFileMapping(string? virtualPath, string? realPath) { using var marshaledVirtualPath = new MarshaledString(virtualPath); using var marshaledRealPath = new MarshaledString(realPath); @@ -39,7 +39,7 @@ public void Dispose() } } - public override bool Equals(object obj) => (obj is CXVirtualFileOverlay other) && Equals(other); + public override bool Equals(object? obj) => (obj is CXVirtualFileOverlay other) && Equals(other); public bool Equals(CXVirtualFileOverlay other) => this == other; diff --git a/sources/ClangSharp.Interop/Extensions/clang.ResolveLibrary.cs b/sources/ClangSharp.Interop/Extensions/clang.ResolveLibrary.cs index 2cf49917..47e5269e 100644 --- a/sources/ClangSharp.Interop/Extensions/clang.ResolveLibrary.cs +++ b/sources/ClangSharp.Interop/Extensions/clang.ResolveLibrary.cs @@ -9,7 +9,7 @@ namespace ClangSharp.Interop; public static unsafe partial class @clang { - public static event DllImportResolver ResolveLibrary; + public static event DllImportResolver? ResolveLibrary; static @clang() { diff --git a/sources/ClangSharp.Interop/Internals/MarshaledString.cs b/sources/ClangSharp.Interop/Internals/MarshaledString.cs index 77de0915..919467d6 100644 --- a/sources/ClangSharp.Interop/Internals/MarshaledString.cs +++ b/sources/ClangSharp.Interop/Internals/MarshaledString.cs @@ -8,7 +8,7 @@ namespace ClangSharp.Interop; public unsafe struct MarshaledString : IDisposable { - public MarshaledString(string input) + public MarshaledString(string? input) { int length; IntPtr value; diff --git a/sources/ClangSharp.Interop/Internals/MarshaledStringArray.cs b/sources/ClangSharp.Interop/Internals/MarshaledStringArray.cs index 6746e805..7f20c70a 100644 --- a/sources/ClangSharp.Interop/Internals/MarshaledStringArray.cs +++ b/sources/ClangSharp.Interop/Internals/MarshaledStringArray.cs @@ -6,7 +6,7 @@ namespace ClangSharp.Interop; public unsafe ref struct MarshaledStringArray { - private MarshaledString[] _values; + private MarshaledString[]? _values; public MarshaledStringArray(ReadOnlySpan inputs) { diff --git a/sources/ClangSharp.Interop/Shims/MemberNotNullWhenAttribute.cs b/sources/ClangSharp.Interop/Shims/MemberNotNullWhenAttribute.cs new file mode 100644 index 00000000..e21c3fc0 --- /dev/null +++ b/sources/ClangSharp.Interop/Shims/MemberNotNullWhenAttribute.cs @@ -0,0 +1,23 @@ +// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. + +namespace System.Diagnostics.CodeAnalysis; + +[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] +internal sealed class MemberNotNullWhenAttribute : Attribute +{ + public MemberNotNullWhenAttribute(bool returnValue, string member) + { + ReturnValue = returnValue; + Members = new[] { member }; + } + + public MemberNotNullWhenAttribute(bool returnValue, params string[] members) + { + ReturnValue = returnValue; + Members = members; + } + + public bool ReturnValue { get; } + + public string[] Members { get; } +} diff --git a/sources/ClangSharp.PInvokeGenerator/Abstractions/FieldDesc.cs b/sources/ClangSharp.PInvokeGenerator/Abstractions/FieldDesc.cs index 15ccf154..a10105ee 100644 --- a/sources/ClangSharp.PInvokeGenerator/Abstractions/FieldDesc.cs +++ b/sources/ClangSharp.PInvokeGenerator/Abstractions/FieldDesc.cs @@ -8,7 +8,7 @@ namespace ClangSharp.Abstractions; internal struct FieldDesc { public AccessSpecifier AccessSpecifier { get; set; } - public string NativeTypeName { get; set; } + public string? NativeTypeName { get; set; } public string EscapedName { get; set; } public string ParentName { get; set; } public int? Offset { get; set; } diff --git a/sources/ClangSharp.PInvokeGenerator/Abstractions/FunctionOrDelegateDesc.cs b/sources/ClangSharp.PInvokeGenerator/Abstractions/FunctionOrDelegateDesc.cs index cbb55b26..5bdbf137 100644 --- a/sources/ClangSharp.PInvokeGenerator/Abstractions/FunctionOrDelegateDesc.cs +++ b/sources/ClangSharp.PInvokeGenerator/Abstractions/FunctionOrDelegateDesc.cs @@ -13,7 +13,7 @@ internal struct FunctionOrDelegateDesc public string EscapedName { get; set; } public string EntryPoint { get; set; } public string ParentName { get; set; } - public string LibraryPath { get; set; } + public string? LibraryPath { get; set; } public string ReturnType { get; set; } public CallingConvention CallingConvention { get; set; } public FunctionOrDelegateFlags Flags { get; set; } diff --git a/sources/ClangSharp.PInvokeGenerator/Abstractions/IOutputBuilder.Visit.cs b/sources/ClangSharp.PInvokeGenerator/Abstractions/IOutputBuilder.Visit.cs index 7a71c669..97275886 100644 --- a/sources/ClangSharp.PInvokeGenerator/Abstractions/IOutputBuilder.Visit.cs +++ b/sources/ClangSharp.PInvokeGenerator/Abstractions/IOutputBuilder.Visit.cs @@ -9,7 +9,7 @@ internal partial interface IOutputBuilder void WriteDivider(bool force = false); void SuppressDivider(); - void WriteCustomAttribute(string attribute, Action callback = null); + void WriteCustomAttribute(string attribute, Action? callback = null); void WriteIid(string name, Guid value); void EmitUsingDirective(string directive); } diff --git a/sources/ClangSharp.PInvokeGenerator/Abstractions/IOutputBuilder.VisitDecl.cs b/sources/ClangSharp.PInvokeGenerator/Abstractions/IOutputBuilder.VisitDecl.cs index 0c86e849..74c024f1 100644 --- a/sources/ClangSharp.PInvokeGenerator/Abstractions/IOutputBuilder.VisitDecl.cs +++ b/sources/ClangSharp.PInvokeGenerator/Abstractions/IOutputBuilder.VisitDecl.cs @@ -48,7 +48,7 @@ internal partial interface IOutputBuilder void EndFunctionOrDelegate(in FunctionOrDelegateDesc info); void BeginStruct(in StructDesc info); - void BeginMarkerInterface(string[] baseTypeNames); + void BeginMarkerInterface(string[]? baseTypeNames); void EndMarkerInterface(); void BeginExplicitVtbl(); void EndExplicitVtbl(); diff --git a/sources/ClangSharp.PInvokeGenerator/Abstractions/ParameterDesc.cs b/sources/ClangSharp.PInvokeGenerator/Abstractions/ParameterDesc.cs index 37b62be6..0e623cb9 100644 --- a/sources/ClangSharp.PInvokeGenerator/Abstractions/ParameterDesc.cs +++ b/sources/ClangSharp.PInvokeGenerator/Abstractions/ParameterDesc.cs @@ -11,7 +11,7 @@ internal struct ParameterDesc public string Type { get; set; } public string Name { get; set; } public string NativeTypeName { get; set; } - public IEnumerable CppAttributes { get; set; } + public IEnumerable? CppAttributes { get; set; } public Action WriteCustomAttrs { get; set; } public object CustomAttrGeneratorData { get; set; } public CXSourceLocation? Location { get; set; } diff --git a/sources/ClangSharp.PInvokeGenerator/Abstractions/StructDesc.cs b/sources/ClangSharp.PInvokeGenerator/Abstractions/StructDesc.cs index 910a4518..eaf8606d 100644 --- a/sources/ClangSharp.PInvokeGenerator/Abstractions/StructDesc.cs +++ b/sources/ClangSharp.PInvokeGenerator/Abstractions/StructDesc.cs @@ -11,8 +11,8 @@ internal struct StructDesc { public AccessSpecifier AccessSpecifier { get; set; } public string EscapedName { get; set; } - public string NativeType { get; set; } - public string NativeInheritance { get; set; } + public string? NativeType { get; set; } + public string? NativeInheritance { get; set; } public LayoutDesc Layout { get; set; } public Guid? Uuid { get; set; } public StructFlags Flags { get; set; } @@ -73,7 +73,7 @@ public bool IsUnion public Action WriteCustomAttrs { get; set; } public object CustomAttrGeneratorData { get; set; } - public StructLayoutAttribute LayoutAttribute + public StructLayoutAttribute? LayoutAttribute { get { diff --git a/sources/ClangSharp.PInvokeGenerator/Abstractions/ValueDesc.cs b/sources/ClangSharp.PInvokeGenerator/Abstractions/ValueDesc.cs index 93f079e4..a400e2db 100644 --- a/sources/ClangSharp.PInvokeGenerator/Abstractions/ValueDesc.cs +++ b/sources/ClangSharp.PInvokeGenerator/Abstractions/ValueDesc.cs @@ -10,7 +10,7 @@ internal struct ValueDesc public AccessSpecifier AccessSpecifier { get; set; } public string TypeName { get; set; } public string EscapedName { get; set; } - public string NativeTypeName { get; set; } + public string? NativeTypeName { get; set; } public string ParentName { get; set; } public ValueKind Kind { get; set; } diff --git a/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.Visit.cs b/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.Visit.cs index fd0ecef8..8d3c31e6 100644 --- a/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.Visit.cs +++ b/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.Visit.cs @@ -8,7 +8,7 @@ namespace ClangSharp.CSharp; internal partial class CSharpOutputBuilder { private bool _customAttrIsForParameter = false; - public void WriteCustomAttribute(string attribute, Action callback = null) + public void WriteCustomAttribute(string attribute, Action? callback = null) { if (attribute.Equals("Flags") || attribute.Equals("Obsolete")) { diff --git a/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.VisitDecl.cs b/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.VisitDecl.cs index 892481d2..1dd7df55 100644 --- a/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.VisitDecl.cs +++ b/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.VisitDecl.cs @@ -812,7 +812,7 @@ public void BeginStruct(in StructDesc desc) WriteBlockStart(); } - public void BeginMarkerInterface(string[] baseTypeNames) + public void BeginMarkerInterface(string[]? baseTypeNames) { WriteIndented("public interface Interface"); diff --git a/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.cs b/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.cs index 7f2b9d28..b888478c 100644 --- a/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.cs +++ b/sources/ClangSharp.PInvokeGenerator/CSharp/CSharpOutputBuilder.cs @@ -1,6 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; @@ -208,7 +207,7 @@ public void EndMarker(string kind) Write("/*M*/>"); } - private void AddCppAttributes(IEnumerable attrs, string prefix = null, string postfix = null) + private void AddCppAttributes(IEnumerable attrs, string? prefix = null, string? postfix = null) { var attributeList = string.Join("^", attrs); if (string.IsNullOrWhiteSpace(attributeList)) @@ -240,7 +239,7 @@ private void AddCppAttributes(IEnumerable attrs, string prefix = null, s } } - private void AddNativeInheritanceAttribute(string inheritedFromName, string prefix = null, string postfix = null, string attributePrefix = null) + private void AddNativeInheritanceAttribute(string inheritedFromName, string? prefix = null, string? postfix = null, string? attributePrefix = null) { if (prefix is null) { @@ -277,7 +276,7 @@ private void AddNativeInheritanceAttribute(string inheritedFromName, string pref } } - private void AddVtblIndexAttribute(long vtblIndex, string prefix = null, string postfix = null, string attributePrefix = null) + private void AddVtblIndexAttribute(long vtblIndex, string? prefix = null, string? postfix = null, string? attributePrefix = null) { if (prefix is null) { @@ -312,7 +311,7 @@ private void AddVtblIndexAttribute(long vtblIndex, string prefix = null, string } } - private void AddNativeTypeNameAttribute(string nativeTypeName, string prefix = null, string postfix = null, string attributePrefix = null) + private void AddNativeTypeNameAttribute(string nativeTypeName, string? prefix = null, string? postfix = null, string? attributePrefix = null) { if (string.IsNullOrWhiteSpace(nativeTypeName)) { diff --git a/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs b/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs index a11f19bd..dafa06c2 100644 --- a/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs +++ b/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs @@ -37,10 +37,15 @@ public Diagnostic(DiagnosticLevel level, string message, string location) public string Message => _message; - public override bool Equals(object obj) => (obj is Diagnostic other) && Equals(other); + public override bool Equals(object? obj) => (obj is Diagnostic other) && Equals(other); - public bool Equals(Diagnostic other) + public bool Equals(Diagnostic? other) { + if (other is null) + { + return false; + } + return (_level == other.Level) && (_location == other.Location) && (_message == other.Message); diff --git a/sources/ClangSharp.PInvokeGenerator/OutputBuilderFactory.cs b/sources/ClangSharp.PInvokeGenerator/OutputBuilderFactory.cs index f77ad08b..446e169f 100644 --- a/sources/ClangSharp.PInvokeGenerator/OutputBuilderFactory.cs +++ b/sources/ClangSharp.PInvokeGenerator/OutputBuilderFactory.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using ClangSharp.Abstractions; using ClangSharp.CSharp; using ClangSharp.XML; @@ -67,7 +68,7 @@ public CSharpOutputBuilder GetTestOutputBuilder(string name) : throw new ArgumentException("A test output builder was not found with the given name", nameof(name)); } - public bool TryGetOutputBuilder(string name, out IOutputBuilder outputBuilder) + public bool TryGetOutputBuilder(string name, [MaybeNullWhen(false)] out IOutputBuilder outputBuilder) { return string.IsNullOrWhiteSpace(name) ? throw new ArgumentNullException(nameof(name)) diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs index e871fd01..3482ddcf 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Runtime.InteropServices; @@ -259,6 +260,8 @@ private void VisitDecl(Decl decl) private void VisitEnumConstantDecl(EnumConstantDecl enumConstantDecl) { + Debug.Assert(_outputBuilder is not null); + var accessSpecifier = AccessSpecifier.None; var name = GetRemappedCursorName(enumConstantDecl); var escapedName = EscapeName(name); @@ -354,6 +357,7 @@ private void VisitEnumDecl(EnumDecl enumDecl) StartUsingOutputBuilder(name); { + Debug.Assert(_outputBuilder is not null); EnumDesc desc = default; if (!isAnonymousEnum) @@ -393,6 +397,8 @@ private void VisitEnumDecl(EnumDecl enumDecl) private void VisitFieldDecl(FieldDecl fieldDecl) { + Debug.Assert(_outputBuilder is not null); + if (fieldDecl.IsBitField) { return; @@ -419,8 +425,11 @@ private void VisitFieldDecl(FieldDecl fieldDecl) nativeTypeName = string.IsNullOrWhiteSpace(nativeTypeName) ? typeName.Replace("byte*", "bool *") : nativeTypeName; } + var parent = fieldDecl.Parent; + Debug.Assert(parent is not null); + int? offset = null; - if (fieldDecl.Parent.IsUnion) + if (parent.IsUnion) { offset = 0; } @@ -429,7 +438,7 @@ private void VisitFieldDecl(FieldDecl fieldDecl) AccessSpecifier = accessSpecifier, NativeTypeName = nativeTypeName, EscapedName = escapedName, - ParentName = GetRemappedCursorName(fieldDecl.Parent), + ParentName = GetRemappedCursorName(parent), Offset = offset, NeedsNewKeyword = NeedsNewKeyword(name), Location = fieldDecl.Location, @@ -484,11 +493,12 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) var name = GetRemappedCursorName(functionDecl); var cxxMethodDecl = functionDecl as CXXMethodDecl; - var isCxxMethodDecl = cxxMethodDecl is not null; - if (isCxxMethodDecl && (cxxMethodDecl is CXXConstructorDecl)) + if (cxxMethodDecl is not null and CXXConstructorDecl) { - name = GetRemappedCursorName(cxxMethodDecl.Parent); + var parent = cxxMethodDecl.Parent; + Debug.Assert(parent is not null); + name = GetRemappedCursorName(parent); } var isManualImport = _config.WithManualImports.Contains(name); @@ -496,26 +506,36 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) var className = name; var parentName = ""; - if (functionDecl.DeclContext is not CXXRecordDecl cxxRecordDecl) + var cxxRecordDecl = functionDecl.DeclContext as CXXRecordDecl; + + if (cxxRecordDecl is null) { - cxxRecordDecl = null; className = GetClass(name); parentName = className; StartUsingOutputBuilder(className); } - else if ((Cursor)functionDecl.LexicalDeclContext != cxxRecordDecl) + else if ((Cursor?)functionDecl.LexicalDeclContext != cxxRecordDecl) { // We shouldn't reprocess C++ functions outside the declaration return; } var accessSpecifier = GetAccessSpecifier(functionDecl, matchStar: false); - var body = functionDecl.Body; - var hasBody = body is not null; - var isVirtual = isCxxMethodDecl && cxxMethodDecl.IsVirtual; - var escapedName = isVirtual ? PrefixAndStripName(name, GetOverloadIndex(cxxMethodDecl)) : EscapeAndStripName(name); + bool isVirtual; + string escapedName; + + if ((cxxMethodDecl is not null) && cxxMethodDecl.IsVirtual) + { + isVirtual = true; + escapedName = PrefixAndStripName(name, GetOverloadIndex(cxxMethodDecl)); + } + else + { + isVirtual = false; + escapedName = EscapeAndStripName(name); + } var returnType = functionDecl.ReturnType; var returnTypeName = GetRemappedTypeName(functionDecl, cxxRecordDecl, returnType, out var nativeTypeName); @@ -527,7 +547,7 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) AddDiagnostic(DiagnosticLevel.Warning, $"Found manual import for {name} with no class remapping. First Parameter Type: {firstParameterTypeName}; Return Type: {returnTypeName}", functionDecl); } - if (isVirtual || !hasBody) + if (isVirtual || (body is null)) { if (returnTypeName == "bool") { @@ -547,7 +567,7 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) var type = functionDecl.Type; var callingConventionName = GetCallingConvention(functionDecl, cxxRecordDecl, type); - var isDllImport = !hasBody && !isVirtual; + var isDllImport = (body is null) && !isVirtual; var entryPoint = ""; if (isDllImport) @@ -555,7 +575,7 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) entryPoint = functionDecl.IsExternC ? GetCursorName(functionDecl) : functionDecl.Handle.Mangling.CString; } - var needsReturnFixup = isCxxMethodDecl && NeedsReturnFixup(cxxMethodDecl); + var needsReturnFixup = (cxxMethodDecl is not null) && NeedsReturnFixup(cxxMethodDecl); var desc = new FunctionOrDelegateDesc { AccessSpecifier = accessSpecifier, @@ -570,8 +590,8 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) IsManualImport = isManualImport, HasFnPtrCodeGen = !_config.ExcludeFnptrCodegen, SetLastError = GetSetLastError(functionDecl), - IsCxx = isCxxMethodDecl, - IsStatic = isDllImport || !isCxxMethodDecl || cxxMethodDecl.IsStatic, + IsCxx = cxxMethodDecl is not null, + IsStatic = isDllImport || (cxxMethodDecl is null) || cxxMethodDecl.IsStatic, NeedsNewKeyword = NeedsNewKeyword(escapedName, functionDecl.Parameters), IsUnsafe = IsUnsafe(functionDecl), IsCtxCxxRecord = cxxRecordDecl is not null, @@ -580,7 +600,7 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) ReturnType = needsReturnFixup ? $"{returnTypeName}*" : returnTypeName, IsCxxConstructor = functionDecl is CXXConstructorDecl, Location = functionDecl.Location, - HasBody = hasBody, + HasBody = body is not null, WriteCustomAttrs = static context => { (var functionDecl, var outputBuilder, var generator) = ((FunctionDecl, IOutputBuilder, PInvokeGenerator))context; @@ -594,6 +614,7 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) }, CustomAttrGeneratorData = (functionDecl, _outputBuilder, this), }; + Debug.Assert(_outputBuilder is not null); _ = _topLevelClassIsUnsafe.TryGetValue(className, out var isUnsafe); _outputBuilder.BeginFunctionOrDelegate(in desc, ref isUnsafe); @@ -601,11 +622,11 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) _outputBuilder.BeginFunctionInnerPrototype(in desc); - var needsThis = isVirtual || (isCxxMethodDecl && !hasBody && cxxMethodDecl.IsInstance); + var needsThis = isVirtual || ((cxxMethodDecl is not null) && (body is null) && cxxMethodDecl.IsInstance); if (needsThis) { - Debug.Assert(cxxRecordDecl != null); + Debug.Assert(cxxRecordDecl is not null); if (!IsPrevContextDecl(out var thisCursor, out _)) { @@ -659,12 +680,14 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) _outputBuilder.EndFunctionInnerPrototype(in desc); - if (hasBody && !isVirtual) + if ((body is not null) && !isVirtual) { _outputBuilder.BeginBody(); - if ((_cxxRecordDeclContext is not null) && (_cxxRecordDeclContext != cxxRecordDecl) && HasField(cxxRecordDecl)) + if ((_cxxRecordDeclContext is not null) && (cxxRecordDecl is not null) && (_cxxRecordDeclContext != cxxRecordDecl) && HasField(cxxRecordDecl)) { + Debug.Assert(cxxMethodDecl is not null); + var outputBuilder = StartCSharpCode(); outputBuilder.WriteIndentation(); @@ -673,9 +696,12 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) outputBuilder.Write("return "); } - var cxxBaseSpecifier = _cxxRecordDeclContext.Bases.Where((baseSpecifier) => baseSpecifier.Referenced == cxxMethodDecl.Parent).SingleOrDefault(); + var parent = cxxMethodDecl.Parent; + Debug.Assert(parent is not null); + + var cxxBaseSpecifier = _cxxRecordDeclContext.Bases.Where((baseSpecifier) => baseSpecifier.Referenced == parent).SingleOrDefault(); - if (cxxBaseSpecifier != null) + if (cxxBaseSpecifier is not null) { var baseFieldName = GetAnonymousName(cxxBaseSpecifier, "Base"); baseFieldName = GetRemappedName(baseFieldName, cxxBaseSpecifier, tryRemapOperatorName: true, out var wasRemapped, skipUsing: true); @@ -727,7 +753,7 @@ private void VisitFunctionDecl(FunctionDecl functionDecl) else { var firstCtorInitializer = functionDecl.Parameters.Any() ? (functionDecl.CursorChildren.IndexOf(functionDecl.Parameters.Last()) + 1) : 0; - var lastCtorInitializer = (functionDecl.Body != null) ? functionDecl.CursorChildren.IndexOf(functionDecl.Body) : functionDecl.CursorChildren.Count; + var lastCtorInitializer = (functionDecl.Body is not null) ? functionDecl.CursorChildren.IndexOf(functionDecl.Body) : functionDecl.CursorChildren.Count; if (functionDecl is CXXConstructorDecl cxxConstructorDecl) { @@ -817,8 +843,9 @@ private void VisitIndirectFieldDecl(IndirectFieldDecl indirectFieldDecl) } var fieldDecl = indirectFieldDecl.AnonField; - var anonymousRecordDecl = fieldDecl.Parent; + var anonymousRecordDecl = fieldDecl.Parent; + Debug.Assert(anonymousRecordDecl is not null); var rootRecordDecl = anonymousRecordDecl; var contextNameParts = new Stack(); @@ -884,11 +911,14 @@ private void VisitIndirectFieldDecl(IndirectFieldDecl indirectFieldDecl) return; } + var parent = fieldDecl.Parent; + Debug.Assert(parent is not null); + var desc = new FieldDesc { AccessSpecifier = accessSpecifier, NativeTypeName = null, EscapedName = escapedName, - ParentName = GetRemappedCursorName(fieldDecl.Parent), + ParentName = GetRemappedCursorName(parent), Offset = null, NeedsNewKeyword = false, NeedsUnscopedRef = _config.GeneratePreviewCode && !fieldDecl.IsBitField, @@ -903,6 +933,8 @@ private void VisitIndirectFieldDecl(IndirectFieldDecl indirectFieldDecl) CustomAttrGeneratorData = (fieldDecl, this), }; + Debug.Assert(_outputBuilder is not null); + _outputBuilder.WriteDivider(true); _outputBuilder.BeginField(in desc); @@ -1105,6 +1137,8 @@ private void VisitNamespaceDecl(NamespaceDecl namespaceDecl) private void VisitParmVarDecl(ParmVarDecl parmVarDecl) { + Debug.Assert(_outputBuilder is not null); + if (IsExcluded(parmVarDecl)) { return; @@ -1121,7 +1155,7 @@ private void VisitParmVarDecl(ParmVarDecl parmVarDecl) else { _ = IsPrevContextDecl(out var previousContext, out _); - AddDiagnostic(DiagnosticLevel.Error, $"Unsupported parameter variable declaration parent: '{previousContext.CursorKindSpelling}'. Generated bindings may be incomplete.", previousContext); + AddDiagnostic(DiagnosticLevel.Error, $"Unsupported parameter variable declaration parent: '{previousContext?.CursorKindSpelling}'. Generated bindings may be incomplete.", previousContext); } void ForFunctionDecl(ParmVarDecl parmVarDecl, FunctionDecl functionDecl) @@ -1307,7 +1341,7 @@ private void VisitRecordDecl(RecordDecl recordDecl) var hasVtbl = false; var hasBaseVtbl = false; - if (cxxRecordDecl != null) + if (cxxRecordDecl is not null) { hasVtbl = HasVtbl(cxxRecordDecl, out hasBaseVtbl); } @@ -1316,10 +1350,12 @@ private void VisitRecordDecl(RecordDecl recordDecl) var maxAlignm = recordDecl.Fields.Any() ? recordDecl.Fields.Max((fieldDecl) => Math.Max(fieldDecl.Type.Handle.AlignOf, 1)) : alignment; var isTopLevelStruct = _config.WithTypes.TryGetValue(name, out var withType) && (withType == "struct"); - var generateTestsClass = _testOutputBuilder != null && !recordDecl.IsAnonymousStructOrUnion && recordDecl.DeclContext is not RecordDecl; + var generateTestsClass = !recordDecl.IsAnonymousStructOrUnion && recordDecl.DeclContext is not RecordDecl; - if (generateTestsClass && !isTopLevelStruct) + if ((_testOutputBuilder is not null) && generateTestsClass && !isTopLevelStruct) { + Debug.Assert(_testOutputBuilder is not null); + _testOutputBuilder.WriteIndented("/// Provides validation of the struct."); @@ -1342,7 +1378,7 @@ private void VisitRecordDecl(RecordDecl recordDecl) _uuidsToGenerate.Add(uuidName, uuid); - if (_testOutputBuilder != null) + if (_testOutputBuilder is not null) { var className = GetClass(uuidName); @@ -1402,10 +1438,10 @@ private void VisitRecordDecl(RecordDecl recordDecl) GetTypeSize(recordDecl, recordDecl.TypeForDecl, ref alignment32, ref alignment64, out var size32, out var size64); - string[] baseTypeNames = null; + string[]? baseTypeNames = null; - string nativeNameWithExtras = null, nativeInheritance = null; - if ((cxxRecordDecl != null) && cxxRecordDecl.Bases.Any()) + string? nativeNameWithExtras = null, nativeInheritance = null; + if ((cxxRecordDecl is not null) && cxxRecordDecl.Bases.Any()) { var nativeTypeNameBuilder = new StringBuilder(); var baseTypeNamesBuilder = new List(); @@ -1461,6 +1497,7 @@ private void VisitRecordDecl(RecordDecl recordDecl) }, CustomAttrGeneratorData = (recordDecl, this), }; + Debug.Assert(_outputBuilder is not null); if (!isTopLevelStruct) { @@ -1484,9 +1521,9 @@ private void VisitRecordDecl(RecordDecl recordDecl) _ = withUsings.Add("System.Runtime.InteropServices"); } - if (desc.Uuid is not null) + if (desc.Uuid.HasValue) { - withAttributes.Add($"Guid(\"{nullableUuid.Value.ToString("D", CultureInfo.InvariantCulture).ToUpperInvariant()}\")"); + withAttributes.Add($"Guid(\"{nullableUuid.GetValueOrDefault().ToString("D", CultureInfo.InvariantCulture).ToUpperInvariant()}\")"); _ = withUsings.Add("System.Runtime.InteropServices"); } @@ -1558,7 +1595,7 @@ private void VisitRecordDecl(RecordDecl recordDecl) _outputBuilder.EndValue(in valueDesc); } - if (hasVtbl || (hasBaseVtbl && !HasBaseField(cxxRecordDecl))) + if (hasVtbl || (hasBaseVtbl && (cxxRecordDecl is not null) && !HasBaseField(cxxRecordDecl))) { var fieldDesc = new FieldDesc { AccessSpecifier = AccessSpecifier.Public, @@ -1567,7 +1604,6 @@ private void VisitRecordDecl(RecordDecl recordDecl) Offset = null, NeedsNewKeyword = false, }; - _outputBuilder.BeginField(in fieldDesc); if (_config.GenerateExplicitVtbls) @@ -1589,7 +1625,7 @@ private void VisitRecordDecl(RecordDecl recordDecl) _outputBuilder.EndField(in fieldDesc); } - if (cxxRecordDecl != null) + if (cxxRecordDecl is not null) { for (var index = 0; index < cxxRecordDecl.Bases.Count; index++) { @@ -1619,7 +1655,7 @@ private void VisitRecordDecl(RecordDecl recordDecl) } } - if (generateTestsClass) + if ((_testOutputBuilder is not null) && generateTestsClass) { _testOutputBuilder.WriteIndented("/// Validates that the ().Concat(recordDecl.IndirectFields); - if (cxxRecordDecl != null) + if (cxxRecordDecl is not null) { OutputMethods(cxxRecordDecl, cxxRecordDecl); excludedCursors = excludedCursors.Concat(cxxRecordDecl.Methods); @@ -1759,6 +1795,8 @@ private void VisitRecordDecl(RecordDecl recordDecl) if (hasVtbl || hasBaseVtbl) { + Debug.Assert(cxxRecordDecl is not null); + if (!_config.GenerateCompatibleCode) { _outputBuilder.EmitCompatibleCodeSupport(); @@ -1800,7 +1838,7 @@ private void VisitRecordDecl(RecordDecl recordDecl) { _outputBuilder.EndStruct(in desc); - if (generateTestsClass) + if ((_testOutputBuilder is not null) && generateTestsClass) { _testOutputBuilder.WriteBlockEnd(); } @@ -2066,9 +2104,12 @@ void OutputVtblHelperMethod(CXXRecordDecl cxxRecordDecl, CXXMethodDecl cxxMethod var parentName = cxxRecordDeclName; var isInherited = false; - if (cxxMethodDecl.Parent != cxxRecordDecl) + var parent = cxxMethodDecl.Parent; + Debug.Assert(parent is not null); + + if (parent != cxxRecordDecl) { - parentName = GetRemappedCursorName(cxxMethodDecl.Parent); + parentName = GetRemappedCursorName(parent); isInherited = true; } @@ -2311,6 +2352,9 @@ void VisitBitfieldDecl(FieldDecl fieldDecl, Type[] types, RecordDecl recordDecl, Type typeBacking; string typeNameBacking; + var parent = fieldDecl.Parent; + Debug.Assert(parent is not null); + if ((!_config.GenerateUnixTypes && (currentSize != previousSize)) || (fieldDecl.BitWidthValue > remainingBits)) { if (index >= 0) @@ -2325,13 +2369,13 @@ void VisitBitfieldDecl(FieldDecl fieldDecl, Type[] types, RecordDecl recordDecl, typeBacking = (index > 0) ? types[index - 1] : types[0]; typeNameBacking = GetRemappedTypeName(fieldDecl, context: null, typeBacking, out _); - if (fieldDecl.Parent == recordDecl) + if (parent == recordDecl) { var fieldDesc = new FieldDesc { AccessSpecifier = AccessSpecifier.Public, NativeTypeName = null, EscapedName = bitfieldName, - Offset = fieldDecl.Parent.IsUnion ? 0 : null, + Offset = parent.IsUnion ? 0 : null, NeedsNewKeyword = false, Location = fieldDecl.Location, }; @@ -2518,7 +2562,7 @@ void VisitBitfieldDecl(FieldDecl fieldDecl, Type[] types, RecordDecl recordDecl, AccessSpecifier = accessSpecifier, NativeTypeName = nativeTypeName, EscapedName = escapedName, - ParentName = GetRemappedCursorName(fieldDecl.Parent), + ParentName = GetRemappedCursorName(parent), Offset = null, NeedsNewKeyword = false, Location = fieldDecl.Location, @@ -2984,7 +3028,7 @@ private void VisitTypedefDecl(TypedefDecl typedefDecl, bool onlyHandleRemappings { ForUnderlyingType(typedefDecl, typedefDecl.UnderlyingType, onlyHandleRemappings); - void ForFunctionProtoType(TypedefDecl typedefDecl, FunctionProtoType functionProtoType, Type parentType, bool onlyHandleRemappings) + void ForFunctionProtoType(TypedefDecl typedefDecl, FunctionProtoType functionProtoType, Type? parentType, bool onlyHandleRemappings) { if (!_config.ExcludeFnptrCodegen || onlyHandleRemappings) { @@ -3001,6 +3045,8 @@ void ForFunctionProtoType(TypedefDecl typedefDecl, FunctionProtoType functionPro StartUsingOutputBuilder(name); { + Debug.Assert(_outputBuilder is not null); + var desc = new FunctionOrDelegateDesc { AccessSpecifier = GetAccessSpecifier(typedefDecl, matchStar: true), CallingConvention = callingConventionName, @@ -3033,7 +3079,7 @@ void ForFunctionProtoType(TypedefDecl typedefDecl, FunctionProtoType functionPro StopUsingOutputBuilder(); } - void ForPointeeType(TypedefDecl typedefDecl, Type parentType, Type pointeeType, bool onlyHandleRemappings) + void ForPointeeType(TypedefDecl typedefDecl, Type? parentType, Type pointeeType, bool onlyHandleRemappings) { if (pointeeType is AttributedType attributedType) { @@ -3101,7 +3147,10 @@ void ForUnderlyingType(TypedefDecl typedefDecl, Type underlyingType, bool onlyHa } else if (underlyingType is TagType underlyingTagType) { - var underlyingName = GetCursorName(underlyingTagType.AsTagDecl); + var tagDecl = underlyingTagType.AsTagDecl; + Debug.Assert(tagDecl is not null); + + var underlyingName = GetCursorName(tagDecl); var typedefName = GetCursorName(typedefDecl); if (underlyingName != typedefName) @@ -3336,8 +3385,11 @@ private void VisitVarDecl(VarDecl varDecl) } } - if (type is ArrayType arrayType) + if (type is ArrayType) { + var arrayType = type as ArrayType; + Debug.Assert(arrayType is not null); + flags |= ValueFlags.Array; if (!_config.GenerateUnmanagedConstants) @@ -3377,6 +3429,7 @@ private void VisitVarDecl(VarDecl varDecl) if (openedOutputBuilder) { StartUsingOutputBuilder(className); + Debug.Assert(_outputBuilder is not null); if ((kind == ValueKind.String) && typeName.StartsWith("ReadOnlySpan<")) { @@ -3384,8 +3437,13 @@ private void VisitVarDecl(VarDecl varDecl) } } + Debug.Assert(_outputBuilder is not null); + _outputBuilder.BeginValue(in desc); - _context.Last.Value = (_context.Last.Value.Cursor, desc); + + var currentContext = _context.Last; + Debug.Assert(currentContext is not null); + currentContext.Value = (currentContext.Value.Cursor, desc); if (varDecl.HasInit) { @@ -3424,7 +3482,7 @@ private void VisitVarDecl(VarDecl varDecl) else { _ = IsPrevContextDecl(out var previousContext, out _); - AddDiagnostic(DiagnosticLevel.Error, $"Unsupported variable declaration parent: '{previousContext.CursorKindSpelling}'. Generated bindings may be incomplete.", previousContext); + AddDiagnostic(DiagnosticLevel.Error, $"Unsupported variable declaration parent: '{previousContext?.CursorKindSpelling}'. Generated bindings may be incomplete.", previousContext); } void ForDeclStmt(VarDecl varDecl, DeclStmt declStmt) @@ -3563,7 +3621,10 @@ private bool IsConstant(string targetTypeName, Expr initExpr) { var callExpr = (CallExpr)initExpr; - if (callExpr.DirectCallee.IsInlined) + var directCallee = callExpr.DirectCallee; + Debug.Assert(directCallee is not null); + + if (directCallee.IsInlined) { var evaluateResult = callExpr.Handle.Evaluate; diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitStmt.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitStmt.cs index ae57bdcb..f85a9ecc 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitStmt.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitStmt.cs @@ -8,6 +8,7 @@ using System.Runtime.InteropServices; using System.Text; using ClangSharp.Abstractions; +using ClangSharp.CSharp; using ClangSharp.Interop; namespace ClangSharp; @@ -157,7 +158,7 @@ private void VisitCallExpr(CallExpr callExpr) case "memset": { - NamedDecl namedDecl = null; + NamedDecl? namedDecl = null; if (callExpr.NumArgs == 3) { @@ -528,15 +529,18 @@ private static void VisitCXXDefaultArgExpr(CXXDefaultArgExpr cxxDefaultArgExpr) private void VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr cxxDependentScopeMemberExpr) { var outputBuilder = StartCSharpCode(); + if (!cxxDependentScopeMemberExpr.IsImplicitAccess) { - Visit(cxxDependentScopeMemberExpr.Base); + var @base = cxxDependentScopeMemberExpr.Base; + Debug.Assert(@base is not null); + Visit(@base); - var type = cxxDependentScopeMemberExpr.Base is CXXThisExpr + var type = @base is CXXThisExpr ? null - : cxxDependentScopeMemberExpr.Base is DeclRefExpr declRefExpr + : @base is DeclRefExpr declRefExpr ? declRefExpr.Decl.Type.CanonicalType - : cxxDependentScopeMemberExpr.Base.Type.CanonicalType; + : @base.Type.CanonicalType; if (type is not null and (PointerType or ReferenceType)) { @@ -717,7 +721,19 @@ private void VisitCXXUuidofExpr(CXXUuidofExpr cxxUuidofExpr) var outputBuilder = StartCSharpCode(); outputBuilder.Write("typeof("); - var type = cxxUuidofExpr.IsTypeOperand ? cxxUuidofExpr.TypeOperand : cxxUuidofExpr.ExprOperand.Type; + Type type; + + if (cxxUuidofExpr.IsTypeOperand) + { + type = cxxUuidofExpr.TypeOperand; + } + else + { + var exprOperand = cxxUuidofExpr.ExprOperand; + Debug.Assert(exprOperand is not null); + type = exprOperand.Type; + } + var typeName = GetRemappedTypeName(cxxUuidofExpr, context: null, type, out _); outputBuilder.Write(typeName); @@ -790,9 +806,12 @@ private void VisitDeclRefExpr(DeclRefExpr declRefExpr) private void VisitDeclStmt(DeclStmt declStmt) { var outputBuilder = StartCSharpCode(); + if (declStmt.IsSingleDecl) { - Visit(declStmt.SingleDecl); + var singleDecl = declStmt.SingleDecl; + Debug.Assert(singleDecl is not null); + Visit(singleDecl); } else { @@ -1101,11 +1120,16 @@ void ForEnumConstantDecl(ImplicitCastExpr implicitCastExpr, EnumConstantDecl enu } else if (IsPrevContextStmt(out _, out _)) { - var previousContext = _context.Last.Previous; + var previousContext = _context.Last; + Debug.Assert(previousContext is not null); + + previousContext = previousContext.Previous; + Debug.Assert(previousContext is not null); do { previousContext = previousContext.Previous; + Debug.Assert(previousContext is not null); } while (previousContext.Value.Cursor is ParenExpr or ImplicitCastExpr or CaseStmt or CompoundStmt); @@ -1149,14 +1173,14 @@ private void VisitImplicitValueInitExpr(ImplicitValueInitExpr implicitValueInitE private void VisitInitListExpr(InitListExpr initListExpr) { var outputBuilder = StartCSharpCode(); - ForType(initListExpr, initListExpr.Type); + ForType(outputBuilder, initListExpr, initListExpr.Type); StopCSharpCode(); - long CalculateRootSize(InitListExpr initListExpr, ArrayType arrayType, bool isUnmanagedConstant) + long CalculateRootSize(CSharpOutputBuilder outputBuilder, InitListExpr initListExpr, ArrayType? arrayType, bool isUnmanagedConstant) { long rootSize = -1; - do + while (arrayType is not null) { if (!isUnmanagedConstant) { @@ -1196,12 +1220,11 @@ long CalculateRootSize(InitListExpr initListExpr, ArrayType arrayType, bool isUn } arrayType = arrayType.ElementType as ArrayType; } - while (arrayType is not null); return rootSize; } - void ForArrayType(InitListExpr initListExpr, ArrayType arrayType) + void ForArrayType(CSharpOutputBuilder outputBuilder, InitListExpr initListExpr, ArrayType arrayType) { var type = initListExpr.Type; var typeName = GetRemappedTypeName(initListExpr, context: null, type, out _); @@ -1219,14 +1242,14 @@ void ForArrayType(InitListExpr initListExpr, ArrayType arrayType) if (_config.GenerateUnmanagedConstants && isUnmanagedConstant && (_testStmtOutputBuilder is null)) { - HandleUnmanagedConstant(initListExpr, arrayType, typeName, escapedName); + HandleUnmanagedConstant(outputBuilder, initListExpr, arrayType, typeName, escapedName); } else { outputBuilder.Write("new "); outputBuilder.Write(typeName); - var rootSize = CalculateRootSize(initListExpr, arrayType, isUnmanagedConstant: false); + var rootSize = CalculateRootSize(outputBuilder, initListExpr, arrayType, isUnmanagedConstant: false); outputBuilder.WriteNewline(); outputBuilder.WriteBlockStart(); @@ -1249,7 +1272,7 @@ void ForArrayType(InitListExpr initListExpr, ArrayType arrayType) } } - void ForBuiltinType(InitListExpr initListExpr, BuiltinType builtinType) + void ForBuiltinType(CSharpOutputBuilder outputBuilder, InitListExpr initListExpr, BuiltinType builtinType) { var inits = initListExpr.Inits; @@ -1265,7 +1288,7 @@ void ForBuiltinType(InitListExpr initListExpr, BuiltinType builtinType) outputBuilder.NeedsSemicolon = true; } - void ForRecordType(InitListExpr initListExpr, RecordType recordType) + void ForRecordType(CSharpOutputBuilder outputBuilder, InitListExpr initListExpr, RecordType recordType) { var type = initListExpr.Type; var typeName = GetRemappedTypeName(initListExpr, context: null, type, out _); @@ -1283,7 +1306,7 @@ void ForRecordType(InitListExpr initListExpr, RecordType recordType) if (_config.GenerateUnmanagedConstants && isUnmanagedConstant && (_testStmtOutputBuilder is null)) { - HandleUnmanagedConstant(initListExpr, recordType, typeName, escapedName); + HandleUnmanagedConstant(outputBuilder, initListExpr, recordType, typeName, escapedName); } else { @@ -1343,7 +1366,7 @@ void ForRecordType(InitListExpr initListExpr, RecordType recordType) } } - void ForPointerType(InitListExpr initListExpr, PointerType pointerType) + void ForPointerType(CSharpOutputBuilder outputBuilder, InitListExpr initListExpr, PointerType pointerType) { var inits = initListExpr.Inits; @@ -1359,31 +1382,31 @@ void ForPointerType(InitListExpr initListExpr, PointerType pointerType) outputBuilder.NeedsSemicolon = true; } - void ForType(InitListExpr initListExpr, Type type) + void ForType(CSharpOutputBuilder outputBuilder, InitListExpr initListExpr, Type type) { if (type is ArrayType arrayType) { - ForArrayType(initListExpr, arrayType); + ForArrayType(outputBuilder, initListExpr, arrayType); } else if (type is BuiltinType builtinType) { - ForBuiltinType(initListExpr, builtinType); + ForBuiltinType(outputBuilder, initListExpr, builtinType); } else if (type is ElaboratedType elaboratedType) { - ForType(initListExpr, elaboratedType.NamedType); + ForType(outputBuilder, initListExpr, elaboratedType.NamedType); } else if (type is PointerType pointerType) { - ForPointerType(initListExpr, pointerType); + ForPointerType(outputBuilder, initListExpr, pointerType); } else if (type is RecordType recordType) { - ForRecordType(initListExpr, recordType); + ForRecordType(outputBuilder, initListExpr, recordType); } else if (type is TypedefType typedefType) { - ForType(initListExpr, typedefType.Decl.UnderlyingType); + ForType(outputBuilder, initListExpr, typedefType.Decl.UnderlyingType); } else { @@ -1391,27 +1414,27 @@ void ForType(InitListExpr initListExpr, Type type) } } - void HandleInitListExpr(InitListExpr initListExpr) + void HandleInitListExpr(CSharpOutputBuilder outputBuilder, InitListExpr initListExpr) { var inits = initListExpr.Inits; if (initListExpr.NumInits > 0) { - HandleInitStmt(inits[0]); + HandleInitStmt(outputBuilder, inits[0]); } for (var i = 1; i < inits.Count; i++) { outputBuilder.WriteLine(','); - HandleInitStmt(inits[i]); + HandleInitStmt(outputBuilder, inits[i]); } } - void HandleInitStmt(Stmt init) + void HandleInitStmt(CSharpOutputBuilder outputBuilder, Stmt init) { if (init is InitListExpr nestedInitListExpr) { - HandleInitListExpr(nestedInitListExpr); + HandleInitListExpr(outputBuilder, nestedInitListExpr); } else { @@ -1467,7 +1490,7 @@ void HandleInitStmt(Stmt init) } } - void HandleUnmanagedConstant(InitListExpr initListExpr, Type type, string typeName, string escapedName) + void HandleUnmanagedConstant(CSharpOutputBuilder outputBuilder, InitListExpr initListExpr, Type type, string typeName, string escapedName) { outputBuilder.AddUsingDirective("System"); outputBuilder.AddUsingDirective("System.Diagnostics"); @@ -1477,7 +1500,7 @@ void HandleUnmanagedConstant(InitListExpr initListExpr, Type type, string typeNa outputBuilder.WriteIndentedLine("ReadOnlySpan data = new byte[] {"); outputBuilder.IncreaseIndentation(); - HandleInitListExpr(initListExpr); + HandleInitListExpr(outputBuilder, initListExpr); outputBuilder.WriteNewline(); outputBuilder.DecreaseIndentation(); @@ -1488,7 +1511,7 @@ void HandleUnmanagedConstant(InitListExpr initListExpr, Type type, string typeNa if (type is ArrayType arrayType) { - rootSize = CalculateRootSize(initListExpr, arrayType, isUnmanagedConstant: true); + rootSize = CalculateRootSize(outputBuilder, initListExpr, arrayType, isUnmanagedConstant: true); outputBuilder.WriteIndented("Debug.Assert(data.Length == (Unsafe.SizeOf<"); outputBuilder.Write(typeName); @@ -1521,12 +1544,12 @@ void HandleUnmanagedConstant(InitListExpr initListExpr, Type type, string typeNa } outputBuilder.WriteLine(';'); - StartUsingOutputBuilder(_outputBuilder.Name, includeTestOutput: true); + StartUsingOutputBuilder(outputBuilder.Name, includeTestOutput: true); if (_testOutputBuilder != null) { _testOutputBuilder.AddUsingDirective("System"); - _testOutputBuilder.AddUsingDirective($"static {GetNamespace(_outputBuilder.Name)}.{_outputBuilder.Name}"); + _testOutputBuilder.AddUsingDirective($"static {GetNamespace(outputBuilder.Name)}.{outputBuilder.Name}"); _testOutputBuilder.WriteIndented("/// Validates that the value of the baseSpecifier.Referenced == cxxMethodDecl.Parent).SingleOrDefault(); + var cxxBaseSpecifier = _cxxRecordDeclContext.Bases.Where((baseSpecifier) => baseSpecifier.Referenced == parent).SingleOrDefault(); if (cxxBaseSpecifier is not null) { @@ -1739,9 +1765,12 @@ private void VisitMemberExpr(MemberExpr memberExpr) } else if (memberExpr.MemberDecl is FieldDecl fieldDecl) { - if ((_cxxRecordDeclContext is not null) && (_cxxRecordDeclContext != fieldDecl.Parent)) + var parent = fieldDecl.Parent; + Debug.Assert(parent is not null); + + if ((_cxxRecordDeclContext is not null) && (_cxxRecordDeclContext != parent)) { - var cxxBaseSpecifier = _cxxRecordDeclContext.Bases.Where((baseSpecifier) => baseSpecifier.Referenced == fieldDecl.Parent).SingleOrDefault(); + var cxxBaseSpecifier = _cxxRecordDeclContext.Bases.Where((baseSpecifier) => baseSpecifier.Referenced == parent).SingleOrDefault(); if (cxxBaseSpecifier is not null) { @@ -2561,9 +2590,9 @@ private void VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr unaryExprOrT } else { - if (_topLevelClassNames.Contains(_outputBuilder.Name)) + if (_topLevelClassNames.Contains(outputBuilder.Name)) { - _topLevelClassIsUnsafe[_outputBuilder.Name] = true; + _topLevelClassIsUnsafe[outputBuilder.Name] = true; } var parentType = null as Type; @@ -2636,7 +2665,7 @@ private void VisitUnaryExprOrTypeTraitExpr(UnaryExprOrTypeTraitExpr unaryExprOrT var needsCast = false; var typeName = GetRemappedTypeName(unaryExprOrTypeTraitExpr, context: null, argumentType, out _); - if (parentType != null) + if (parentType is not null) { if ((parentType.Handle.SizeOf == 8) && IsPrevContextDecl(out var varDecl, out _)) { @@ -2821,13 +2850,16 @@ private void VisitUnresolvedLookupExpr(UnresolvedLookupExpr unresolvedLookupExpr private void VisitUnresolvedMemberExpr(UnresolvedMemberExpr unresolvedMemberExpr) { var outputBuilder = StartCSharpCode(); + if (!unresolvedMemberExpr.IsImplicitAccess) { - Visit(unresolvedMemberExpr.Base); + var @base = unresolvedMemberExpr.Base; + Debug.Assert(@base is not null); + Visit(@base); - var type = unresolvedMemberExpr.Base is CXXThisExpr + var type = @base is CXXThisExpr ? null - : unresolvedMemberExpr.Base is DeclRefExpr declRefExpr ? declRefExpr.Decl.Type.CanonicalType : unresolvedMemberExpr.Base.Type.CanonicalType; + : @base is DeclRefExpr declRefExpr ? declRefExpr.Decl.Type.CanonicalType : @base.Type.CanonicalType; if (type is not null and (PointerType or ReferenceType)) { diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs index 0aae6f8b..1a457afb 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs @@ -3,9 +3,9 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; -using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Text.RegularExpressions; @@ -22,8 +22,8 @@ public sealed partial class PInvokeGenerator : IDisposable private static readonly Encoding s_defaultStreamWriterEncoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); private static readonly Regex s_needsSystemSupportRegex = new Regex(@"\b(?:Guid|IntPtr|UIntPtr)\b", RegexOptions.Compiled); - private const string ExpectedClangVersion = "version 14.0"; - private const string ExpectedClangSharpVersion = "version 14.0"; + private const string ExpectedClangVersion = "version 15.0"; + private const string ExpectedClangSharpVersion = "version 15.0"; private readonly CXIndex _index; private readonly OutputBuilderFactory _outputBuilderFactory; @@ -31,13 +31,13 @@ public sealed partial class PInvokeGenerator : IDisposable private readonly StringBuilder _fileContentsBuilder; private readonly HashSet _visitedFiles; private readonly List _diagnostics; - private readonly LinkedList<(Cursor Cursor, object UserData)> _context; + private readonly LinkedList<(Cursor Cursor, object? UserData)> _context; private readonly Dictionary _uuidsToGenerate; private readonly HashSet _generatedUuids; private readonly PInvokeGeneratorConfiguration _config; private readonly Dictionary _cursorNames; private readonly Dictionary<(NamedDecl namedDecl, bool truncateForFunctionParameters), string> _cursorQualifiedNames; - private readonly Dictionary<(Cursor cursor, Cursor context, Type type), (string typeName, string nativeTypeName)> _typeNames; + private readonly Dictionary<(Cursor? cursor, Cursor? context, Type type), (string typeName, string nativeTypeName)> _typeNames; private readonly Dictionary> _allValidNameRemappings; private readonly Dictionary> _traversedValidNameRemappings; private readonly Dictionary _overloadIndices; @@ -52,20 +52,20 @@ public sealed partial class PInvokeGenerator : IDisposable private string _filePath; private string[] _clangCommandLineArgs; private CXTranslationUnit_Flags _translationFlags; - private string _currentClass; - private string _currentNamespace; + private string? _currentClass; + private string? _currentNamespace; - private IOutputBuilder _outputBuilder; - private CSharpOutputBuilder _testOutputBuilder; - private CSharpOutputBuilder _stmtOutputBuilder; - private CSharpOutputBuilder _testStmtOutputBuilder; + private IOutputBuilder? _outputBuilder; + private CSharpOutputBuilder? _testOutputBuilder; + private CSharpOutputBuilder? _stmtOutputBuilder; + private CSharpOutputBuilder? _testStmtOutputBuilder; private int _stmtOutputBuilderUsers; private int _testStmtOutputBuilderUsers; private int _outputBuilderUsers; - private CXXRecordDecl _cxxRecordDeclContext; + private CXXRecordDecl? _cxxRecordDeclContext; private bool _disposed; - public PInvokeGenerator(PInvokeGeneratorConfiguration config, Func outputStreamFactory = null) + public PInvokeGenerator(PInvokeGeneratorConfiguration config, Func? outputStreamFactory = null) { if (config is null) { @@ -89,20 +89,20 @@ public PInvokeGenerator(PInvokeGeneratorConfiguration config, Func { - var directoryPath = Path.GetDirectoryName(path); + var directoryPath = Path.GetDirectoryName(path) ?? ""; _ = Directory.CreateDirectory(directoryPath); return new FileStream(path, FileMode.Create); }); _fileContentsBuilder = new StringBuilder(); _visitedFiles = new HashSet(); _diagnostics = new List(); - _context = new LinkedList<(Cursor, object)>(); + _context = new LinkedList<(Cursor, object?)>(); _config = config; _uuidsToGenerate = new Dictionary(); _generatedUuids = new HashSet(); _cursorNames = new Dictionary(); _cursorQualifiedNames = new Dictionary<(NamedDecl, bool), string>(); - _typeNames = new Dictionary<(Cursor, Cursor, Type), (string, string)>(); + _typeNames = new Dictionary<(Cursor?, Cursor?, Type), (string, string)>(); _allValidNameRemappings = new Dictionary>() { ["intptr_t"] = new HashSet() { "IntPtr", "nint" }, ["ptrdiff_t"] = new HashSet() { "IntPtr", "nint" }, @@ -119,6 +119,8 @@ public PInvokeGenerator(PInvokeGeneratorConfiguration config, Func>(); _topLevelClassUsings = new Dictionary>(); _usedRemappings = new HashSet(); + _filePath = ""; + _clangCommandLineArgs = Array.Empty(); } ~PInvokeGenerator() @@ -128,7 +130,15 @@ public PInvokeGenerator(PInvokeGeneratorConfiguration config, Func _config; - public (Cursor Cursor, object UserData) CurrentContext => _context.Last.Value; + public (Cursor Cursor, object? UserData) CurrentContext + { + get + { + var currentContext = _context.Last; + Debug.Assert(currentContext is not null); + return currentContext.Value; + } + } public IReadOnlyList Diagnostics => _diagnostics; @@ -136,11 +146,24 @@ public PInvokeGenerator(PInvokeGeneratorConfiguration config, Func _index; - public (Cursor Cursor, object UserData) PreviousContext => _context.Last.Previous.Value; + public (Cursor Cursor, object? UserData) PreviousContext + { + get + { + var previousContext = _context.Last; + Debug.Assert(previousContext is not null); + + previousContext = previousContext.Previous; + Debug.Assert(previousContext is not null); + + return previousContext.Value; + } + } public void Close() { - Stream stream = null; + Stream? stream = null; + var methodClassOutputBuilders = new Dictionary(); var methodClassTestOutputBuilders = new Dictionary(); var emitNamespaceDeclaration = true; @@ -156,7 +179,10 @@ public void Close() } StartUsingOutputBuilder(GetClass(iidName)); + + Debug.Assert(_outputBuilder is not null); _outputBuilder.WriteIid(iidName, foundUuid.Value); + StopUsingOutputBuilder(); } @@ -264,6 +290,7 @@ public void Close() continue; } + Debug.Assert(stream is not null); CloseOutputBuilder(stream, outputBuilder, isMethodClass, leaveStreamOpen, emitNamespaceDeclaration); emitNamespaceDeclaration = false; } @@ -281,6 +308,8 @@ public void Close() if (leaveStreamOpen && _outputBuilderFactory.OutputBuilders.Any()) { + Debug.Assert(stream is not null); + foreach (var entry in methodClassOutputBuilders) { var hasGuidMember = _config.GenerateGuidMember && _config.GeneratePreviewCode; @@ -1406,7 +1435,7 @@ private void AddDiagnostic(DiagnosticLevel level, string message) _diagnostics.Add(diagnostic); } - private void AddDiagnostic(DiagnosticLevel level, string message, Cursor cursor) + private void AddDiagnostic(DiagnosticLevel level, string message, Cursor? cursor) { var diagnostic = new Diagnostic(level, message, (cursor?.Location).GetValueOrDefault()); @@ -1969,7 +1998,7 @@ private Type[] GetBitfieldCount(RecordDecl recordDecl) return types.ToArray(); } - private CallingConvention GetCallingConvention(Cursor cursor, Cursor context, Type type) + private CallingConvention GetCallingConvention(Cursor? cursor, Cursor? context, Type type) { if (cursor is FunctionDecl functionDecl) { @@ -1995,7 +2024,7 @@ private CallingConvention GetCallingConvention(Cursor cursor, Cursor context, Ty return GetCallingConvention(cursor, context, type, ref wasRemapped); } - private CallingConvention GetCallingConvention(Cursor cursor, Cursor context, Type type, ref bool wasRemapped) + private CallingConvention GetCallingConvention(Cursor? cursor, Cursor? context, Type type, ref bool wasRemapped) { var remappedName = GetRemappedTypeName(cursor, context, type, out _, ignoreTransparentStructsWhereRequired: false, skipUsing: true); @@ -2129,7 +2158,9 @@ private string GetCursorName(NamedDecl namedDecl) if (namedDecl is CXXConstructorDecl cxxConstructorDecl) { - name = GetCursorName(cxxConstructorDecl.Parent); + var parent = cxxConstructorDecl.Parent; + Debug.Assert(parent is not null); + name = GetCursorName(parent); } else if (namedDecl is CXXDestructorDecl) { @@ -2169,7 +2200,7 @@ private string GetCursorQualifiedName(NamedDecl namedDecl, bool truncateParamete if (!_cursorQualifiedNames.TryGetValue((namedDecl, truncateParameters), out var qualifiedName)) { var parts = new Stack(); - Decl decl = namedDecl; + Decl? decl = namedDecl; do { @@ -2178,11 +2209,18 @@ private string GetCursorQualifiedName(NamedDecl namedDecl, bool truncateParamete parts.Push(parentNamedDecl); } - decl = (decl.DeclContext is null) && (decl is CXXMethodDecl cxxMethodDecl) - ? cxxMethodDecl.ThisObjectType.AsCXXRecordDecl - : (Decl)decl.DeclContext; + if ((decl.DeclContext is null) && (decl is CXXMethodDecl cxxMethodDecl)) + { + var cxxRecordDecl = cxxMethodDecl.ThisObjectType.AsCXXRecordDecl; + Debug.Assert(cxxRecordDecl is not null); + decl = cxxRecordDecl; + } + else + { + decl = (Decl?)decl.DeclContext; + } } - while (decl != null); + while (decl is not null); var qualifiedNameBuilder = new StringBuilder(); @@ -2361,7 +2399,10 @@ private uint GetOverloadIndex(CXXMethodDecl cxxMethodDeclToMatch) { if (!_overloadIndices.TryGetValue(cxxMethodDeclToMatch, out var index)) { - index = GetOverloadIndex(cxxMethodDeclToMatch, cxxMethodDeclToMatch.Parent, baseIndex: 0); + var parent = cxxMethodDeclToMatch.Parent; + Debug.Assert(parent is not null); + + index = GetOverloadIndex(cxxMethodDeclToMatch, parent, baseIndex: 0); _overloadIndices.Add(cxxMethodDeclToMatch, index); } return index; @@ -2480,7 +2521,9 @@ private string GetRemappedCursorName(NamedDecl namedDecl, out string nativeTypeN if (namedDecl is CXXConstructorDecl cxxConstructorDecl) { - remappedName = GetRemappedCursorName(cxxConstructorDecl.Parent); + var parent = cxxConstructorDecl.Parent; + Debug.Assert(parent is not null); + remappedName = GetRemappedCursorName(parent); } else if (namedDecl is FieldDecl fieldDecl) { @@ -2488,9 +2531,12 @@ private string GetRemappedCursorName(NamedDecl namedDecl, out string nativeTypeN { remappedName = "Anonymous"; - if (fieldDecl.Parent.AnonymousFields.Count > 1) + var parent = fieldDecl.Parent; + Debug.Assert(parent is not null); + + if (parent.AnonymousFields.Count > 1) { - var index = fieldDecl.Parent.AnonymousFields.IndexOf(fieldDecl) + 1; + var index = parent.AnonymousFields.IndexOf(fieldDecl) + 1; remappedName += index.ToString(); } } @@ -2503,7 +2549,7 @@ private string GetRemappedCursorName(NamedDecl namedDecl, out string nativeTypeN var matchingField = parentRecordDecl.Fields.Where((fieldDecl) => fieldDecl.Type.CanonicalType == recordDecl.TypeForDecl.CanonicalType).FirstOrDefault(); - if (matchingField != null) + if (matchingField is not null) { remappedName = "_"; remappedName += GetRemappedCursorName(matchingField); @@ -2521,12 +2567,12 @@ private string GetRemappedCursorName(NamedDecl namedDecl, out string nativeTypeN return remappedName; } - private string GetRemappedName(string name, Cursor cursor, bool tryRemapOperatorName, out bool wasRemapped, bool skipUsing = false) + private string GetRemappedName(string name, Cursor? cursor, bool tryRemapOperatorName, out bool wasRemapped, bool skipUsing = false) { return GetRemappedName(name, cursor, tryRemapOperatorName, out wasRemapped, skipUsing, skipUsingIfNotRemapped: skipUsing); } - private string GetRemappedName(string name, Cursor cursor, bool tryRemapOperatorName, out bool wasRemapped, bool skipUsing, bool skipUsingIfNotRemapped) + private string GetRemappedName(string name, Cursor? cursor, bool tryRemapOperatorName, out bool wasRemapped, bool skipUsing, bool skipUsingIfNotRemapped) { if (_config.RemappedNames.TryGetValue(name, out var remappedName)) { @@ -2559,6 +2605,7 @@ private string GetRemappedName(string name, Cursor cursor, bool tryRemapOperator if ((cursor is CXXBaseSpecifier cxxBaseSpecifier) && remappedName.StartsWith("__AnonymousBase_")) { + Debug.Assert(_cxxRecordDeclContext is not null); remappedName = "Base"; if (_cxxRecordDeclContext.Bases.Count > 1) @@ -2574,7 +2621,7 @@ private string GetRemappedName(string name, Cursor cursor, bool tryRemapOperator wasRemapped = false; return AddUsingDirectiveIfNeeded(_outputBuilder, remappedName, skipUsingIfNotRemapped); - string AddUsingDirectiveIfNeeded(IOutputBuilder outputBuilder, string remappedName, bool skipUsing) + string AddUsingDirectiveIfNeeded(IOutputBuilder? outputBuilder, string remappedName, bool skipUsing) { if (!skipUsing) { @@ -2608,7 +2655,7 @@ string AddUsingDirectiveIfNeeded(IOutputBuilder outputBuilder, string remappedNa } } - private string GetRemappedTypeName(Cursor cursor, Cursor context, Type type, out string nativeTypeName, bool skipUsing = false, bool ignoreTransparentStructsWhereRequired = false) + private string GetRemappedTypeName(Cursor? cursor, Cursor? context, Type type, out string nativeTypeName, bool skipUsing = false, bool ignoreTransparentStructsWhereRequired = false) { var name = GetTypeName(cursor, context, type, ignoreTransparentStructsWhereRequired, out nativeTypeName); @@ -2658,7 +2705,7 @@ private string GetRemappedTypeName(Cursor cursor, Cursor context, Type type, out { var matchingField = parentRecordDecl.Fields.Where((fieldDecl) => fieldDecl.Type.CanonicalType == recordType).FirstOrDefault(); - if (matchingField != null) + if (matchingField is not null) { remappedName = "_"; remappedName += GetRemappedCursorName(matchingField); @@ -2810,10 +2857,10 @@ private string GetTargetTypeName(Cursor cursor, out string nativeTypeName) return targetTypeName; } - private string GetTypeName(Cursor cursor, Cursor context, Type type, bool ignoreTransparentStructsWhereRequired, out string nativeTypeName) + private string GetTypeName(Cursor? cursor, Cursor? context, Type type, bool ignoreTransparentStructsWhereRequired, out string nativeTypeName) => GetTypeName(cursor, context, type, type, ignoreTransparentStructsWhereRequired, out nativeTypeName); - private string GetTypeName(Cursor cursor, Cursor context, Type rootType, Type type, bool ignoreTransparentStructsWhereRequired, out string nativeTypeName) + private string GetTypeName(Cursor? cursor, Cursor? context, Type rootType, Type type, bool ignoreTransparentStructsWhereRequired, out string nativeTypeName) { if (!_typeNames.TryGetValue((cursor, context, type), out var result)) { @@ -3099,7 +3146,7 @@ private string GetTypeName(Cursor cursor, Cursor context, Type rootType, Type ty _outputBuilder = new CSharpOutputBuilder("ClangSharp_TemplateSpecializationType_AsExpr", _config); Visit(arg.AsExpr); - typeName = _outputBuilder.ToString(); + typeName = _outputBuilder.ToString() ?? ""; _outputBuilder = oldOutputBuilder; break; @@ -3123,7 +3170,7 @@ private string GetTypeName(Cursor cursor, Cursor context, Type rootType, Type ty { // Pointers are not yet supported as generic arguments; remap to IntPtr typeName = "IntPtr"; - _outputBuilder.EmitSystemSupport(); + _outputBuilder?.EmitSystemSupport(); } _ = nameBuilder.Append(typeName); @@ -3182,7 +3229,7 @@ private string GetTypeName(Cursor cursor, Cursor context, Type rootType, Type ty return result.typeName; } - private string GetTypeNameForPointeeType(Cursor cursor, Cursor context, Type rootType, Type pointeeType, bool ignoreTransparentStructsWhereRequired, out string nativePointeeTypeName) + private string GetTypeNameForPointeeType(Cursor? cursor, Cursor? context, Type rootType, Type pointeeType, bool ignoreTransparentStructsWhereRequired, out string nativePointeeTypeName) { var name = pointeeType.AsString; nativePointeeTypeName = name; @@ -3265,9 +3312,10 @@ private string GetTypeNameForPointeeType(Cursor cursor, Cursor context, Type roo if (isMacroDefinitionRecord) { + Debug.Assert(cursor is not null); varDecl = (VarDecl)cursor; - if (IsStmtAsWritten(varDecl.Init, out DeclRefExpr declRefExpr, removeParens: true) && (declRefExpr.Decl is FunctionDecl functionDecl)) + if (IsStmtAsWritten(varDecl.Init, out var declRefExpr, removeParens: true) && (declRefExpr.Decl is FunctionDecl functionDecl)) { cursor = functionDecl; paramTypes = functionDecl.Parameters.Select((param) => param.Type); @@ -3811,7 +3859,7 @@ private void GetTypeSize(Cursor cursor, Type type, ref long alignment32, ref lon } } - private bool HasSuppressGCTransition(Cursor cursor) + private bool HasSuppressGCTransition(Cursor? cursor) { if (cursor is not NamedDecl namedDecl) { @@ -4080,9 +4128,15 @@ bool IsExcludedByName(Cursor cursor, ref uint isExcludedValue) { isExcludedByConfigOption = true; } - else if ((functionDecl is CXXMethodDecl cxxMethodDecl) && IsConflictingMethodDecl(cxxMethodDecl, cxxMethodDecl.Parent)) + else if (functionDecl is CXXMethodDecl cxxMethodDecl) { - isExcludedValue |= 0b10; + var parent = cxxMethodDecl.Parent; + Debug.Assert(parent is not null); + + if (IsConflictingMethodDecl(cxxMethodDecl, parent)) + { + isExcludedValue |= 0b10; + } } } @@ -4205,7 +4259,7 @@ bool IsComProxy(FunctionDecl functionDecl, string name) parmVarDecl = functionDecl.Parameters.FirstOrDefault(); } - if ((parmVarDecl != null) && (parmVarDecl.Type is PointerType pointerType)) + if ((parmVarDecl is not null) && (parmVarDecl.Type is PointerType pointerType)) { var typeName = GetTypeName(parmVarDecl, context: null, pointerType.PointeeType, ignoreTransparentStructsWhereRequired: false, out var nativeTypeName); return name.StartsWith($"{nativeTypeName}_") || name.StartsWith($"{typeName}_") || (typeName == "IRpcStubBuffer"); @@ -4475,15 +4529,18 @@ private bool IsNativeTypeNameEquivalent(string nativeTypeName, string typeName) return false; } - private bool IsPrevContextDecl(out T cursor, out object userData) + private bool IsPrevContextDecl([MaybeNullWhen(false)] out T cursor, out object? userData) where T : Decl { - var previousContext = _context.Last.Previous; + var previousContext = _context.Last; + Debug.Assert(previousContext != null); - while (previousContext.Value.Cursor is not Decl) + do { previousContext = previousContext.Previous; + Debug.Assert(previousContext != null); } + while (previousContext.Value.Cursor is not Decl); var value = previousContext.Value; @@ -4501,15 +4558,18 @@ private bool IsPrevContextDecl(out T cursor, out object userData) } } - private bool IsPrevContextStmt(out T cursor, out object userData, bool preserveParen = false, bool preserveImplicitCast = false) + private bool IsPrevContextStmt([MaybeNullWhen(false)] out T cursor, out object? userData, bool preserveParen = false, bool preserveImplicitCast = false) where T : Stmt { - var previousContext = _context.Last.Previous; + var previousContext = _context.Last; + Debug.Assert(previousContext != null); - while ((!preserveParen && (previousContext.Value.Cursor is ParenExpr)) || (!preserveImplicitCast && (previousContext.Value.Cursor is ImplicitCastExpr))) + do { previousContext = previousContext.Previous; + Debug.Assert(previousContext is not null); } + while ((!preserveParen && (previousContext.Value.Cursor is ParenExpr)) || (!preserveImplicitCast && (previousContext.Value.Cursor is ImplicitCastExpr))); var value = previousContext.Value; @@ -4527,7 +4587,7 @@ private bool IsPrevContextStmt(out T cursor, out object userData, bool preser } } - private static bool IsStmtAsWritten(Cursor cursor, out T value, bool removeParens = false) + private static bool IsStmtAsWritten(Cursor cursor, [MaybeNullWhen(false)] out T value, bool removeParens = false) where T : Stmt { if (cursor is Expr expr) @@ -5374,6 +5434,8 @@ private void ParenthesizeStmt(Stmt stmt) { if (_stmtOutputBuilderUsers > 0) { + Debug.Assert(_stmtOutputBuilder is not null); + _stmtOutputBuilder.Write('('); _stmtOutputBuilder.BeginMarker("value"); Visit(stmt); @@ -5382,6 +5444,8 @@ private void ParenthesizeStmt(Stmt stmt) } else { + Debug.Assert(_outputBuilder is not null); + _outputBuilder.BeginInnerValue(); Visit(stmt); _outputBuilder.EndInnerValue(); @@ -5427,6 +5491,8 @@ private void StartUsingOutputBuilder(string name, bool includeTestOutput = false _testOutputBuilder = (CSharpOutputBuilder)testOutputBuilder; } } + + Debug.Assert(_testOutputBuilder is not null); _testOutputBuilder.NeedsNewline = true; } return; @@ -5458,7 +5524,7 @@ private void StartUsingOutputBuilder(string name, bool includeTestOutput = false _testOutputBuilder = (CSharpOutputBuilder)testOutputBuilder; } - Debug.Assert(_testOutputBuilder.IsTestOutput); + Debug.Assert(_testOutputBuilder is not null); _testOutputBuilder.NeedsNewline = true; } } @@ -5679,6 +5745,8 @@ private bool TryRemapOperatorName(ref string name, FunctionDecl functionDecl) private void UncheckStmt(string targetTypeName, Stmt stmt) { + Debug.Assert(_outputBuilder is not null); + if (!_outputBuilder.IsUncheckedContext && IsUnchecked(targetTypeName, stmt)) { _outputBuilder.BeginUnchecked(); @@ -5792,6 +5860,7 @@ private void Visit(IEnumerable cursors) private void WithAttributes(NamedDecl namedDecl, bool onlySupportedOSPlatform = false, bool isTestOutput = false) { var outputBuilder = isTestOutput ? _testOutputBuilder : _outputBuilder; + Debug.Assert(outputBuilder is not null); if (TryGetRemappedValue(namedDecl, _config.WithAttributes, out var attributes)) { @@ -5873,7 +5942,7 @@ private string GetClass(string remappedName, bool disallowPrefixMatch = false) return className; } - private bool TryGetClass(string remappedName, out string className, bool disallowPrefixMatch = false) + private bool TryGetClass(string remappedName, [MaybeNullWhen(false)] out string className, bool disallowPrefixMatch = false) { var index = remappedName.IndexOf('*'); @@ -5914,7 +5983,7 @@ private bool TryGetClass(string remappedName, out string className, bool disallo return false; } - private string GetNamespace(string remappedName, NamedDecl namedDecl = null) + private string GetNamespace(string remappedName, NamedDecl? namedDecl = null) { if (!TryGetNamespace(remappedName, out var namespaceName)) { @@ -5935,7 +6004,7 @@ private string GetNamespace(string remappedName, NamedDecl namedDecl = null) return namespaceName; } - private bool TryGetNamespace(string remappedName, out string namespaceName) + private bool TryGetNamespace(string remappedName, [MaybeNullWhen(false)] out string namespaceName) { var index = remappedName.IndexOf('*'); @@ -6009,7 +6078,7 @@ private bool HasRemapping(NamedDecl namedDecl, IReadOnlyCollection entri return false; } - private bool TryGetRemappedValue(NamedDecl namedDecl, IReadOnlyDictionary remappings, out T value, bool matchStar = false) + private bool TryGetRemappedValue(NamedDecl namedDecl, IReadOnlyDictionary remappings, [MaybeNullWhen(false)] out T value, bool matchStar = false) { var name = GetCursorQualifiedName(namedDecl); @@ -6074,10 +6143,12 @@ private void WithTestAttribute() { if (_config.GenerateTestsNUnit) { + Debug.Assert(_testOutputBuilder is not null); _testOutputBuilder.WriteIndentedLine("[Test]"); } else if (_config.GenerateTestsXUnit) { + Debug.Assert(_testOutputBuilder is not null); _testOutputBuilder.WriteIndentedLine("[Fact]"); } } @@ -6086,6 +6157,8 @@ private void WithTestAssertEqual(string expected, string actual) { if (_config.GenerateTestsNUnit) { + Debug.Assert(_testOutputBuilder is not null); + _testOutputBuilder.WriteIndented("Assert.That"); _testOutputBuilder.Write('('); _testOutputBuilder.Write(actual); @@ -6097,6 +6170,8 @@ private void WithTestAssertEqual(string expected, string actual) } else if (_config.GenerateTestsXUnit) { + Debug.Assert(_testOutputBuilder is not null); + _testOutputBuilder.WriteIndented("Assert.Equal"); _testOutputBuilder.Write('('); _testOutputBuilder.Write(expected); @@ -6112,6 +6187,8 @@ private void WithTestAssertTrue(string actual) { if (_config.GenerateTestsNUnit) { + Debug.Assert(_testOutputBuilder is not null); + _testOutputBuilder.WriteIndented("Assert.That"); _testOutputBuilder.Write('('); _testOutputBuilder.Write(actual); @@ -6121,6 +6198,8 @@ private void WithTestAssertTrue(string actual) } else if (_config.GenerateTestsXUnit) { + Debug.Assert(_testOutputBuilder is not null); + _testOutputBuilder.WriteIndented("Assert.True"); _testOutputBuilder.Write('('); _testOutputBuilder.Write(actual); @@ -6150,6 +6229,8 @@ private void WithType(NamedDecl namedDecl, ref string integerTypeName, ref strin private void WithUsings(NamedDecl namedDecl) { + Debug.Assert(_outputBuilder is not null); + if (TryGetRemappedValue(namedDecl, _config.WithUsings, out var usings)) { foreach (var @using in usings) @@ -6172,6 +6253,7 @@ private CSharpOutputBuilder StartCSharpCode() if (_stmtOutputBuilder is null) { + Debug.Assert(_outputBuilder is not null); _stmtOutputBuilder = _outputBuilder.BeginCSharpCode(); _stmtOutputBuilderUsers = 1; } @@ -6188,6 +6270,9 @@ private void StopCSharpCode() _stmtOutputBuilderUsers--; if (_stmtOutputBuilderUsers <= 0) { + Debug.Assert(_outputBuilder is not null); + Debug.Assert(_stmtOutputBuilder is not null); + _outputBuilder.EndCSharpCode(_stmtOutputBuilder); if (_testStmtOutputBuilder is not null) diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGeneratorConfiguration.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGeneratorConfiguration.cs index 1766eecb..4c088851 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGeneratorConfiguration.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGeneratorConfiguration.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; using ClangSharp.Abstractions; @@ -46,7 +47,7 @@ public sealed class PInvokeGeneratorConfiguration private PInvokeGeneratorConfigurationOptions _options; - public PInvokeGeneratorConfiguration(string defaultNamespace, string outputLocation, string headerFile, PInvokeGeneratorOutputMode outputMode, PInvokeGeneratorConfigurationOptions options) + public PInvokeGeneratorConfiguration(string defaultNamespace, string outputLocation, string? headerFile, PInvokeGeneratorOutputMode outputMode, PInvokeGeneratorConfigurationOptions options) { if (string.IsNullOrWhiteSpace(defaultNamespace)) { @@ -122,6 +123,7 @@ public PInvokeGeneratorConfiguration(string defaultNamespace, string outputLocat } } + [AllowNull] public string DefaultClass { get @@ -167,6 +169,7 @@ public bool ExcludeFnptrCodegen public bool ExcludeFunctionsWithBody => _options.HasFlag(PInvokeGeneratorConfigurationOptions.ExcludeFunctionsWithBody); + [AllowNull] public IReadOnlyCollection ExcludedNames { get @@ -228,6 +231,7 @@ public IReadOnlyCollection ExcludedNames public string HeaderText => _headerText; + [AllowNull] public IReadOnlyCollection IncludedNames { get @@ -241,6 +245,7 @@ public IReadOnlyCollection IncludedNames } } + [AllowNull] public string LibraryPath { get @@ -260,6 +265,7 @@ public string LibraryPath public bool LogVisitedFiles => _options.HasFlag(PInvokeGeneratorConfigurationOptions.LogVisitedFiles); + [AllowNull] public string MethodPrefixToStrip { get @@ -279,6 +285,7 @@ public string MethodPrefixToStrip public string OutputLocation => _outputLocation; + [AllowNull] public IReadOnlyDictionary RemappedNames { get @@ -295,6 +302,7 @@ public IReadOnlyDictionary RemappedNames public IReadOnlyCollection ForceRemappedNames => _forceRemappedNames; + [AllowNull] public string TestOutputLocation { get @@ -308,6 +316,7 @@ public string TestOutputLocation } } + [AllowNull] public IReadOnlyCollection TraversalNames { get @@ -321,6 +330,7 @@ public IReadOnlyCollection TraversalNames } } + [AllowNull] public IReadOnlyDictionary WithAccessSpecifiers { get @@ -334,6 +344,7 @@ public IReadOnlyDictionary WithAccessSpecifiers } } + [AllowNull] public IReadOnlyDictionary> WithAttributes { get @@ -347,6 +358,7 @@ public IReadOnlyDictionary> WithAttributes } } + [AllowNull] public IReadOnlyDictionary WithCallConvs { get @@ -360,6 +372,7 @@ public IReadOnlyDictionary WithCallConvs } } + [AllowNull] public IReadOnlyDictionary WithClasses { get @@ -373,6 +386,7 @@ public IReadOnlyDictionary WithClasses } } + [AllowNull] public IReadOnlyDictionary WithGuids { get @@ -386,6 +400,7 @@ public IReadOnlyDictionary WithGuids } } + [AllowNull] public IReadOnlyDictionary WithLibraryPaths { get @@ -399,6 +414,7 @@ public IReadOnlyDictionary WithLibraryPaths } } + [AllowNull] public IReadOnlyCollection WithManualImports { get @@ -412,6 +428,7 @@ public IReadOnlyCollection WithManualImports } } + [AllowNull] public IReadOnlyDictionary WithNamespaces { get @@ -425,6 +442,7 @@ public IReadOnlyDictionary WithNamespaces } } + [AllowNull] public IReadOnlyCollection WithSetLastErrors { get @@ -438,6 +456,7 @@ public IReadOnlyCollection WithSetLastErrors } } + [AllowNull] public IReadOnlyCollection WithSuppressGCTransitions { get @@ -451,6 +470,7 @@ public IReadOnlyCollection WithSuppressGCTransitions } } + [AllowNull] public IReadOnlyDictionary WithTransparentStructs { get @@ -464,6 +484,7 @@ public IReadOnlyCollection WithSuppressGCTransitions } } + [AllowNull] public IReadOnlyDictionary WithTypes { get @@ -477,6 +498,7 @@ public IReadOnlyDictionary WithTypes } } + [AllowNull] public IReadOnlyDictionary> WithUsings { get @@ -522,7 +544,7 @@ public static AccessSpecifier ConvertStringToAccessSpecifier(string input) } } - private static void AddRange(SortedDictionary dictionary, IEnumerable> keyValuePairs) + private static void AddRange(SortedDictionary dictionary, IEnumerable>? keyValuePairs) { if (keyValuePairs != null) { @@ -535,7 +557,7 @@ private static void AddRange(SortedDictionary dictionary } } - private static void AddRange(SortedDictionary dictionary, IEnumerable> keyValuePairs, Func convert) + private static void AddRange(SortedDictionary dictionary, IEnumerable>? keyValuePairs, Func convert) { if (keyValuePairs != null) { @@ -548,7 +570,7 @@ private static void AddRange(SortedDictionary di } } - private static void AddRange(SortedSet hashSet, IEnumerable keys) + private static void AddRange(SortedSet hashSet, IEnumerable? keys) { if (keys != null) { @@ -559,7 +581,7 @@ private static void AddRange(SortedSet hashSet, IEnumerable(SortedSet hashSet, IEnumerable keys, Func convert) + private static void AddRange(SortedSet hashSet, IEnumerable? keys, Func convert) { if (keys != null) { @@ -570,7 +592,7 @@ private static void AddRange(SortedSet hashSet, IEnumera } } - private static void AddRange(SortedSet hashSet, IEnumerable> keyValuePairs, Func shouldAdd) + private static void AddRange(SortedSet hashSet, IEnumerable>? keyValuePairs, Func shouldAdd) { if (keyValuePairs != null) { diff --git a/sources/ClangSharp.PInvokeGenerator/XML/XmlOutputBuilder.Visit.cs b/sources/ClangSharp.PInvokeGenerator/XML/XmlOutputBuilder.Visit.cs index 7f51c35e..a0b9883f 100644 --- a/sources/ClangSharp.PInvokeGenerator/XML/XmlOutputBuilder.Visit.cs +++ b/sources/ClangSharp.PInvokeGenerator/XML/XmlOutputBuilder.Visit.cs @@ -6,7 +6,7 @@ namespace ClangSharp.XML; internal partial class XmlOutputBuilder { - public void WriteCustomAttribute(string attribute, Action callback = null) + public void WriteCustomAttribute(string attribute, Action? callback = null) { _ = _sb.Append($"{attribute}"); callback?.Invoke(); diff --git a/sources/ClangSharp.PInvokeGenerator/XML/XmlOutputBuilder.VisitDecl.cs b/sources/ClangSharp.PInvokeGenerator/XML/XmlOutputBuilder.VisitDecl.cs index a79a2f43..b37ff1bb 100644 --- a/sources/ClangSharp.PInvokeGenerator/XML/XmlOutputBuilder.VisitDecl.cs +++ b/sources/ClangSharp.PInvokeGenerator/XML/XmlOutputBuilder.VisitDecl.cs @@ -313,7 +313,7 @@ public void BeginStruct(in StructDesc info) _ = _sb.Append('>'); info.WriteCustomAttrs?.Invoke(info.CustomAttrGeneratorData); } - public void BeginMarkerInterface(string[] baseTypeNames) => _sb.Append(""); + public void BeginMarkerInterface(string[]? baseTypeNames) => _sb.Append(""); public void EndMarkerInterface() => _sb.Append(""); public void BeginExplicitVtbl() => _sb.Append(""); public void EndExplicitVtbl() => _sb.Append(""); diff --git a/sources/ClangSharp/Cursors/Cursor.cs b/sources/ClangSharp/Cursors/Cursor.cs index d007fad6..b2fb5f3b 100644 --- a/sources/ClangSharp/Cursors/Cursor.cs +++ b/sources/ClangSharp/Cursors/Cursor.cs @@ -13,11 +13,11 @@ namespace ClangSharp; public unsafe class Cursor : IEquatable { private readonly Lazy _kindSpelling; - private readonly Lazy _lexicalParentCursor; - private readonly Lazy _semanticParentCursor; + private readonly Lazy _lexicalParentCursor; + private readonly Lazy _semanticParentCursor; private readonly Lazy _spelling; private readonly Lazy _translationUnit; - private List _cursorChildren; + private List? _cursorChildren; private protected Cursor(CXCursor handle, CXCursorKind expectedCursorKind) { @@ -28,8 +28,8 @@ private protected Cursor(CXCursor handle, CXCursorKind expectedCursorKind) Handle = handle; _kindSpelling = new Lazy(Handle.KindSpelling.ToString); - _lexicalParentCursor = new Lazy(() => TranslationUnit.GetOrCreate(Handle.LexicalParent)); - _semanticParentCursor = new Lazy(() => TranslationUnit.GetOrCreate(Handle.SemanticParent)); + _lexicalParentCursor = new Lazy(() => !Handle.LexicalParent.IsNull ? TranslationUnit.GetOrCreate(Handle.LexicalParent) : null); + _semanticParentCursor = new Lazy(() => !Handle.SemanticParent.IsNull ? TranslationUnit.GetOrCreate(Handle.SemanticParent) : null); _spelling = new Lazy(Handle.Spelling.ToString); _translationUnit = new Lazy(() => TranslationUnit.GetOrCreate(Handle.TranslationUnit)); } @@ -40,14 +40,14 @@ public IReadOnlyList CursorChildren { if (_cursorChildren is null) { - var cursorChildren = GCHandle.Alloc(new List()); + var cursorChildrenHandle = GCHandle.Alloc(new List()); var client_data = stackalloc nint[2] { - GCHandle.ToIntPtr(cursorChildren), + GCHandle.ToIntPtr(cursorChildrenHandle), TranslationUnit.Handle.Handle }; -#if NET5_0_OR_GREATER +#if NET6_0_OR_GREATER _ = clang.visitChildren(Handle, &Visitor, client_data); #else var visitor = (CXCursorVisitor)Visitor; @@ -57,23 +57,30 @@ public IReadOnlyList CursorChildren GC.KeepAlive(visitor); #endif - _cursorChildren = (List)cursorChildren.Target; - cursorChildren.Free(); + var cursorChildren = (List?)cursorChildrenHandle.Target; + Debug.Assert(cursorChildren is not null); -#if NET5_0_OR_GREATER + _cursorChildren = cursorChildren; + cursorChildrenHandle.Free(); + +#if NET6_0_OR_GREATER [UnmanagedCallersOnly(CallConvs = new System.Type[] { typeof(CallConvCdecl) })] #endif static CXChildVisitResult Visitor(CXCursor cursor, CXCursor parent, void* client_data) { - var cursorChildren = (List)GCHandle.FromIntPtr(((nint*)client_data)[0]).Target; - var translationUnit = TranslationUnit.GetOrCreate((CXTranslationUnitImpl*)((nint*)client_data)[1]); + var cursorChildren = (List?)GCHandle.FromIntPtr(((nint*)client_data)[0]).Target; + Debug.Assert(cursorChildren is not null); + var translationUnit = TranslationUnit.GetOrCreate((CXTranslationUnitImpl*)((nint*)client_data)[1]); var cursorChild = translationUnit.GetOrCreate(cursor); - cursorChildren.Add(cursorChild); + + cursorChildren!.Add(cursorChild); return CXChildVisitResult.CXChildVisit_Continue; } } - return _cursorChildren; + + Debug.Assert(_cursorChildren is not null); + return _cursorChildren!; } } @@ -85,19 +92,19 @@ static CXChildVisitResult Visitor(CXCursor cursor, CXCursor parent, void* client public CXCursor Handle { get; } - public Cursor LexicalParentCursor => _lexicalParentCursor.Value; + public Cursor? LexicalParentCursor => _lexicalParentCursor.Value; public CXSourceLocation Location => Handle.Location; - public Cursor SemanticParentCursor => _semanticParentCursor.Value; + public Cursor? SemanticParentCursor => _semanticParentCursor.Value; public string Spelling => _spelling.Value; public TranslationUnit TranslationUnit => _translationUnit.Value; - public static bool operator ==(Cursor left, Cursor right) => (left is not null) ? ((right is not null) && (left.Handle == right.Handle)) : (right is null); + public static bool operator ==(Cursor? left, Cursor? right) => (left is not null) ? ((right is not null) && (left.Handle == right.Handle)) : (right is null); - public static bool operator !=(Cursor left, Cursor right) => (left is not null) ? ((right is null) || (left.Handle != right.Handle)) : (right is not null); + public static bool operator !=(Cursor? left, Cursor? right) => (left is not null) ? ((right is null) || (left.Handle != right.Handle)) : (right is not null); internal static Cursor Create(CXCursor handle) { @@ -132,9 +139,9 @@ internal static Cursor Create(CXCursor handle) return result; } - public override bool Equals(object obj) => (obj is Cursor other) && Equals(other); + public override bool Equals(object? obj) => (obj is Cursor other) && Equals(other); - public bool Equals(Cursor other) => this == other; + public bool Equals(Cursor? other) => this == other; public override int GetHashCode() => Handle.GetHashCode(); diff --git a/sources/ClangSharp/Cursors/Decls/BlockDecl.cs b/sources/ClangSharp/Cursors/Decls/BlockDecl.cs index 43611e62..003425c0 100644 --- a/sources/ClangSharp/Cursors/Decls/BlockDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/BlockDecl.cs @@ -53,7 +53,7 @@ internal BlockDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Unexpos public bool CapturesCXXThis => Handle.CapturesCXXThis; - public CompoundStmt CompoundBody => (CompoundStmt)Body; + public CompoundStmt? CompoundBody => (CompoundStmt?)Body; public bool DoesNotEscape => Handle.DoesNotEscape; diff --git a/sources/ClangSharp/Cursors/Decls/CXXConstructorDecl.cs b/sources/ClangSharp/Cursors/Decls/CXXConstructorDecl.cs index e2695e73..f2f77159 100644 --- a/sources/ClangSharp/Cursors/Decls/CXXConstructorDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/CXXConstructorDecl.cs @@ -53,7 +53,7 @@ internal CXXConstructorDecl(CXCursor handle) : base(handle, CXCursorKind.CXCurso public uint NumCtorInitializers => unchecked((uint)Handle.NumExprs); - public CXXConstructorDecl TargetConstructor + public CXXConstructorDecl? TargetConstructor { get { @@ -64,7 +64,7 @@ public CXXConstructorDecl TargetConstructor var e = InitExprs.FirstOrDefault()?.IgnoreImplicit; - return e is CXXConstructExpr construct ? construct.Constructor : null; + return (e is CXXConstructExpr construct) ? construct.Constructor : null; } } } diff --git a/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs b/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs index 03fdd100..47b74dc0 100644 --- a/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using ClangSharp.Interop; @@ -51,7 +52,7 @@ private protected CXXMethodDecl(CXCursor handle, CXCursorKind expectedCursorKind public IReadOnlyList OverriddenMethods => _overriddenMethods.Value; - public new CXXRecordDecl Parent => (CXXRecordDecl)(base.Parent ?? ThisObjectType.AsCXXRecordDecl); + public new CXXRecordDecl? Parent => (CXXRecordDecl?)(base.Parent ?? ThisObjectType.AsCXXRecordDecl); public uint SizeOverriddenMethods => unchecked((uint)Handle.NumMethods); diff --git a/sources/ClangSharp/Cursors/Decls/CXXRecordDecl.cs b/sources/ClangSharp/Cursors/Decls/CXXRecordDecl.cs index 68301c5c..9ba0b581 100644 --- a/sources/ClangSharp/Cursors/Decls/CXXRecordDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/CXXRecordDecl.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using ClangSharp.Interop; namespace ClangSharp; @@ -118,7 +119,7 @@ private protected CXXRecordDecl(CXCursor handle, CXCursorKind expectedCursorKind public IReadOnlyList Ctors => _ctors.Value; - public new CXXRecordDecl Definition => (CXXRecordDecl)base.Definition; + public new CXXRecordDecl? Definition => (CXXRecordDecl?)base.Definition; public FunctionTemplateDecl DependentLambdaCallOperator => _dependentLambdaCallOperator.Value; @@ -164,11 +165,13 @@ public CXXRecordDecl MostRecentNonInjectedDecl { var recent = MostRecentDecl; - while ((recent != null) && recent.IsInjectedClassName) + while ((recent is not null) && recent.IsInjectedClassName) { recent = recent.PreviousDecl; } - return recent; + + Debug.Assert(recent is not null); + return recent!; } } diff --git a/sources/ClangSharp/Cursors/Decls/ConstructorUsingShadowDecl.cs b/sources/ClangSharp/Cursors/Decls/ConstructorUsingShadowDecl.cs index 3f7add8c..f7534256 100644 --- a/sources/ClangSharp/Cursors/Decls/ConstructorUsingShadowDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ConstructorUsingShadowDecl.cs @@ -30,5 +30,5 @@ internal ConstructorUsingShadowDecl(CXCursor handle) : base(handle, CXCursorKind public ConstructorUsingShadowDecl NominatedBaseClassShadowDecl => _nominatedBaseClassShadowDecl.Value; - public new CXXRecordDecl Parent => (CXXRecordDecl)DeclContext; + public new CXXRecordDecl? Parent => (CXXRecordDecl?)DeclContext; } diff --git a/sources/ClangSharp/Cursors/Decls/Decl.cs b/sources/ClangSharp/Cursors/Decls/Decl.cs index 806f2d18..82e90d13 100644 --- a/sources/ClangSharp/Cursors/Decls/Decl.cs +++ b/sources/ClangSharp/Cursors/Decls/Decl.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using ClangSharp.Interop; namespace ClangSharp; @@ -10,16 +11,16 @@ public class Decl : Cursor { private readonly Lazy _asFunction; private readonly Lazy> _attrs; - private readonly Lazy _body; + private readonly Lazy _body; private readonly Lazy _canonicalDecl; private readonly Lazy> _decls; private readonly Lazy _describedTemplate; private readonly Lazy _mostRecentDecl; private readonly Lazy _nextDeclInContext; private readonly Lazy _nonClosureContext; - private readonly Lazy _parentFunctionOrMethod; + private readonly Lazy _parentFunctionOrMethod; private readonly Lazy _previousDecl; - private readonly Lazy _redeclContext; + private readonly Lazy _redeclContext; private readonly Lazy _translationUnitDecl; private protected Decl(CXCursor handle, CXCursorKind expectedCursorKind, CX_DeclKind expectedDeclKind) : base(handle, expectedCursorKind) @@ -44,7 +45,7 @@ private protected Decl(CXCursor handle, CXCursorKind expectedCursorKind, CX_Decl return attrs; }); - _body = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Body)); + _body = new Lazy(() => !Handle.Body.IsNull ? TranslationUnit.GetOrCreate(Handle.Body) : null); _canonicalDecl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.CanonicalCursor)); _decls = new Lazy>(() => { @@ -64,9 +65,9 @@ private protected Decl(CXCursor handle, CXCursorKind expectedCursorKind, CX_Decl _mostRecentDecl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.MostRecentDecl)); _nextDeclInContext = new Lazy(() => TranslationUnit.GetOrCreate(Handle.NextDeclInContext)); _nonClosureContext = new Lazy(() => TranslationUnit.GetOrCreate(Handle.NonClosureContext)); - _parentFunctionOrMethod = new Lazy(() => TranslationUnit.GetOrCreate(Handle.ParentFunctionOrMethod) as IDeclContext); + _parentFunctionOrMethod = new Lazy(() => TranslationUnit.GetOrCreate(Handle.ParentFunctionOrMethod) as IDeclContext); _previousDecl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.PreviousDecl)); - _redeclContext = new Lazy(() => TranslationUnit.GetOrCreate(Handle.RedeclContext) as IDeclContext); + _redeclContext = new Lazy(() => TranslationUnit.GetOrCreate(Handle.RedeclContext) as IDeclContext); _translationUnitDecl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.TranslationUnit.Cursor)); } @@ -78,11 +79,11 @@ private protected Decl(CXCursor handle, CXCursorKind expectedCursorKind, CX_Decl public CXAvailabilityKind Availability => Handle.Availability; - public Stmt Body => _body.Value; + public Stmt? Body => _body.Value; public Decl CanonicalDecl => _canonicalDecl.Value; - public IDeclContext DeclContext => SemanticParentCursor as IDeclContext; + public IDeclContext? DeclContext => SemanticParentCursor as IDeclContext; public string DeclKindName => Handle.DeclKindSpelling; @@ -106,8 +107,24 @@ public bool IsStdNamespace { get { - return this is NamespaceDecl nd - && (nd.IsInline ? nd.Parent.IsStdNamespace : nd.Parent.RedeclContext.IsTranslationUnit && nd.Name == "std"); + if (this is NamespaceDecl nd) + { + var parent = nd.Parent; + Debug.Assert(parent is not null); + + if (nd.IsInline) + { + return parent!.IsStdNamespace; + } + else + { + var redeclContext = parent!.RedeclContext; + Debug.Assert(redeclContext is not null); + return redeclContext!.IsTranslationUnit && (nd.Name == "std"); + } + } + + return false; } } @@ -121,9 +138,9 @@ public bool IsStdNamespace public CX_DeclKind Kind => Handle.DeclKind; - public IDeclContext LexicalDeclContext => LexicalParentCursor as IDeclContext; + public IDeclContext? LexicalDeclContext => LexicalParentCursor as IDeclContext; - public IDeclContext LexicalParent => (this is IDeclContext) ? LexicalDeclContext : null; + public IDeclContext? LexicalParent => (this is IDeclContext) ? LexicalDeclContext : null; public uint MaxAlignment => Handle.MaxAlignment; @@ -133,13 +150,13 @@ public bool IsStdNamespace public Decl NonClosureContext => _nonClosureContext.Value; - public IDeclContext Parent => (this is IDeclContext) ? DeclContext : null; + public IDeclContext? Parent => (this is IDeclContext) ? DeclContext : null; - public IDeclContext ParentFunctionOrMethod => _parentFunctionOrMethod.Value; + public IDeclContext? ParentFunctionOrMethod => _parentFunctionOrMethod.Value; public Decl PreviousDecl => _previousDecl.Value; - public IDeclContext RedeclContext => _redeclContext.Value; + public IDeclContext? RedeclContext => _redeclContext.Value; public CXSourceRange SourceRange => clangsharp.Cursor_getSourceRange(Handle); diff --git a/sources/ClangSharp/Cursors/Decls/EnumConstantDecl.cs b/sources/ClangSharp/Cursors/Decls/EnumConstantDecl.cs index dea06366..cd29b35d 100644 --- a/sources/ClangSharp/Cursors/Decls/EnumConstantDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/EnumConstantDecl.cs @@ -7,16 +7,16 @@ namespace ClangSharp; public sealed class EnumConstantDecl : ValueDecl, IMergeable { - private readonly Lazy _initExpr; + private readonly Lazy _initExpr; internal EnumConstantDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_EnumConstantDecl, CX_DeclKind.CX_DeclKind_EnumConstant) { - _initExpr = new Lazy(() => TranslationUnit.GetOrCreate(Handle.InitExpr)); + _initExpr = new Lazy(() => !Handle.InitExpr.IsNull ? TranslationUnit.GetOrCreate(Handle.InitExpr) : null); } public new EnumConstantDecl CanonicalDecl => (EnumConstantDecl)base.CanonicalDecl; - public Expr InitExpr => _initExpr.Value; + public Expr? InitExpr => _initExpr.Value; public long InitVal => Handle.EnumConstantDeclValue; diff --git a/sources/ClangSharp/Cursors/Decls/EnumDecl.cs b/sources/ClangSharp/Cursors/Decls/EnumDecl.cs index a364dcc0..92731031 100644 --- a/sources/ClangSharp/Cursors/Decls/EnumDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/EnumDecl.cs @@ -37,7 +37,7 @@ internal EnumDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor_EnumDecl public new EnumDecl CanonicalDecl => (EnumDecl)base.CanonicalDecl; - public new EnumDecl Definition => (EnumDecl)base.Definition; + public new EnumDecl? Definition => (EnumDecl?)base.Definition; public IReadOnlyList Enumerators => _enumerators.Value; diff --git a/sources/ClangSharp/Cursors/Decls/FieldDecl.cs b/sources/ClangSharp/Cursors/Decls/FieldDecl.cs index 1529957c..86235b21 100644 --- a/sources/ClangSharp/Cursors/Decls/FieldDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/FieldDecl.cs @@ -45,5 +45,5 @@ private protected FieldDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX public bool IsUnnamedBitfield => Handle.IsUnnamedBitfield; - public new RecordDecl Parent => (RecordDecl)DeclContext ?? ((SemanticParentCursor is ClassTemplateDecl classTemplateDecl) ? (RecordDecl)classTemplateDecl.TemplatedDecl : null); + public new RecordDecl? Parent => (DeclContext as RecordDecl) ?? ((SemanticParentCursor is ClassTemplateDecl classTemplateDecl) ? (RecordDecl)classTemplateDecl.TemplatedDecl : null); } diff --git a/sources/ClangSharp/Cursors/Decls/ObjCInterfaceDecl.cs b/sources/ClangSharp/Cursors/Decls/ObjCInterfaceDecl.cs index f6ebf140..ec3c808f 100644 --- a/sources/ClangSharp/Cursors/Decls/ObjCInterfaceDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/ObjCInterfaceDecl.cs @@ -29,7 +29,7 @@ internal ObjCInterfaceDecl(CXCursor handle) : base(handle, CXCursorKind.CXCursor var category = TranslationUnit.GetOrCreate(handle.GetSubDecl(0)); - while (category != null) + while (category is not null) { categories.Add(category); category = category.NextClassCategoryRaw; diff --git a/sources/ClangSharp/Cursors/Decls/RecordDecl.cs b/sources/ClangSharp/Cursors/Decls/RecordDecl.cs index 5a9282b3..4c17eac4 100644 --- a/sources/ClangSharp/Cursors/Decls/RecordDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/RecordDecl.cs @@ -13,7 +13,7 @@ public class RecordDecl : TagDecl private readonly Lazy> _anonymousRecords; private readonly Lazy> _fields; private readonly Lazy> _indirectFields; - private readonly Lazy _injectedClassName; + private readonly Lazy _injectedClassName; internal RecordDecl(CXCursor handle) : this(handle, handle.Kind, CX_DeclKind.CX_DeclKind_Record) @@ -48,7 +48,7 @@ private protected RecordDecl(CXCursor handle, CXCursorKind expectedCursorKind, C _anonymousFields = new Lazy>(() => Decls.OfType().Where(decl => decl.IsAnonymousField).ToList()); _anonymousRecords = new Lazy>(() => Decls.OfType().Where(decl => decl.IsAnonymousStructOrUnion && !decl.IsInjectedClassName).ToList()); _indirectFields = new Lazy>(() => Decls.OfType().ToList()); - _injectedClassName = new Lazy(() => Decls.OfType().Where(decl => decl.IsInjectedClassName).SingleOrDefault()); + _injectedClassName = new Lazy(() => Decls.OfType().Where(decl => decl.IsInjectedClassName).SingleOrDefault()); } public bool IsAnonymousStructOrUnion => Handle.IsAnonymousStructOrUnion; @@ -57,13 +57,13 @@ private protected RecordDecl(CXCursor handle, CXCursorKind expectedCursorKind, C public IReadOnlyList AnonymousRecords => _anonymousRecords.Value; - public new RecordDecl Definition => (RecordDecl)base.Definition; + public new RecordDecl? Definition => (RecordDecl?)base.Definition; public IReadOnlyList Fields => _fields.Value; public IReadOnlyList IndirectFields => _indirectFields.Value; - public RecordDecl InjectedClassName => _injectedClassName.Value; + public RecordDecl? InjectedClassName => _injectedClassName.Value; public bool IsInjectedClassName => Handle.IsInjectedClassName; diff --git a/sources/ClangSharp/Cursors/Decls/TagDecl.cs b/sources/ClangSharp/Cursors/Decls/TagDecl.cs index 59c6ec8e..c41be351 100644 --- a/sources/ClangSharp/Cursors/Decls/TagDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/TagDecl.cs @@ -8,7 +8,7 @@ namespace ClangSharp; public unsafe class TagDecl : TypeDecl, IDeclContext, IRedeclarable { - private readonly Lazy _definition; + private readonly Lazy _definition; private readonly Lazy>> _templateParameterLists; private readonly Lazy _typedefNameForAnonDecl; @@ -19,7 +19,7 @@ private protected TagDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_D throw new ArgumentOutOfRangeException(nameof(handle)); } - _definition = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Definition)); + _definition = new Lazy(() => !Handle.Definition.IsNull ? TranslationUnit.GetOrCreate(Handle.Definition) : null); _templateParameterLists = new Lazy>>(() => { var numTemplateParameterLists = Handle.NumTemplateParameterLists; @@ -47,7 +47,7 @@ private protected TagDecl(CXCursor handle, CXCursorKind expectedCursorKind, CX_D public new TagDecl CanonicalDecl => (TagDecl)base.CanonicalDecl; - public TagDecl Definition => _definition.Value; + public TagDecl? Definition => _definition.Value; public bool IsClass => CursorKind == CXCursorKind.CXCursor_ClassDecl; diff --git a/sources/ClangSharp/Cursors/Exprs/AtomicExpr.cs b/sources/ClangSharp/Cursors/Exprs/AtomicExpr.cs index 3b646332..58ce9774 100644 --- a/sources/ClangSharp/Cursors/Exprs/AtomicExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/AtomicExpr.cs @@ -24,27 +24,27 @@ internal AtomicExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Unexpo public Expr Order => SubExprs[1]; - public Expr OrderFail => NumSubExprs > 3 ? SubExprs[3] : null; + public Expr? OrderFail => NumSubExprs > 3 ? SubExprs[3] : null; public Expr Ptr => SubExprs[0]; - public Expr Scope => (Op is >= CX_AtomicOperatorKind.CX_AO__opencl_atomic_load and <= CX_AtomicOperatorKind.CX_AO__opencl_atomic_fetch_max) ? SubExprs[(int)(NumSubExprs - 1)] : null; + public Expr? Scope => (Op is >= CX_AtomicOperatorKind.CX_AO__opencl_atomic_load and <= CX_AtomicOperatorKind.CX_AO__opencl_atomic_fetch_max) ? SubExprs[(int)(NumSubExprs - 1)] : null; public IReadOnlyList SubExprs => _subExprs.Value; - public Expr Val1 + public Expr? Val1 { get { - return Op is CX_AtomicOperatorKind.CX_AO__c11_atomic_init or CX_AtomicOperatorKind.CX_AO__opencl_atomic_init + return (Op is CX_AtomicOperatorKind.CX_AO__c11_atomic_init or CX_AtomicOperatorKind.CX_AO__opencl_atomic_init) ? Order : (NumSubExprs > 2) ? SubExprs[2] : null; } } - public Expr Val => Op == CX_AtomicOperatorKind.CX_AO__atomic_exchange ? OrderFail : (NumSubExprs > 4) ? SubExprs[4] : null; + public Expr? Val => Op == CX_AtomicOperatorKind.CX_AO__atomic_exchange ? OrderFail : (NumSubExprs > 4) ? SubExprs[4] : null; public Type ValueType => _valueType.Value; - public Expr Weak => (NumSubExprs > 5) ? SubExprs[5] : null; + public Expr? Weak => (NumSubExprs > 5) ? SubExprs[5] : null; } diff --git a/sources/ClangSharp/Cursors/Exprs/BlockExpr.cs b/sources/ClangSharp/Cursors/Exprs/BlockExpr.cs index 3a4574e4..9d10cefe 100644 --- a/sources/ClangSharp/Cursors/Exprs/BlockExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/BlockExpr.cs @@ -18,7 +18,7 @@ internal BlockExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_BlockEx public BlockDecl BlockDecl => _blockDecl.Value; - public Stmt Body => BlockDecl.Body; + public Stmt? Body => BlockDecl.Body; public FunctionProtoType FunctionType => (FunctionProtoType)((BlockPointerType)Type).PointeeType; } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXDefaultArgExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXDefaultArgExpr.cs index c980f572..1d181fae 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXDefaultArgExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXDefaultArgExpr.cs @@ -9,19 +9,19 @@ namespace ClangSharp; public sealed class CXXDefaultArgExpr : Expr { private readonly Lazy _param; - private readonly Lazy _usedContext; + private readonly Lazy _usedContext; internal CXXDefaultArgExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CXXDefaultArgExpr) { Debug.Assert(NumChildren is 0); _param = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Referenced)); - _usedContext = new Lazy(() => TranslationUnit.GetOrCreate(Handle.UsedContext) as IDeclContext); + _usedContext = new Lazy(() => TranslationUnit.GetOrCreate(Handle.UsedContext) as IDeclContext); } public Expr Expr => Param.DefaultArg; public ParmVarDecl Param => _param.Value; - public IDeclContext UsedContext => _usedContext.Value; + public IDeclContext? UsedContext => _usedContext.Value; } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXDefaultInitExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXDefaultInitExpr.cs index 23cfe325..a39b314f 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXDefaultInitExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXDefaultInitExpr.cs @@ -9,19 +9,19 @@ namespace ClangSharp; public sealed class CXXDefaultInitExpr : Expr { private readonly Lazy _field; - private readonly Lazy _usedContext; + private readonly Lazy _usedContext; internal CXXDefaultInitExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_CXXDefaultInitExpr) { Debug.Assert(NumChildren is 0); _field = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Referenced)); - _usedContext = new Lazy(() => TranslationUnit.GetOrCreate(Handle.UsedContext) as IDeclContext); + _usedContext = new Lazy(() => TranslationUnit.GetOrCreate(Handle.UsedContext) as IDeclContext); } public Expr Expr => Field.InClassInitializer; public FieldDecl Field => _field.Value; - public IDeclContext UsedContext => _usedContext.Value; + public IDeclContext? UsedContext => _usedContext.Value; } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXDependentScopeMemberExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXDependentScopeMemberExpr.cs index 53528bdb..411ed1e8 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXDependentScopeMemberExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXDependentScopeMemberExpr.cs @@ -34,7 +34,7 @@ internal CXXDependentScopeMemberExpr(CXCursor handle) : base(handle, CXCursorKin }); } - public Expr Base => (Expr)Children.SingleOrDefault(); + public Expr? Base => (Expr?)Children.SingleOrDefault(); public Type BaseType => _baseType.Value; diff --git a/sources/ClangSharp/Cursors/Exprs/CXXFoldExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXFoldExpr.cs index fa58b35c..9baaf5b4 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXFoldExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXFoldExpr.cs @@ -18,7 +18,7 @@ internal CXXFoldExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Unexp public bool IsLeftFold => !IsRightFold; - public bool IsRightFold => (LHS != null) && LHS.ContainsUnexpandedParameterPack; + public bool IsRightFold => (LHS is not null) && LHS.ContainsUnexpandedParameterPack; public Expr LHS => (Expr)Children[1]; diff --git a/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs index 8c2908cd..e6ca25d5 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs @@ -1,5 +1,6 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. +using System.Diagnostics; using ClangSharp.Interop; namespace ClangSharp; @@ -10,7 +11,7 @@ internal CXXMemberCallExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor { } - public Expr ImplicitObjectArgument + public Expr? ImplicitObjectArgument { get { @@ -33,15 +34,15 @@ public Expr ImplicitObjectArgument } } - public CXXMethodDecl MethodDecl => Callee.IgnoreParens is MemberExpr memExpr ? (CXXMethodDecl)memExpr.MemberDecl : null; + public CXXMethodDecl? MethodDecl => Callee.IgnoreParens is MemberExpr memExpr ? (CXXMethodDecl)memExpr.MemberDecl : null; - public Type ObjectType + public Type? ObjectType { get { - var ty = ImplicitObjectArgument.Type; + var ty = ImplicitObjectArgument?.Type; - if (ty.IsPointerType) + if ((ty is not null) && ty.IsPointerType) { ty = ty.PointeeType; } @@ -49,13 +50,13 @@ public Type ObjectType } } - public CXXRecordDecl RecordDecl + public CXXRecordDecl? RecordDecl { get { var thisArg = ImplicitObjectArgument; - return thisArg is null + return (thisArg is null) ? null : thisArg.Type.IsAnyPointerType ? thisArg.Type.PointeeType.AsCXXRecordDecl : thisArg.Type.AsCXXRecordDecl; } diff --git a/sources/ClangSharp/Cursors/Exprs/CXXNewExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXNewExpr.cs index c7a3d2e8..1fe88514 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXNewExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXNewExpr.cs @@ -22,15 +22,15 @@ internal CXXNewExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXXNew public Type AllocatedType => ((PointerType)Type).PointeeType; - public Expr ArraySize => IsArray ? (Expr)Children[ArraySizeOffset] : null; + public Expr? ArraySize => IsArray ? (Expr)Children[ArraySizeOffset] : null; - public CXXConstructExpr ConstructExpr => Initializer as CXXConstructExpr; + public CXXConstructExpr? ConstructExpr => Initializer as CXXConstructExpr; public bool DoesUsualArrayDeleteWantSize => Handle.DoesUsualArrayDeleteWantSize; public bool HasInitializer => Handle.HasInit; - public Expr Initializer => HasInitializer ? (Expr)Children[InitExprOffset] : null; + public Expr? Initializer => HasInitializer ? (Expr)Children[InitExprOffset] : null; public bool IsArray => Handle.IsArrayForm; diff --git a/sources/ClangSharp/Cursors/Exprs/CXXTypeidExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXTypeidExpr.cs index 793f65a8..869cb567 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXTypeidExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXTypeidExpr.cs @@ -17,7 +17,7 @@ internal CXXTypeidExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CXX _typeOperand = new Lazy(() => TranslationUnit.GetOrCreate(handle.TypeOperand)); } - public Expr ExprOperand => (Expr)Children.SingleOrDefault(); + public Expr? ExprOperand => (Expr?)Children.SingleOrDefault(); public bool IsPotentiallyEvaluated => Handle.IsPotentiallyEvaluated; diff --git a/sources/ClangSharp/Cursors/Exprs/CXXUuidofExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXUuidofExpr.cs index 27247d71..f8e99fd7 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXUuidofExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXUuidofExpr.cs @@ -20,7 +20,7 @@ internal CXXUuidofExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Une _guidDecl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Referenced)); } - public Expr ExprOperand => (Expr)Children.SingleOrDefault(); + public Expr? ExprOperand => (Expr?)Children.SingleOrDefault(); public MSGuidDecl GuidDecl => _guidDecl.Value; diff --git a/sources/ClangSharp/Cursors/Exprs/CallExpr.cs b/sources/ClangSharp/Cursors/Exprs/CallExpr.cs index 5d5d1227..13ef710f 100644 --- a/sources/ClangSharp/Cursors/Exprs/CallExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CallExpr.cs @@ -36,7 +36,7 @@ private protected CallExpr(CXCursor handle, CXCursorKind expectedCursorKind, CX_ public Decl CalleeDecl => _calleeDecl.Value; - public FunctionDecl DirectCallee => CalleeDecl as FunctionDecl; + public FunctionDecl? DirectCallee => CalleeDecl as FunctionDecl; public bool IsCallToStdMove => (NumArgs == 1) && (DirectCallee is FunctionDecl fd) && fd.IsInStdNamespace && (fd.Name == "move"); diff --git a/sources/ClangSharp/Cursors/Exprs/CastExpr.cs b/sources/ClangSharp/Cursors/Exprs/CastExpr.cs index 382e476a..4feefa1e 100644 --- a/sources/ClangSharp/Cursors/Exprs/CastExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CastExpr.cs @@ -40,7 +40,7 @@ private protected CastExpr(CXCursor handle, CXCursorKind expectedCursorKind, CX_ public string CastKindName => Handle.CastKindSpelling; - public NamedDecl ConversionFunction + public NamedDecl? ConversionFunction { get { @@ -80,7 +80,7 @@ public Expr SubExprAsWritten { get { - Expr subExpr; + Expr? subExpr; var e = this; do @@ -99,6 +99,7 @@ public Expr SubExprAsWritten if (subExpr is CXXMemberCallExpr mce) { subExpr = mce.ImplicitObjectArgument; + Debug.Assert(subExpr is not null); } } @@ -106,7 +107,8 @@ public Expr SubExprAsWritten // through that, too. } while ((e = subExpr as ImplicitCastExpr) is not null); - return subExpr; + Debug.Assert(subExpr is not null); + return subExpr!; } } diff --git a/sources/ClangSharp/Cursors/Exprs/ChooseExpr.cs b/sources/ClangSharp/Cursors/Exprs/ChooseExpr.cs index d69f1849..f4c6ccd9 100644 --- a/sources/ClangSharp/Cursors/Exprs/ChooseExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/ChooseExpr.cs @@ -12,7 +12,7 @@ internal ChooseExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Unexpo Debug.Assert(NumChildren is 3); } - public Expr ChosenSubExpr => IsConditionDependent ? (IsConditionTrue ? LHS : RHS) : null; + public Expr? ChosenSubExpr => IsConditionDependent ? (IsConditionTrue ? LHS : RHS) : null; public Expr Cond => (Expr)Children[0]; diff --git a/sources/ClangSharp/Cursors/Exprs/Expr.cs b/sources/ClangSharp/Cursors/Exprs/Expr.cs index b23e42bd..3cc36920 100644 --- a/sources/ClangSharp/Cursors/Exprs/Expr.cs +++ b/sources/ClangSharp/Cursors/Exprs/Expr.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. using System; +using System.Diagnostics; using ClangSharp.Interop; namespace ClangSharp; @@ -34,14 +35,18 @@ public class Expr : ValueStmt { if (!gse.IsResultDependent) { - return gse.ResultExpr; + var resultExpr = gse.ResultExpr; + Debug.Assert(resultExpr is not null); + return resultExpr!; } } else if (e is ChooseExpr ce) { if (!ce.IsConditionDependent) { - return ce.ChosenSubExpr; + var chosenSubExpr = ce.ChosenSubExpr; + Debug.Assert(chosenSubExpr is not null); + return chosenSubExpr!; } } @@ -125,7 +130,7 @@ public bool IsImplicitCXXThis private static Expr IgnoreExprNodes(Expr e, Func fn) { - Expr lastE = null; + Expr? lastE = null; while (e != lastE) { diff --git a/sources/ClangSharp/Cursors/Exprs/GenericSelectionExpr.cs b/sources/ClangSharp/Cursors/Exprs/GenericSelectionExpr.cs index 33a32cf5..18115b2d 100644 --- a/sources/ClangSharp/Cursors/Exprs/GenericSelectionExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/GenericSelectionExpr.cs @@ -24,7 +24,7 @@ internal GenericSelectionExpr(CXCursor handle) : base(handle, CXCursorKind.CXCur public uint NumAssocs => unchecked((uint)Handle.NumAssocs); - public Expr ResultExpr => IsResultDependent ? null : (Expr)Children[(int)ResultIndex]; + public Expr? ResultExpr => IsResultDependent ? null : (Expr)Children[(int)ResultIndex]; public uint ResultIndex => unchecked((uint)Handle.ResultIndex); } diff --git a/sources/ClangSharp/Cursors/Exprs/MaterializeTemporaryExpr.cs b/sources/ClangSharp/Cursors/Exprs/MaterializeTemporaryExpr.cs index f5426e77..3e7b2181 100644 --- a/sources/ClangSharp/Cursors/Exprs/MaterializeTemporaryExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/MaterializeTemporaryExpr.cs @@ -14,7 +14,7 @@ internal MaterializeTemporaryExpr(CXCursor handle) : base(handle, CXCursorKind.C _lifetimeExtendedTemporaryDecl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Referenced)); } - public ValueDecl ExtendingDecl => LifetimeExtendedTemporaryDecl?.ExtendingDecl; + public ValueDecl ExtendingDecl => LifetimeExtendedTemporaryDecl.ExtendingDecl; public LifetimeExtendedTemporaryDecl LifetimeExtendedTemporaryDecl => _lifetimeExtendedTemporaryDecl.Value; diff --git a/sources/ClangSharp/Cursors/Exprs/MatrixSubscriptExpr.cs b/sources/ClangSharp/Cursors/Exprs/MatrixSubscriptExpr.cs index 03273b6b..1a750889 100644 --- a/sources/ClangSharp/Cursors/Exprs/MatrixSubscriptExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/MatrixSubscriptExpr.cs @@ -14,7 +14,7 @@ internal MatrixSubscriptExpr(CXCursor handle) : base(handle, CXCursorKind.CXCurs public Expr Base => (Expr)Children[0]; - public Expr ColumnIdx => IsIncomplete ? null : (Expr)Children[2]; + public Expr? ColumnIdx => IsIncomplete ? null : (Expr)Children[2]; public bool IsIncomplete => Handle.IsIncomplete; diff --git a/sources/ClangSharp/Cursors/Exprs/PredefinedExpr.cs b/sources/ClangSharp/Cursors/Exprs/PredefinedExpr.cs index c204de78..e091427c 100644 --- a/sources/ClangSharp/Cursors/Exprs/PredefinedExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/PredefinedExpr.cs @@ -13,5 +13,5 @@ internal PredefinedExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Un Debug.Assert(NumChildren is 0 or 1); } - public StringLiteral FunctionName => (StringLiteral)Children.SingleOrDefault(); + public StringLiteral? FunctionName => (StringLiteral?)Children.SingleOrDefault(); } diff --git a/sources/ClangSharp/Cursors/Exprs/PseudoObjectExpr.cs b/sources/ClangSharp/Cursors/Exprs/PseudoObjectExpr.cs index dd249b2d..4c2af9ae 100644 --- a/sources/ClangSharp/Cursors/Exprs/PseudoObjectExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/PseudoObjectExpr.cs @@ -20,7 +20,7 @@ internal PseudoObjectExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ public uint NumSemanticExprs => NumChildren - 1; - public Expr ResultExpr => (ResultExprIndex == 0) ? null : (Expr)Children[unchecked((int)ResultExprIndex)]; + public Expr? ResultExpr => (ResultExprIndex == 0) ? null : (Expr)Children[unchecked((int)ResultExprIndex)]; public uint ResultExprIndex => unchecked((uint)Handle.ResultIndex); diff --git a/sources/ClangSharp/Cursors/Exprs/UnresolvedMemberExpr.cs b/sources/ClangSharp/Cursors/Exprs/UnresolvedMemberExpr.cs index 86b06fd5..9a1b81af 100644 --- a/sources/ClangSharp/Cursors/Exprs/UnresolvedMemberExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/UnresolvedMemberExpr.cs @@ -17,7 +17,7 @@ internal UnresolvedMemberExpr(CXCursor handle) : base(handle, CXCursorKind.CXCur _baseType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.TypeOperand)); } - public Expr Base => (Expr)Children.SingleOrDefault(); + public Expr? Base => (Expr?)Children.SingleOrDefault(); public Type BaseType => _baseType.Value; diff --git a/sources/ClangSharp/Cursors/Stmts/CXXForRangeStmt.cs b/sources/ClangSharp/Cursors/Stmts/CXXForRangeStmt.cs index 8c8a3aa5..8084fb88 100644 --- a/sources/ClangSharp/Cursors/Stmts/CXXForRangeStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/CXXForRangeStmt.cs @@ -22,13 +22,29 @@ internal CXXForRangeStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_C public Expr Inc => (Expr)Children[5]; - public VarDecl LoopVariable => (VarDecl)LoopVarStmt.SingleDecl; + public VarDecl LoopVariable + { + get + { + var loopVariable = (VarDecl?)LoopVarStmt.SingleDecl; + Debug.Assert(loopVariable is not null); + return loopVariable!; + } + } public DeclStmt LoopVarStmt => (DeclStmt)Children[6]; public Stmt Init => Children[0]; - public Expr RangeInit => ((VarDecl)RangeStmt.SingleDecl).Init; + public Expr RangeInit + { + get + { + var rangeDecl = (VarDecl?)RangeStmt.SingleDecl; + Debug.Assert(rangeDecl is not null); + return rangeDecl!.Init; + } + } public DeclStmt RangeStmt => (DeclStmt)Children[1]; } diff --git a/sources/ClangSharp/Cursors/Stmts/CaseStmt.cs b/sources/ClangSharp/Cursors/Stmts/CaseStmt.cs index 37757673..83ec613c 100644 --- a/sources/ClangSharp/Cursors/Stmts/CaseStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/CaseStmt.cs @@ -16,7 +16,7 @@ internal CaseStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_CaseStmt public Expr LHS => (Expr)Children[LHSOffset]; - public Expr RHS => CaseStmtIsGNURange ? (Expr)Children[RHSOffset] : null; + public Expr? RHS => CaseStmtIsGNURange ? (Expr)Children[RHSOffset] : null; public new Stmt SubStmt => Children[SubStmtOffset]; diff --git a/sources/ClangSharp/Cursors/Stmts/CompoundStmt.cs b/sources/ClangSharp/Cursors/Stmts/CompoundStmt.cs index a835bb16..480dd75d 100644 --- a/sources/ClangSharp/Cursors/Stmts/CompoundStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/CompoundStmt.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using ClangSharp.Interop; @@ -14,9 +15,9 @@ public CompoundStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Compou public IReadOnlyList Body => Children; - public Stmt BodyBack => Children.LastOrDefault(); + public Stmt? BodyBack => Children.LastOrDefault(); - public Stmt BodyFront => Children.FirstOrDefault(); + public Stmt? BodyFront => Children.FirstOrDefault(); public uint Size => unchecked((uint)NumChildren); @@ -31,7 +32,10 @@ public Stmt StmtExprResult return b; } } - return BodyBack; + + var bodyBack = BodyBack; + Debug.Assert(bodyBack is not null); + return bodyBack!; } } } diff --git a/sources/ClangSharp/Cursors/Stmts/DeclStmt.cs b/sources/ClangSharp/Cursors/Stmts/DeclStmt.cs index 2cc71bd1..ab2ca66d 100644 --- a/sources/ClangSharp/Cursors/Stmts/DeclStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/DeclStmt.cs @@ -31,5 +31,5 @@ internal DeclStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_DeclStmt public bool IsSingleDecl => Decls.Count == 1; - public Decl SingleDecl => Decls.SingleOrDefault(); + public Decl? SingleDecl => Decls.SingleOrDefault(); } diff --git a/sources/ClangSharp/Cursors/Stmts/ForStmt.cs b/sources/ClangSharp/Cursors/Stmts/ForStmt.cs index e4d8c23f..493111a6 100644 --- a/sources/ClangSharp/Cursors/Stmts/ForStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ForStmt.cs @@ -16,7 +16,15 @@ internal ForStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ForStmt, public Expr Cond => (Expr)Children[2]; - public VarDecl ConditionVariable => (VarDecl)ConditionVariableDeclStmt?.SingleDecl; + public VarDecl ConditionVariable + { + get + { + var conditionVariable = (VarDecl?)ConditionVariableDeclStmt.SingleDecl; + Debug.Assert(conditionVariable is not null); + return conditionVariable!; + } + } public DeclStmt ConditionVariableDeclStmt => (DeclStmt)Children[1]; diff --git a/sources/ClangSharp/Cursors/Stmts/IfStmt.cs b/sources/ClangSharp/Cursors/Stmts/IfStmt.cs index c1ad340e..e90174a5 100644 --- a/sources/ClangSharp/Cursors/Stmts/IfStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/IfStmt.cs @@ -14,11 +14,11 @@ internal IfStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_IfStmt, CX public Expr Cond => (Expr)Children[CondOffset]; - public VarDecl ConditionVariable => (VarDecl)ConditionVariableDeclStmt?.SingleDecl; + public VarDecl? ConditionVariable => (VarDecl?)ConditionVariableDeclStmt?.SingleDecl; - public DeclStmt ConditionVariableDeclStmt => HasVarStorage ? (DeclStmt)Children[VarOffset] : null; + public DeclStmt? ConditionVariableDeclStmt => HasVarStorage ? (DeclStmt)Children[VarOffset] : null; - public Stmt Else => HasElseStorage ? Children[ElseOffset] : null; + public Stmt? Else => HasElseStorage ? Children[ElseOffset] : null; public bool HasElseStorage => Handle.HasElseStorage; @@ -26,7 +26,7 @@ internal IfStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_IfStmt, CX public bool HasVarStorage => Handle.HasVarStorage; - public Stmt Init => HasInitStorage ? Children[InitOffset] : null; + public Stmt? Init => HasInitStorage ? Children[InitOffset] : null; public bool IsConstexpr => Handle.IsConstexpr; diff --git a/sources/ClangSharp/Cursors/Stmts/ObjCAtCatchStmt.cs b/sources/ClangSharp/Cursors/Stmts/ObjCAtCatchStmt.cs index 2ba4f503..6085c082 100644 --- a/sources/ClangSharp/Cursors/Stmts/ObjCAtCatchStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ObjCAtCatchStmt.cs @@ -8,17 +8,17 @@ namespace ClangSharp; public sealed class ObjCAtCatchStmt : Stmt { - private readonly Lazy _catchParamDecl; + private readonly Lazy _catchParamDecl; internal ObjCAtCatchStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtCatchStmt, CX_StmtClass.CX_StmtClass_ObjCAtCatchStmt) { Debug.Assert(NumChildren is 1); - _catchParamDecl = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Referenced)); + _catchParamDecl = new Lazy(() => !Handle.Referenced.IsNull ? TranslationUnit.GetOrCreate(Handle.Referenced) : null); } public Stmt CatchBody => Children[0]; - public VarDecl CatchParamDecl => _catchParamDecl.Value; + public VarDecl? CatchParamDecl => _catchParamDecl.Value; - public bool HasEllipsis => CatchParamDecl == null; + public bool HasEllipsis => CatchParamDecl is null; } diff --git a/sources/ClangSharp/Cursors/Stmts/ObjCAtTryStmt.cs b/sources/ClangSharp/Cursors/Stmts/ObjCAtTryStmt.cs index 5871888a..c34dd4ef 100644 --- a/sources/ClangSharp/Cursors/Stmts/ObjCAtTryStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ObjCAtTryStmt.cs @@ -11,7 +11,7 @@ namespace ClangSharp; public sealed class ObjCAtTryStmt : Stmt { private readonly Lazy> _catchStmts; - private readonly Lazy _finallyStmt; + private readonly Lazy _finallyStmt; internal ObjCAtTryStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_ObjCAtTryStmt, CX_StmtClass.CX_StmtClass_ObjCAtTryStmt) { @@ -28,10 +28,10 @@ internal ObjCAtTryStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Obj return children.Skip(1).Take((int)(NumChildren - 1 - skipLast)).Cast().ToList(); }); - _finallyStmt = new Lazy(() => { + _finallyStmt = new Lazy(() => { var children = Children; - return children.Last() is ObjCAtFinallyStmt finallyStmt ? finallyStmt : null; + return (children.Last() is ObjCAtFinallyStmt finallyStmt) ? finallyStmt : null; }); } @@ -39,7 +39,7 @@ internal ObjCAtTryStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Obj public IReadOnlyList CatchStmts => _catchStmts.Value; - public ObjCAtFinallyStmt FinallyStmt => _finallyStmt.Value; + public ObjCAtFinallyStmt? FinallyStmt => _finallyStmt.Value; public uint NumCatchStmts => (uint)CatchStmts.Count; } diff --git a/sources/ClangSharp/Cursors/Stmts/ReturnStmt.cs b/sources/ClangSharp/Cursors/Stmts/ReturnStmt.cs index d050ef06..31238243 100644 --- a/sources/ClangSharp/Cursors/Stmts/ReturnStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ReturnStmt.cs @@ -19,5 +19,5 @@ internal ReturnStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Return public VarDecl NRVOCandidate => _nrvoCandidate.Value; - public Expr RetValue => NumChildren != 0 ? (Expr)Children[0] : null; + public Expr? RetValue => NumChildren != 0 ? (Expr)Children[0] : null; } diff --git a/sources/ClangSharp/Cursors/Stmts/SEHTryStmt.cs b/sources/ClangSharp/Cursors/Stmts/SEHTryStmt.cs index 074b6a78..2027166d 100644 --- a/sources/ClangSharp/Cursors/Stmts/SEHTryStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/SEHTryStmt.cs @@ -12,9 +12,9 @@ internal SEHTryStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_SEHTry Debug.Assert(NumChildren is 2); } - public SEHExceptStmt ExceptHandler => Handler as SEHExceptStmt; + public SEHExceptStmt? ExceptHandler => Handler as SEHExceptStmt; - public SEHFinallyStmt FinallyHandler => Handler as SEHFinallyStmt; + public SEHFinallyStmt? FinallyHandler => Handler as SEHFinallyStmt; public bool IsCXXTry => Handle.IsCXXTry; diff --git a/sources/ClangSharp/Cursors/Stmts/Stmt.cs b/sources/ClangSharp/Cursors/Stmts/Stmt.cs index 1c2e759c..0ce01689 100644 --- a/sources/ClangSharp/Cursors/Stmts/Stmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/Stmt.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using ClangSharp.Interop; namespace ClangSharp; @@ -39,7 +40,8 @@ private protected Stmt(CXCursor handle, CXCursorKind expectedCursorKind, CX_Stmt semanticParent = TranslationUnit.GetOrCreate(semanticParent.Handle.SemanticParent); } - return (IDeclContext)semanticParent; + Debug.Assert(semanticParent is not null); + return (IDeclContext)semanticParent!; }); } @@ -79,13 +81,16 @@ public Stmt IgnoreContainers(bool ignoreCaptured = false) } s = cs.BodyBack; + Debug.Assert(s is not null); } else { break; } } - return s; + + Debug.Assert(s is not null); + return s!; } public Stmt StripLabelLikeStatements() @@ -101,6 +106,7 @@ public Stmt StripLabelLikeStatements() else if (s is SwitchCase sc) { s = sc.SubStmt; + Debug.Assert(s is not null); } else if (s is AttributedStmt @as) { @@ -108,7 +114,8 @@ public Stmt StripLabelLikeStatements() } else { - return s; + Debug.Assert(s is not null); + return s!; } } } diff --git a/sources/ClangSharp/Cursors/Stmts/SwitchCase.cs b/sources/ClangSharp/Cursors/Stmts/SwitchCase.cs index a96ee2c4..bae610d1 100644 --- a/sources/ClangSharp/Cursors/Stmts/SwitchCase.cs +++ b/sources/ClangSharp/Cursors/Stmts/SwitchCase.cs @@ -22,7 +22,7 @@ private protected SwitchCase(CXCursor handle, CXCursorKind expectedCursorKind, C public SwitchCase NextSwitchCase => _nextSwitchCase.Value; - public Stmt SubStmt + public Stmt? SubStmt { get { diff --git a/sources/ClangSharp/Cursors/Stmts/SwitchStmt.cs b/sources/ClangSharp/Cursors/Stmts/SwitchStmt.cs index 2c4ef06e..6f332fcc 100644 --- a/sources/ClangSharp/Cursors/Stmts/SwitchStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/SwitchStmt.cs @@ -20,15 +20,15 @@ internal SwitchStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Switch public Expr Cond => (Expr)Children[CondOffset]; - public VarDecl ConditionVariable => (VarDecl)ConditionVariableDeclStmt?.SingleDecl; + public VarDecl? ConditionVariable => (VarDecl?)ConditionVariableDeclStmt?.SingleDecl; - public DeclStmt ConditionVariableDeclStmt => HasVarStorage ? (DeclStmt)Children[VarOffset] : null; + public DeclStmt? ConditionVariableDeclStmt => HasVarStorage ? (DeclStmt)Children[VarOffset] : null; public bool HasInitStorage => Handle.HasInit; public bool HasVarStorage => Handle.HasVarStorage; - public Stmt Init => HasInitStorage ? Children[InitOffset] : null; + public Stmt? Init => HasInitStorage ? Children[InitOffset] : null; public bool IsAllEnumCasesCovered => Handle.IsAllEnumCasesCovered; diff --git a/sources/ClangSharp/Cursors/Stmts/ValueStmt.cs b/sources/ClangSharp/Cursors/Stmts/ValueStmt.cs index 6d9b0bd8..b66d006b 100644 --- a/sources/ClangSharp/Cursors/Stmts/ValueStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/ValueStmt.cs @@ -16,7 +16,7 @@ private protected ValueStmt(CXCursor handle, CXCursorKind expectedCursorKind, CX } } - public Expr ExprStmt + public Expr? ExprStmt { get { diff --git a/sources/ClangSharp/Cursors/Stmts/WhileStmt.cs b/sources/ClangSharp/Cursors/Stmts/WhileStmt.cs index 9dfad470..45dfcba3 100644 --- a/sources/ClangSharp/Cursors/Stmts/WhileStmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/WhileStmt.cs @@ -18,9 +18,9 @@ internal WhileStmt(CXCursor handle) : base(handle, CXCursorKind.CXCursor_WhileSt public bool HasVarStorage => Handle.HasVarStorage; - public VarDecl ConditionVariable => (VarDecl)ConditionVariableDeclStmt?.SingleDecl; + public VarDecl? ConditionVariable => (VarDecl?)ConditionVariableDeclStmt?.SingleDecl; - public DeclStmt ConditionVariableDeclStmt => HasVarStorage ? (DeclStmt)Children[VarOffset] : null; + public DeclStmt? ConditionVariableDeclStmt => HasVarStorage ? (DeclStmt)Children[VarOffset] : null; private int BodyOffset => CondOffset + 1; diff --git a/sources/ClangSharp/IDeclContext.cs b/sources/ClangSharp/IDeclContext.cs index 71cfb0f7..a6d37581 100644 --- a/sources/ClangSharp/IDeclContext.cs +++ b/sources/ClangSharp/IDeclContext.cs @@ -14,9 +14,9 @@ public interface IDeclContext bool IsTranslationUnit { get; } - IDeclContext LexicalParent { get; } + IDeclContext? LexicalParent { get; } - IDeclContext Parent { get; } + IDeclContext? Parent { get; } - IDeclContext RedeclContext { get; } + IDeclContext? RedeclContext { get; } } diff --git a/sources/ClangSharp/Index.cs b/sources/ClangSharp/Index.cs index 46a6fbcd..74d51378 100644 --- a/sources/ClangSharp/Index.cs +++ b/sources/ClangSharp/Index.cs @@ -21,9 +21,9 @@ private Index(CXIndex handle) public CXIndex Handle { get; } - public static bool operator ==(Index left, Index right) => (left is not null) ? ((right is not null) && (left.Handle == right.Handle)) : (right is null); + public static bool operator ==(Index? left, Index? right) => (left is not null) ? ((right is not null) && (left.Handle == right.Handle)) : (right is null); - public static bool operator !=(Index left, Index right) => (left is not null) ? ((right is null) || (left.Handle != right.Handle)) : (right is not null); + public static bool operator !=(Index? left, Index? right) => (left is not null) ? ((right is null) || (left.Handle != right.Handle)) : (right is not null); public static Index Create(bool excludeDeclarationsFromPch = false, bool displayDiagnostics = false) { @@ -37,9 +37,9 @@ public void Dispose() GC.SuppressFinalize(this); } - public override bool Equals(object obj) => (obj is Index other) && Equals(other); + public override bool Equals(object? obj) => (obj is Index other) && Equals(other); - public bool Equals(Index other) => this == other; + public bool Equals(Index? other) => this == other; public override int GetHashCode() => Handle.GetHashCode(); diff --git a/sources/ClangSharp/TemplateArgument.cs b/sources/ClangSharp/TemplateArgument.cs index 8bfb17c0..c1105a0a 100644 --- a/sources/ClangSharp/TemplateArgument.cs +++ b/sources/ClangSharp/TemplateArgument.cs @@ -26,6 +26,8 @@ internal TemplateArgument(CX_TemplateArgument handle) { Handle = handle; + _translationUnit = new Lazy(() => TranslationUnit.GetOrCreate(Handle.tu)); + _asDecl = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.AsDecl)); _asExpr = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.AsExpr)); _asTemplate = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.AsTemplate)); @@ -50,7 +52,6 @@ internal TemplateArgument(CX_TemplateArgument handle) }); _paramTypeForDecl = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.ParamTypeForDecl)); - _translationUnit = new Lazy(() => TranslationUnit.GetOrCreate(Handle.tu)); } ~TemplateArgument() => Dispose(isDisposing: false); diff --git a/sources/ClangSharp/TemplateArgumentLoc.cs b/sources/ClangSharp/TemplateArgumentLoc.cs index 99554b53..61c285c9 100644 --- a/sources/ClangSharp/TemplateArgumentLoc.cs +++ b/sources/ClangSharp/TemplateArgumentLoc.cs @@ -18,12 +18,13 @@ internal TemplateArgumentLoc(CX_TemplateArgumentLoc handle) { Handle = handle; + _translationUnit = new Lazy(() => TranslationUnit.GetOrCreate(Handle.tu)); + _argument = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.Argument)); _sourceDeclExpression = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.SourceDeclExpression)); _sourceExpression = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.SourceExpression)); _sourceIntegralExpression = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.SourceIntegralExpression)); _sourceNullPtrExpression = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.SourceNullPtrExpression)); - _translationUnit = new Lazy(() => TranslationUnit.GetOrCreate(Handle.tu)); } public TemplateArgument Argument => _argument.Value; diff --git a/sources/ClangSharp/TemplateName.cs b/sources/ClangSharp/TemplateName.cs index 3e724194..2a8bc1a5 100644 --- a/sources/ClangSharp/TemplateName.cs +++ b/sources/ClangSharp/TemplateName.cs @@ -14,8 +14,8 @@ internal TemplateName(CX_TemplateName handle) { Handle = handle; - _asTemplateDecl = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.AsTemplateDecl)); _translationUnit = new Lazy(() => TranslationUnit.GetOrCreate(Handle.tu)); + _asTemplateDecl = new Lazy(() => _translationUnit.Value.GetOrCreate(Handle.AsTemplateDecl)); } public TemplateDecl AsTemplateDecl => _asTemplateDecl.Value; diff --git a/sources/ClangSharp/TranslationUnit.cs b/sources/ClangSharp/TranslationUnit.cs index 79c3c04e..1c538857 100644 --- a/sources/ClangSharp/TranslationUnit.cs +++ b/sources/ClangSharp/TranslationUnit.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; +using System.Diagnostics; using ClangSharp.Interop; namespace ClangSharp; @@ -43,18 +44,19 @@ private TranslationUnit(CXTranslationUnit handle) public TranslationUnitDecl TranslationUnitDecl => _translationUnitDecl.Value; - public static bool operator ==(TranslationUnit left, TranslationUnit right) => (left is not null) ? ((right is not null) && (left.Handle == right.Handle)) : (right is null); + public static bool operator ==(TranslationUnit? left, TranslationUnit? right) => (left is not null) ? ((right is not null) && (left.Handle == right.Handle)) : (right is null); - public static bool operator !=(TranslationUnit left, TranslationUnit right) => (left is not null) ? ((right is null) || (left.Handle != right.Handle)) : (right is not null); + public static bool operator !=(TranslationUnit? left, TranslationUnit? right) => (left is not null) ? ((right is null) || (left.Handle != right.Handle)) : (right is not null); public static TranslationUnit GetOrCreate(CXTranslationUnit handle) { if (handle == null) { - return null; + Debug.Assert(handle != null); + return null!; } - var translationUnitRef = s_createdTranslationUnits.GetOrAdd(handle, (handle) => new WeakReference(null)); + var translationUnitRef = s_createdTranslationUnits.GetOrAdd(handle, (handle) => new WeakReference(null!)); if (!translationUnitRef.TryGetTarget(out var translationUnit)) { @@ -76,24 +78,25 @@ public void Dispose() GC.SuppressFinalize(this); } - public override bool Equals(object obj) => (obj is TranslationUnit other) && Equals(other); + public override bool Equals(object? obj) => (obj is TranslationUnit other) && Equals(other); - public bool Equals(TranslationUnit other) => this == other; + public bool Equals(TranslationUnit? other) => this == other; public override int GetHashCode() => Handle.GetHashCode(); internal TCursor GetOrCreate(CXCursor handle) where TCursor : Cursor { - WeakReference cursorRef; + WeakReference? cursorRef; if (handle.IsNull) { - return null; + Debug.Assert(!handle.IsNull); + return null!; } else if (!_createdCursors.TryGetValue(handle, out cursorRef)) { - cursorRef = new WeakReference(null); + cursorRef = new WeakReference(null!); _createdCursors.Add(handle, cursorRef); } @@ -102,20 +105,23 @@ internal TCursor GetOrCreate(CXCursor handle) cursor = Cursor.Create(handle); cursorRef.SetTarget(cursor); } - return (TCursor)cursor; + + Debug.Assert(cursor is not null); + return (TCursor)cursor!; } internal TemplateArgument GetOrCreate(CX_TemplateArgument handle) { - WeakReference templateArgumentRef; + WeakReference? templateArgumentRef; if (handle.kind == CXTemplateArgumentKind.CXTemplateArgumentKind_Invalid) { - return null; + Debug.Assert(handle.kind != CXTemplateArgumentKind.CXTemplateArgumentKind_Invalid); + return null!; } else if (!_createdTemplateArguments.TryGetValue(handle, out templateArgumentRef)) { - templateArgumentRef = new WeakReference(null); + templateArgumentRef = new WeakReference(null!); _createdTemplateArguments.Add(handle, templateArgumentRef); } @@ -129,15 +135,16 @@ internal TemplateArgument GetOrCreate(CX_TemplateArgument handle) internal TemplateArgumentLoc GetOrCreate(CX_TemplateArgumentLoc handle) { - WeakReference templateArgumentLocRef; + WeakReference? templateArgumentLocRef; if (handle.value == null) { - return null; + Debug.Assert(handle.value != null); + return null!; } else if (!_createdTemplateArgumentLocs.TryGetValue(handle, out templateArgumentLocRef)) { - templateArgumentLocRef = new WeakReference(null); + templateArgumentLocRef = new WeakReference(null!); _createdTemplateArgumentLocs.Add(handle, templateArgumentLocRef); } @@ -151,15 +158,16 @@ internal TemplateArgumentLoc GetOrCreate(CX_TemplateArgumentLoc handle) internal TemplateName GetOrCreate(CX_TemplateName handle) { - WeakReference templateNameRef; + WeakReference? templateNameRef; if (handle.kind == CX_TemplateNameKind.CX_TNK_Invalid) { - return null; + Debug.Assert(handle.kind != CX_TemplateNameKind.CX_TNK_Invalid); + return null!; } else if (!_createdTemplateNames.TryGetValue(handle, out templateNameRef)) { - templateNameRef = new WeakReference(null); + templateNameRef = new WeakReference(null!); _createdTemplateNames.Add(handle, templateNameRef); } @@ -174,15 +182,16 @@ internal TemplateName GetOrCreate(CX_TemplateName handle) internal TType GetOrCreate(CXType handle) where TType : Type { - WeakReference typeRef; + WeakReference? typeRef; if (handle.kind == CXTypeKind.CXType_Invalid) { - return null; + Debug.Assert(handle.kind != CXTypeKind.CXType_Invalid); + return null!; } else if (!_createdTypes.TryGetValue(handle, out typeRef)) { - typeRef = new WeakReference(null); + typeRef = new WeakReference(null!); _createdTypes.Add(handle, typeRef); } diff --git a/sources/ClangSharp/Types/TemplateSpecializationType.cs b/sources/ClangSharp/Types/TemplateSpecializationType.cs index bfac55ee..e6c7acfc 100644 --- a/sources/ClangSharp/Types/TemplateSpecializationType.cs +++ b/sources/ClangSharp/Types/TemplateSpecializationType.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using ClangSharp.Interop; namespace ClangSharp; @@ -29,10 +30,11 @@ internal TemplateSpecializationType(CXType handle) : base(handle, CXTypeKind.CXT _templateName = new Lazy(() => TranslationUnit.GetOrCreate(Handle.TemplateName)); } - public Type AliasedType => IsTypeAlias ? Desugar : null; + public Type? AliasedType => IsTypeAlias ? Desugar : null; public IReadOnlyList Args => _templateArgs.Value; + [MemberNotNullWhen(true, nameof(AliasedType))] public bool IsTypeAlias => Handle.IsTypeAlias; public TemplateName TemplateName => _templateName.Value; diff --git a/sources/ClangSharp/Types/Type.cs b/sources/ClangSharp/Types/Type.cs index 43067565..ff6b7386 100644 --- a/sources/ClangSharp/Types/Type.cs +++ b/sources/ClangSharp/Types/Type.cs @@ -37,17 +37,17 @@ protected Type(CXType handle, CXTypeKind expectedKind, CX_TypeClass expectedType _translationUnit = new Lazy(() => TranslationUnit.GetOrCreate((CXTranslationUnit)Handle.data[1])); } - public CXXRecordDecl AsCXXRecordDecl => AsTagDecl as CXXRecordDecl; + public CXXRecordDecl? AsCXXRecordDecl => AsTagDecl as CXXRecordDecl; public string AsString => _asString.Value; - public TagDecl AsTagDecl + public TagDecl? AsTagDecl { get { - return GetAs() is TagType tt + return (GetAs() is TagType tt) ? tt.Decl - : (global::ClangSharp.TagDecl)(GetAs() is InjectedClassNameType injected ? injected.Decl : null); + : (ClangSharp.TagDecl?)((GetAs() is InjectedClassNameType injected) ? injected.Decl : null); } } @@ -110,9 +110,9 @@ public Type UnqualifiedDesugaredType } } - public static bool operator ==(Type left, Type right) => (left is not null) ? ((right is not null) && (left.Handle == right.Handle)) : (right is null); + public static bool operator ==(Type? left, Type? right) => (left is not null) ? ((right is not null) && (left.Handle == right.Handle)) : (right is null); - public static bool operator !=(Type left, Type right) => (left is not null) ? ((right is null) || (left.Handle != right.Handle)) : (right is not null); + public static bool operator !=(Type? left, Type? right) => (left is not null) ? ((right is null) || (left.Handle != right.Handle)) : (right is not null); internal static Type Create(CXType handle) => handle.TypeClass switch { CX_TypeClass.CX_TypeClass_Invalid => new Type(handle, handle.kind, handle.TypeClass), @@ -173,9 +173,9 @@ public Type UnqualifiedDesugaredType _ => new Type(handle, handle.kind, handle.TypeClass), }; - public override bool Equals(object obj) => (obj is Type other) && Equals(other); + public override bool Equals(object? obj) => (obj is Type other) && Equals(other); - public bool Equals(Type other) => this == other; + public bool Equals(Type? other) => this == other; public T CastAs() where T : Type @@ -191,12 +191,12 @@ public T CastAs() return (T)UnqualifiedDesugaredType; } - public T GetAs() + public T? GetAs() where T : Type { Debug.Assert(!typeof(ArrayType).IsAssignableFrom(typeof(T)), "ArrayType cannot be used with getAs!"); - return this is T ty ? ty : CanonicalType is not T ? null : (T)UnqualifiedDesugaredType; + return (this is T ty) ? ty : (CanonicalType is not T) ? null : (T)UnqualifiedDesugaredType; } public override int GetHashCode() => Handle.GetHashCode(); diff --git a/sources/ClangSharp/Types/VectorType.cs b/sources/ClangSharp/Types/VectorType.cs index ca7bfe4e..d6d66805 100644 --- a/sources/ClangSharp/Types/VectorType.cs +++ b/sources/ClangSharp/Types/VectorType.cs @@ -9,7 +9,7 @@ public class VectorType : Type { private readonly Lazy _elementType; - internal VectorType(CXType handle) : base(handle, CXTypeKind.CXType_Vector, CX_TypeClass.CX_TypeClass_Vector) + internal VectorType(CXType handle) : this(handle, CXTypeKind.CXType_Vector, CX_TypeClass.CX_TypeClass_Vector) { } diff --git a/sources/ClangSharpPInvokeGenerator/CustomHelpBuilder.cs b/sources/ClangSharpPInvokeGenerator/CustomHelpBuilder.cs index a889b800..ed0a644c 100644 --- a/sources/ClangSharpPInvokeGenerator/CustomHelpBuilder.cs +++ b/sources/ClangSharpPInvokeGenerator/CustomHelpBuilder.cs @@ -24,7 +24,7 @@ public void Write(Option option) { Write(string.Join(", ", option.Aliases)); Write("\t"); - Write(option.Description); + Write(option.Description ?? ""); WriteLine(); } diff --git a/sources/ClangSharpPInvokeGenerator/Program.cs b/sources/ClangSharpPInvokeGenerator/Program.cs index a4118701..26646541 100644 --- a/sources/ClangSharpPInvokeGenerator/Program.cs +++ b/sources/ClangSharpPInvokeGenerator/Program.cs @@ -8,6 +8,7 @@ using System.CommandLine.Invocation; using System.CommandLine.IO; using System.CommandLine.Parsing; +using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; @@ -19,41 +20,42 @@ namespace ClangSharp; public class Program { - private static RootCommand s_rootCommand; - private static Option s_versionOption; - private static Option s_addtionalOption; - private static Option s_configOption; - private static Option s_defineMacros; - private static Option s_excludedNames; - private static Option s_files; - private static Option s_fileDirectory; - private static Option s_headerFile; - private static Option s_includedNames; - private static Option s_includeDirectories; - private static Option s_language; - private static Option s_libraryPath; - private static Option s_methodClassName; - private static Option s_methodPrefixToStrip; - private static Option s_namespaceName; - private static Option s_outputLocation; - private static Option s_outputMode; - private static Option s_remappedNameValuePairs; - private static Option s_std; - private static Option s_testOutputLocation; - private static Option s_traversalNames; - private static Option s_withAccessSpecifierNameValuePairs; - private static Option s_withAttributeNameValuePairs; - private static Option s_withCallConvNameValuePairs; - private static Option s_withClassNameValuePairs; - private static Option s_withGuidNameValuePairs; - private static Option s_withLibraryPathNameValuePairs; - private static Option s_withManualImports; - private static Option s_withNamespaceNameValuePairs; - private static Option s_withSetLastErrors; - private static Option s_withSuppressGCTransitions; - private static Option s_withTransparentStructNameValuePairs; - private static Option s_withTypeNameValuePairs; - private static Option s_withUsingNameValuePairs; + private static readonly RootCommand s_rootCommand; + + private static readonly Option s_versionOption; + private static readonly Option s_addtionalOption; + private static readonly Option s_configOption; + private static readonly Option s_defineMacros; + private static readonly Option s_excludedNames; + private static readonly Option s_files; + private static readonly Option s_fileDirectory; + private static readonly Option s_headerFile; + private static readonly Option s_includedNames; + private static readonly Option s_includeDirectories; + private static readonly Option s_language; + private static readonly Option s_libraryPath; + private static readonly Option s_methodClassName; + private static readonly Option s_methodPrefixToStrip; + private static readonly Option s_namespaceName; + private static readonly Option s_outputLocation; + private static readonly Option s_outputMode; + private static readonly Option s_remappedNameValuePairs; + private static readonly Option s_std; + private static readonly Option s_testOutputLocation; + private static readonly Option s_traversalNames; + private static readonly Option s_withAccessSpecifierNameValuePairs; + private static readonly Option s_withAttributeNameValuePairs; + private static readonly Option s_withCallConvNameValuePairs; + private static readonly Option s_withClassNameValuePairs; + private static readonly Option s_withGuidNameValuePairs; + private static readonly Option s_withLibraryPathNameValuePairs; + private static readonly Option s_withManualImports; + private static readonly Option s_withNamespaceNameValuePairs; + private static readonly Option s_withSetLastErrors; + private static readonly Option s_withSuppressGCTransitions; + private static readonly Option s_withTransparentStructNameValuePairs; + private static readonly Option s_withTypeNameValuePairs; + private static readonly Option s_withUsingNameValuePairs; private static readonly TwoColumnHelpRow[] s_configOptions = new TwoColumnHelpRow[] @@ -121,7 +123,7 @@ public class Program new TwoColumnHelpRow("log-visited-files", "A list of the visited files should be generated. This can help identify traversal issues."), }; - public static async Task Main(params string[] args) + static Program() { s_addtionalOption = GetAdditionalOption(); s_configOption = GetConfigOption(); @@ -157,6 +159,7 @@ public static async Task Main(params string[] args) s_withTransparentStructNameValuePairs = GetWithTransparentStructOption(); s_withTypeNameValuePairs = GetWithTypeOption(); s_withUsingNameValuePairs = GetWithUsingOption(); + s_rootCommand = new RootCommand("ClangSharp P/Invoke Binding Generator") { s_addtionalOption, @@ -195,7 +198,10 @@ public static async Task Main(params string[] args) s_withUsingNameValuePairs }; s_rootCommand.SetHandler(Run); + } + public static async Task Main(params string[] args) + { var parser = new CommandLineBuilder(s_rootCommand) .UseHelp() .UseEnvironmentVariableDirective() @@ -212,45 +218,45 @@ public static async Task Main(params string[] args) public static void Run(InvocationContext context) { - var additionalArgs = context.ParseResult.GetValueForOption(s_addtionalOption); - var configSwitches = context.ParseResult.GetValueForOption(s_configOption); - var defineMacros = context.ParseResult.GetValueForOption(s_defineMacros); - var excludedNames = context.ParseResult.GetValueForOption(s_excludedNames); - var files = context.ParseResult.GetValueForOption(s_files); - var fileDirectory = context.ParseResult.GetValueForOption(s_fileDirectory); - var headerFile = context.ParseResult.GetValueForOption(s_headerFile); - var includedNames = context.ParseResult.GetValueForOption(s_includedNames); - var includeDirectories = context.ParseResult.GetValueForOption(s_includeDirectories); - var language = context.ParseResult.GetValueForOption(s_language); - var libraryPath = context.ParseResult.GetValueForOption(s_libraryPath); - var methodClassName = context.ParseResult.GetValueForOption(s_methodClassName); - var methodPrefixToStrip = context.ParseResult.GetValueForOption(s_methodPrefixToStrip); - var namespaceName = context.ParseResult.GetValueForOption(s_namespaceName); - var outputLocation = context.ParseResult.GetValueForOption(s_outputLocation); + var additionalArgs = context.ParseResult.GetValueForOption(s_addtionalOption) ?? Array.Empty(); + var configSwitches = context.ParseResult.GetValueForOption(s_configOption) ?? Array.Empty(); + var defineMacros = context.ParseResult.GetValueForOption(s_defineMacros) ?? Array.Empty(); + var excludedNames = context.ParseResult.GetValueForOption(s_excludedNames) ?? Array.Empty(); + var files = context.ParseResult.GetValueForOption(s_files) ?? Array.Empty(); + var fileDirectory = context.ParseResult.GetValueForOption(s_fileDirectory) ?? ""; + var headerFile = context.ParseResult.GetValueForOption(s_headerFile) ?? ""; + var includedNames = context.ParseResult.GetValueForOption(s_includedNames) ?? Array.Empty(); + var includeDirectories = context.ParseResult.GetValueForOption(s_includeDirectories) ?? Array.Empty(); + var language = context.ParseResult.GetValueForOption(s_language) ?? ""; + var libraryPath = context.ParseResult.GetValueForOption(s_libraryPath) ?? ""; + var methodClassName = context.ParseResult.GetValueForOption(s_methodClassName) ?? ""; + var methodPrefixToStrip = context.ParseResult.GetValueForOption(s_methodPrefixToStrip) ?? ""; + var namespaceName = context.ParseResult.GetValueForOption(s_namespaceName) ?? ""; + var outputLocation = context.ParseResult.GetValueForOption(s_outputLocation) ?? ""; var outputMode = context.ParseResult.GetValueForOption(s_outputMode); - var remappedNameValuePairs = context.ParseResult.GetValueForOption(s_remappedNameValuePairs); - var std = context.ParseResult.GetValueForOption(s_std); - var testOutputLocation = context.ParseResult.GetValueForOption(s_testOutputLocation); - var traversalNames = context.ParseResult.GetValueForOption(s_traversalNames); - var withAccessSpecifierNameValuePairs = context.ParseResult.GetValueForOption(s_withAccessSpecifierNameValuePairs); - var withAttributeNameValuePairs = context.ParseResult.GetValueForOption(s_withAttributeNameValuePairs); - var withCallConvNameValuePairs = context.ParseResult.GetValueForOption(s_withCallConvNameValuePairs); - var withClassNameValuePairs = context.ParseResult.GetValueForOption(s_withClassNameValuePairs); - var withGuidNameValuePairs = context.ParseResult.GetValueForOption(s_withGuidNameValuePairs); - var withLibraryPathNameValuePairs = context.ParseResult.GetValueForOption(s_withLibraryPathNameValuePairs); - var withManualImports = context.ParseResult.GetValueForOption(s_withManualImports); - var withNamespaceNameValuePairs = context.ParseResult.GetValueForOption(s_withNamespaceNameValuePairs); - var withSetLastErrors = context.ParseResult.GetValueForOption(s_withSetLastErrors); - var withSuppressGCTransitions = context.ParseResult.GetValueForOption(s_withSuppressGCTransitions); - var withTransparentStructNameValuePairs = context.ParseResult.GetValueForOption(s_withTransparentStructNameValuePairs); - var withTypeNameValuePairs = context.ParseResult.GetValueForOption(s_withTypeNameValuePairs); - var withUsingNameValuePairs = context.ParseResult.GetValueForOption(s_withUsingNameValuePairs); + var remappedNameValuePairs = context.ParseResult.GetValueForOption(s_remappedNameValuePairs) ?? Array.Empty(); + var std = context.ParseResult.GetValueForOption(s_std) ?? ""; + var testOutputLocation = context.ParseResult.GetValueForOption(s_testOutputLocation) ?? ""; + var traversalNames = context.ParseResult.GetValueForOption(s_traversalNames) ?? Array.Empty(); + var withAccessSpecifierNameValuePairs = context.ParseResult.GetValueForOption(s_withAccessSpecifierNameValuePairs) ?? Array.Empty(); + var withAttributeNameValuePairs = context.ParseResult.GetValueForOption(s_withAttributeNameValuePairs) ?? Array.Empty(); + var withCallConvNameValuePairs = context.ParseResult.GetValueForOption(s_withCallConvNameValuePairs) ?? Array.Empty(); + var withClassNameValuePairs = context.ParseResult.GetValueForOption(s_withClassNameValuePairs) ?? Array.Empty(); + var withGuidNameValuePairs = context.ParseResult.GetValueForOption(s_withGuidNameValuePairs) ?? Array.Empty(); + var withLibraryPathNameValuePairs = context.ParseResult.GetValueForOption(s_withLibraryPathNameValuePairs) ?? Array.Empty(); + var withManualImports = context.ParseResult.GetValueForOption(s_withManualImports) ?? Array.Empty(); + var withNamespaceNameValuePairs = context.ParseResult.GetValueForOption(s_withNamespaceNameValuePairs) ?? Array.Empty(); + var withSetLastErrors = context.ParseResult.GetValueForOption(s_withSetLastErrors) ?? Array.Empty(); + var withSuppressGCTransitions = context.ParseResult.GetValueForOption(s_withSuppressGCTransitions) ?? Array.Empty(); + var withTransparentStructNameValuePairs = context.ParseResult.GetValueForOption(s_withTransparentStructNameValuePairs) ?? Array.Empty(); + var withTypeNameValuePairs = context.ParseResult.GetValueForOption(s_withTypeNameValuePairs) ?? Array.Empty(); + var withUsingNameValuePairs = context.ParseResult.GetValueForOption(s_withUsingNameValuePairs) ?? Array.Empty(); var versionResult = context.ParseResult.FindResultFor(s_versionOption); if (versionResult is not null) { - context.Console.WriteLine($"{s_rootCommand.Description} version 14.0.0"); + context.Console.WriteLine($"{s_rootCommand.Description} version 15.0.0"); context.Console.WriteLine($" {clang.getClangVersion()}"); context.Console.WriteLine($" {clangsharp.getVersion()}"); context.ExitCode = -1; @@ -721,8 +727,9 @@ public static void Run(InvocationContext context) try { using var translationUnit = TranslationUnit.GetOrCreate(handle); - context.Console.WriteLine($"Processing '{filePath}'"); + Debug.Assert(translationUnit is not null); + context.Console.WriteLine($"Processing '{filePath}'"); pinvokeGenerator.GenerateBindings(translationUnit, filePath, clangCommandLineArgs, translationFlags); } catch (Exception e) @@ -928,7 +935,7 @@ private static Option GetAdditionalOption() private static Option GetConfigOption() { - return s_configOption = new Option( + return new Option( aliases: new string[] { "--config", "-c" }, description: "A configuration option that controls how the bindings are generated. Specify 'help' to see the available options.", getDefaultValue: Array.Empty diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionDeclarationBodyImportTest.cs index 437e9c89..609ec4d4 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionDeclarationDllImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionDeclarationDllImportTest.cs index de30ecd2..ca9f676d 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionDeclarationDllImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleUnix/FunctionDeclarationDllImportTest.cs @@ -1,6 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Threading.Tasks; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/FunctionDeclarationBodyImportTest.cs index 9d3828dc..1b35a972 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpCompatibleWindows/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/FunctionDeclarationBodyImportTest.cs index e1a9d5f8..14959925 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestUnix/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/FunctionDeclarationBodyImportTest.cs index 7f40760f..e2cb4998 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpLatestWindows/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/FunctionDeclarationBodyImportTest.cs index 2547f373..56bd15db 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewUnix/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/FunctionDeclarationBodyImportTest.cs index 2e278425..8e028231 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/CSharpPreviewWindows/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/PInvokeGeneratorTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/PInvokeGeneratorTest.cs index 0d18c900..fab038cf 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/PInvokeGeneratorTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/PInvokeGeneratorTest.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using System.Threading.Tasks; @@ -37,43 +38,43 @@ public abstract class PInvokeGeneratorTest protected static string EscapeXml(string value) => new XText(value).ToString(); - protected static Task ValidateGeneratedCSharpPreviewWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null) + protected static Task ValidateGeneratedCSharpPreviewWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null) => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.CSharp, PInvokeGeneratorConfigurationOptions.GeneratePreviewCode | PInvokeGeneratorConfigurationOptions.None | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs); - protected static Task ValidateGeneratedCSharpPreviewUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null) + protected static Task ValidateGeneratedCSharpPreviewUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null) => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.CSharp, PInvokeGeneratorConfigurationOptions.GeneratePreviewCode | PInvokeGeneratorConfigurationOptions.GenerateUnixTypes | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs); - protected static Task ValidateGeneratedCSharpLatestWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null) + protected static Task ValidateGeneratedCSharpLatestWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null) => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.CSharp, PInvokeGeneratorConfigurationOptions.None | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs); - protected static Task ValidateGeneratedCSharpLatestUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null) + protected static Task ValidateGeneratedCSharpLatestUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null) => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.CSharp, PInvokeGeneratorConfigurationOptions.GenerateUnixTypes | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs); - protected static Task ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null) + protected static Task ValidateGeneratedCSharpCompatibleWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null) => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.CSharp, PInvokeGeneratorConfigurationOptions.GenerateCompatibleCode | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs); - protected static Task ValidateGeneratedCSharpCompatibleUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null) + protected static Task ValidateGeneratedCSharpCompatibleUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null) => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.CSharp, PInvokeGeneratorConfigurationOptions.GenerateCompatibleCode | PInvokeGeneratorConfigurationOptions.GenerateUnixTypes | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs); - protected static Task ValidateGeneratedXmlPreviewWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null, [CallerFilePath] string filePath = "") + protected static Task ValidateGeneratedXmlPreviewWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null, [CallerFilePath] string filePath = "") => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.Xml, PInvokeGeneratorConfigurationOptions.GeneratePreviewCode | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs, filePath); - protected static Task ValidateGeneratedXmlPreviewUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null) + protected static Task ValidateGeneratedXmlPreviewUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null) => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.Xml, PInvokeGeneratorConfigurationOptions.GeneratePreviewCode | PInvokeGeneratorConfigurationOptions.GenerateUnixTypes | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs); - protected static Task ValidateGeneratedXmlLatestWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null, [CallerFilePath] string filePath = "") + protected static Task ValidateGeneratedXmlLatestWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null, [CallerFilePath] string filePath = "") => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.Xml, PInvokeGeneratorConfigurationOptions.None | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs, filePath); - protected static Task ValidateGeneratedXmlLatestUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null) + protected static Task ValidateGeneratedXmlLatestUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null) => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.Xml, PInvokeGeneratorConfigurationOptions.GenerateUnixTypes | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs); - protected static Task ValidateGeneratedXmlCompatibleWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null) + protected static Task ValidateGeneratedXmlCompatibleWindowsBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null) => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.Xml, PInvokeGeneratorConfigurationOptions.GenerateCompatibleCode | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs); - protected static Task ValidateGeneratedXmlCompatibleUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[] excludedNames = null, IReadOnlyDictionary remappedNames = null, IReadOnlyDictionary withAccessSpecifiers = null, IReadOnlyDictionary> withAttributes = null, IReadOnlyDictionary withCallConvs = null, IReadOnlyDictionary withClasses = null, IReadOnlyDictionary withLibraryPaths = null, IReadOnlyDictionary withNamespaces = null, string[] withSetLastErrors = null, IReadOnlyDictionary withTransparentStructs = null, IReadOnlyDictionary withTypes = null, IReadOnlyDictionary> withUsings = null, IEnumerable expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[] commandlineArgs = null) + protected static Task ValidateGeneratedXmlCompatibleUnixBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorConfigurationOptions additionalConfigOptions = PInvokeGeneratorConfigurationOptions.None, string[]? excludedNames = null, IReadOnlyDictionary? remappedNames = null, IReadOnlyDictionary? withAccessSpecifiers = null, IReadOnlyDictionary>? withAttributes = null, IReadOnlyDictionary? withCallConvs = null, IReadOnlyDictionary? withClasses = null, IReadOnlyDictionary? withLibraryPaths = null, IReadOnlyDictionary? withNamespaces = null, string[]? withSetLastErrors = null, IReadOnlyDictionary? withTransparentStructs = null, IReadOnlyDictionary? withTypes = null, IReadOnlyDictionary>? withUsings = null, IEnumerable? expectedDiagnostics = null, string libraryPath = DefaultLibraryPath, string[]? commandlineArgs = null) => ValidateGeneratedBindingsAsync(inputContents, expectedOutputContents, PInvokeGeneratorOutputMode.Xml, PInvokeGeneratorConfigurationOptions.GenerateCompatibleCode | PInvokeGeneratorConfigurationOptions.GenerateUnixTypes | additionalConfigOptions, excludedNames, remappedNames, withAccessSpecifiers, withAttributes, withCallConvs, withClasses, withLibraryPaths, withNamespaces, withSetLastErrors, withTransparentStructs, withTypes, withUsings, expectedDiagnostics, libraryPath, commandlineArgs); - private static async Task ValidateGeneratedBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorOutputMode outputMode, PInvokeGeneratorConfigurationOptions configOptions, string[] excludedNames, IReadOnlyDictionary remappedNames, IReadOnlyDictionary withAccessSpecifiers, IReadOnlyDictionary> withAttributes, IReadOnlyDictionary withCallConvs, IReadOnlyDictionary withClasses, IReadOnlyDictionary withLibraryPaths, IReadOnlyDictionary withNamespaces, string[] withSetLastErrors, IReadOnlyDictionary withTransparentStructs, IReadOnlyDictionary withTypes, IReadOnlyDictionary> withUsings, IEnumerable expectedDiagnostics, string libraryPath, string[] commandlineArgs, [CallerFilePath] string filePath = "") + private static async Task ValidateGeneratedBindingsAsync(string inputContents, string expectedOutputContents, PInvokeGeneratorOutputMode outputMode, PInvokeGeneratorConfigurationOptions configOptions, string[]? excludedNames, IReadOnlyDictionary? remappedNames, IReadOnlyDictionary? withAccessSpecifiers, IReadOnlyDictionary>? withAttributes, IReadOnlyDictionary? withCallConvs, IReadOnlyDictionary? withClasses, IReadOnlyDictionary? withLibraryPaths, IReadOnlyDictionary? withNamespaces, string[]? withSetLastErrors, IReadOnlyDictionary? withTransparentStructs, IReadOnlyDictionary? withTypes, IReadOnlyDictionary>? withUsings, IEnumerable? expectedDiagnostics, string libraryPath, string[]? commandlineArgs, [CallerFilePath] string filePath = "") { Assert.True(File.Exists(DefaultInputFileName)); commandlineArgs ??= DefaultCppClangCommandLineArgs; @@ -110,7 +111,9 @@ private static async Task ValidateGeneratedBindingsAsync(string inputContents, s using (var pinvokeGenerator = new PInvokeGenerator(config, (path) => outputStream)) { var handle = CXTranslationUnit.Parse(pinvokeGenerator.IndexHandle, DefaultInputFileName, commandlineArgs, unsavedFiles, DefaultTranslationUnitFlags); + using var translationUnit = TranslationUnit.GetOrCreate(handle); + Debug.Assert(translationUnit is not null); pinvokeGenerator.GenerateBindings(translationUnit, DefaultInputFileName, commandlineArgs, DefaultTranslationUnitFlags); diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/FunctionDeclarationBodyImportTest.cs index 87fb5a44..deee56dc 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleUnix/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/FunctionDeclarationBodyImportTest.cs index 8d5584ab..41a052a1 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlCompatibleWindows/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/FunctionDeclarationBodyImportTest.cs index 8ee0119a..fc1f578e 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestUnix/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/FunctionDeclarationBodyImportTest.cs index e5f505e7..ba49c8a5 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlLatestWindows/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/FunctionDeclarationBodyImportTest.cs index bb0b76f6..c5948562 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewUnix/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/FunctionDeclarationBodyImportTest.cs b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/FunctionDeclarationBodyImportTest.cs index 143b7360..d17f8bac 100644 --- a/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/FunctionDeclarationBodyImportTest.cs +++ b/tests/ClangSharp.PInvokeGenerator.UnitTests/XmlPreviewWindows/FunctionDeclarationBodyImportTest.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Runtime.InteropServices; using System.Threading.Tasks; namespace ClangSharp.UnitTests; diff --git a/tests/ClangSharp.UnitTests/CXModuleMapDescriptorTest.cs b/tests/ClangSharp.UnitTests/CXModuleMapDescriptorTest.cs index 6c68808b..1a1700a8 100644 --- a/tests/ClangSharp.UnitTests/CXModuleMapDescriptorTest.cs +++ b/tests/ClangSharp.UnitTests/CXModuleMapDescriptorTest.cs @@ -1,6 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; using ClangSharp.Interop; using NUnit.Framework; diff --git a/tests/ClangSharp.UnitTests/CXVirtualFileOverlayTest.cs b/tests/ClangSharp.UnitTests/CXVirtualFileOverlayTest.cs index 63811443..eb9134b8 100644 --- a/tests/ClangSharp.UnitTests/CXVirtualFileOverlayTest.cs +++ b/tests/ClangSharp.UnitTests/CXVirtualFileOverlayTest.cs @@ -18,10 +18,10 @@ public class TestVFO : IDisposable { public CXVirtualFileOverlay VFO; - private readonly string _contents; + private readonly string? _contents; private bool _isDisposed = false; - public TestVFO(string contents) + public TestVFO(string? contents) { VFO = CXVirtualFileOverlay.Create(options: 0); _contents = Fix(contents); @@ -32,7 +32,7 @@ public TestVFO(string contents) Dispose(isDisposing: false); } - public void Map(string vPath, string rPath) + public void Map(string? vPath, string? rPath) { vPath = Fix(vPath); rPath = Fix(rPath); @@ -41,7 +41,7 @@ public void Map(string vPath, string rPath) Assert.AreEqual(CXErrorCode.CXError_Success, err); } - public void MapError(string vPath, string rPath, CXErrorCode expErr) + public void MapError(string? vPath, string? rPath, CXErrorCode expErr) { vPath = Fix(vPath); rPath = Fix(rPath); @@ -50,7 +50,7 @@ public void MapError(string vPath, string rPath, CXErrorCode expErr) Assert.AreEqual(expErr, err); } - private static string Fix(string text) + private static string? Fix(string? text) { if (text is null) { From 1aa43d8367f0b555c7742d72868c011ea4b733fc Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Sat, 17 Sep 2022 21:04:24 -0700 Subject: [PATCH 5/6] A couple small fixups to ensure bindings generate correctly --- sources/ClangSharp.Interop/ClangSharp.Interop.csproj | 2 ++ .../ClangSharp.Interop/Extensions/CXEvalResult.cs | 3 +-- sources/ClangSharp.Interop/Extensions/CXString.cs | 3 +-- .../Extensions/CXTUResourceUsageEntry.cs | 5 +---- .../ClangSharp.Interop/Extensions/CXUnsavedFile.cs | 3 +-- .../ClangSharp.Interop/Internals/SpanExtensions.cs | 12 ++++++++++++ .../ClangSharp.Interop/{Internals => Shims}/Index.cs | 2 -- .../ClangSharp.Interop/{Internals => Shims}/Range.cs | 2 -- sources/ClangSharp.PInvokeGenerator/Diagnostic.cs | 2 +- .../Extensions/StringExtensions.cs | 3 +++ .../PInvokeGenerator.VisitDecl.cs | 6 ++++-- .../ClangSharp.PInvokeGenerator/PInvokeGenerator.cs | 6 +++--- .../PInvokeGeneratorConfiguration.cs | 4 +--- sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs | 2 -- .../ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs | 1 - sources/ClangSharp/Cursors/Exprs/OffsetOfExpr.cs | 6 +++--- .../Cursors/Exprs/SYCLUniqueStableNameExpr.cs | 2 -- .../Cursors/Stmts/OMPLoopTransformationDirective.cs | 1 - sources/ClangSharp/Cursors/Stmts/Stmt.cs | 11 ++++++----- .../ClangSharpPInvokeGenerator.csproj | 4 ++-- .../ClangSharpPInvokeGenerator/CustomHelpBuilder.cs | 3 +-- sources/ClangSharpPInvokeGenerator/Program.cs | 2 +- 22 files changed, 43 insertions(+), 42 deletions(-) rename sources/ClangSharp.Interop/{Internals => Shims}/Index.cs (98%) rename sources/ClangSharp.Interop/{Internals => Shims}/Range.cs (98%) diff --git a/sources/ClangSharp.Interop/ClangSharp.Interop.csproj b/sources/ClangSharp.Interop/ClangSharp.Interop.csproj index 1dc7232a..75455540 100644 --- a/sources/ClangSharp.Interop/ClangSharp.Interop.csproj +++ b/sources/ClangSharp.Interop/ClangSharp.Interop.csproj @@ -12,7 +12,9 @@ + + diff --git a/sources/ClangSharp.Interop/Extensions/CXEvalResult.cs b/sources/ClangSharp.Interop/Extensions/CXEvalResult.cs index a0f7bcc4..a7f2c23c 100644 --- a/sources/ClangSharp.Interop/Extensions/CXEvalResult.cs +++ b/sources/ClangSharp.Interop/Extensions/CXEvalResult.cs @@ -28,8 +28,7 @@ public string AsStr return string.Empty; } - var span = new ReadOnlySpan(pStr, int.MaxValue); - return span.Slice(0, span.IndexOf((byte)'\0')).AsString(); + return SpanExtensions.AsString(pStr); } } diff --git a/sources/ClangSharp.Interop/Extensions/CXString.cs b/sources/ClangSharp.Interop/Extensions/CXString.cs index b1c76dfa..fbd33795 100644 --- a/sources/ClangSharp.Interop/Extensions/CXString.cs +++ b/sources/ClangSharp.Interop/Extensions/CXString.cs @@ -54,8 +54,7 @@ public string CString return string.Empty; } - var span = new ReadOnlySpan(pCString, int.MaxValue); - return span.Slice(0, span.IndexOf((byte)'\0')).AsString(); + return SpanExtensions.AsString(pCString); } } diff --git a/sources/ClangSharp.Interop/Extensions/CXTUResourceUsageEntry.cs b/sources/ClangSharp.Interop/Extensions/CXTUResourceUsageEntry.cs index e3b7c657..eb00a1b8 100644 --- a/sources/ClangSharp.Interop/Extensions/CXTUResourceUsageEntry.cs +++ b/sources/ClangSharp.Interop/Extensions/CXTUResourceUsageEntry.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; - namespace ClangSharp.Interop; public unsafe partial struct CXTUResourceUsageEntry @@ -17,8 +15,7 @@ public string Name return string.Empty; } - var span = new ReadOnlySpan(pName, int.MaxValue); - return span.Slice(0, span.IndexOf((byte)'\0')).AsString(); + return SpanExtensions.AsString(pName); } } diff --git a/sources/ClangSharp.Interop/Extensions/CXUnsavedFile.cs b/sources/ClangSharp.Interop/Extensions/CXUnsavedFile.cs index a6676daa..2a14565b 100644 --- a/sources/ClangSharp.Interop/Extensions/CXUnsavedFile.cs +++ b/sources/ClangSharp.Interop/Extensions/CXUnsavedFile.cs @@ -77,8 +77,7 @@ public string FilenameString return string.Empty; } - var span = new ReadOnlySpan(pFilename, int.MaxValue); - return span.Slice(0, span.IndexOf((byte)'\0')).AsString(); + return SpanExtensions.AsString(pFilename); } } } diff --git a/sources/ClangSharp.Interop/Internals/SpanExtensions.cs b/sources/ClangSharp.Interop/Internals/SpanExtensions.cs index 52c6592f..a69a8c94 100644 --- a/sources/ClangSharp.Interop/Internals/SpanExtensions.cs +++ b/sources/ClangSharp.Interop/Internals/SpanExtensions.cs @@ -1,12 +1,24 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. using System; +using System.Runtime.InteropServices; using System.Text; namespace ClangSharp.Interop; public static unsafe class SpanExtensions { + public static string AsString(sbyte* pStr) + { +#if NET6_0_OR_GREATER + var span = MemoryMarshal.CreateReadOnlySpanFromNullTerminated((byte*)(pStr)); +#else + var span = new ReadOnlySpan(pStr, int.MaxValue); + span = span.Slice(0, span.IndexOf((byte)'\0')); +#endif + return span.AsString(); + } + public static string AsString(this Span self) => AsString((ReadOnlySpan)self); public static string AsString(this ReadOnlySpan self) diff --git a/sources/ClangSharp.Interop/Internals/Index.cs b/sources/ClangSharp.Interop/Shims/Index.cs similarity index 98% rename from sources/ClangSharp.Interop/Internals/Index.cs rename to sources/ClangSharp.Interop/Shims/Index.cs index bd5a75a0..c4babe8b 100644 --- a/sources/ClangSharp.Interop/Internals/Index.cs +++ b/sources/ClangSharp.Interop/Shims/Index.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if NETSTANDARD2_0 using System.Runtime.CompilerServices; namespace System; @@ -63,4 +62,3 @@ public int GetOffset(int length) private string ToStringFromEnd() => '^' + Value.ToString(); } -#endif diff --git a/sources/ClangSharp.Interop/Internals/Range.cs b/sources/ClangSharp.Interop/Shims/Range.cs similarity index 98% rename from sources/ClangSharp.Interop/Internals/Range.cs rename to sources/ClangSharp.Interop/Shims/Range.cs index 20559031..a8e9e734 100644 --- a/sources/ClangSharp.Interop/Internals/Range.cs +++ b/sources/ClangSharp.Interop/Shims/Range.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#if NETSTANDARD2_0 using System.Runtime.CompilerServices; namespace System; @@ -51,4 +50,3 @@ value is Range r && : (start, end - start); } } -#endif diff --git a/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs b/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs index dafa06c2..6b36ea35 100644 --- a/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs +++ b/sources/ClangSharp.PInvokeGenerator/Diagnostic.cs @@ -15,7 +15,7 @@ public Diagnostic(DiagnosticLevel level, string message) : this(level, message, { } - public Diagnostic(DiagnosticLevel level, string message, CXSourceLocation location) : this(level, message, location.ToString().Replace('\\', '/')) + public Diagnostic(DiagnosticLevel level, string message, CXSourceLocation location) : this(level, message, location.ToString().NormalizePath()) { } diff --git a/sources/ClangSharp.PInvokeGenerator/Extensions/StringExtensions.cs b/sources/ClangSharp.PInvokeGenerator/Extensions/StringExtensions.cs index 16c86bd1..a84497cf 100644 --- a/sources/ClangSharp.PInvokeGenerator/Extensions/StringExtensions.cs +++ b/sources/ClangSharp.PInvokeGenerator/Extensions/StringExtensions.cs @@ -13,6 +13,9 @@ public static string Unquote(this string str) ? str[1..^1] : str; + public static string NormalizePath(this string str) + => str.Replace('\\', '/').Replace("//", "/"); + public static string AsString(this AccessSpecifier value) => value switch { AccessSpecifier.Public => "public", AccessSpecifier.Protected => "protected", diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs index 3482ddcf..8fa6608b 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.VisitDecl.cs @@ -3,13 +3,11 @@ using System; using System.Collections.Generic; using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using System.Runtime.InteropServices; using System.Text; using ClangSharp.Abstractions; -using ClangSharp.CSharp; using ClangSharp.Interop; namespace ClangSharp; @@ -3252,6 +3250,10 @@ private void VisitVarDecl(VarDecl varDecl) return; } } + else if (IsStmtAsWritten(varDecl.Init, out var recoveryExpr, removeParens: true)) + { + return; + } } var openedOutputBuilder = false; diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs index 1a457afb..4a7d709d 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs @@ -2154,7 +2154,7 @@ private string GetCursorName(NamedDecl namedDecl) { if (!_cursorNames.TryGetValue(namedDecl, out var name)) { - name = namedDecl.Name.Replace('\\', '/'); + name = namedDecl.Name.NormalizePath(); if (namedDecl is CXXConstructorDecl cxxConstructorDecl) { @@ -2864,7 +2864,7 @@ private string GetTypeName(Cursor? cursor, Cursor? context, Type rootType, Type { if (!_typeNames.TryGetValue((cursor, context, type), out var result)) { - result.typeName = type.AsString.Replace('\\', '/'); + result.typeName = type.AsString.NormalizePath(); if (result.typeName.Contains("unnamed struct at")) { @@ -4224,7 +4224,7 @@ bool IsIncludedFileOrLocation(Cursor cursor, CXFile file, CXSourceLocation locat var equalityComparer = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? StringComparer.OrdinalIgnoreCase : StringComparer.Ordinal; // Normalize paths to be '/' for comparison - var fileName = file.Name.ToString().Replace('\\', '/'); + var fileName = file.Name.ToString().NormalizePath(); if (_visitedFiles.Add(fileName) && _config.LogVisitedFiles) { diff --git a/sources/ClangSharp.PInvokeGenerator/PInvokeGeneratorConfiguration.cs b/sources/ClangSharp.PInvokeGenerator/PInvokeGeneratorConfiguration.cs index 4c088851..bf937dcc 100644 --- a/sources/ClangSharp.PInvokeGenerator/PInvokeGeneratorConfiguration.cs +++ b/sources/ClangSharp.PInvokeGenerator/PInvokeGeneratorConfiguration.cs @@ -326,7 +326,7 @@ public IReadOnlyCollection TraversalNames init { - AddRange(_traversalNames, value, NormalizePathSeparators); + AddRange(_traversalNames, value, StringExtensions.NormalizePath); } } @@ -606,8 +606,6 @@ private static void AddRange(SortedSet hashSet, IEnumerable value.Replace('\\', '/'); - private static string RemoveAtPrefix(string value) => ValueStartsWithAt(value) ? value[1..] : value; private static (string, PInvokeGeneratorTransparentStructKind) RemoveAtPrefix((string Name, PInvokeGeneratorTransparentStructKind Kind) value) => (ValueStartsWithAt(value.Name) ? value.Name[1..] : value.Name, value.Kind); diff --git a/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs b/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs index 47b74dc0..4fc35d8c 100644 --- a/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs +++ b/sources/ClangSharp/Cursors/Decls/CXXMethodDecl.cs @@ -2,8 +2,6 @@ using System; using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; using ClangSharp.Interop; namespace ClangSharp; diff --git a/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs b/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs index e6ca25d5..6a5359a6 100644 --- a/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/CXXMemberCallExpr.cs @@ -1,6 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System.Diagnostics; using ClangSharp.Interop; namespace ClangSharp; diff --git a/sources/ClangSharp/Cursors/Exprs/OffsetOfExpr.cs b/sources/ClangSharp/Cursors/Exprs/OffsetOfExpr.cs index 4f7ce6f4..1c32dd35 100644 --- a/sources/ClangSharp/Cursors/Exprs/OffsetOfExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/OffsetOfExpr.cs @@ -10,13 +10,13 @@ namespace ClangSharp; public sealed class OffsetOfExpr : Expr { private readonly Lazy> _indexExprs; - private readonly Lazy _referenced; + private readonly Lazy _referenced; private readonly Lazy _typeSourceInfoType; internal OffsetOfExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_UnexposedExpr, CX_StmtClass.CX_StmtClass_OffsetOfExpr) { _indexExprs = new Lazy>(() => Children.Cast().ToList()); - _referenced = new Lazy(() => TranslationUnit.GetOrCreate(Handle.Referenced)); + _referenced = new Lazy(() => !Handle.Referenced.IsNull ? TranslationUnit.GetOrCreate(Handle.Referenced) : null); _typeSourceInfoType = new Lazy(() => TranslationUnit.GetOrCreate(Handle.TypeOperand)); } @@ -24,7 +24,7 @@ internal OffsetOfExpr(CXCursor handle) : base(handle, CXCursorKind.CXCursor_Unex public uint NumExpressions => NumChildren; - public Cursor Referenced => _referenced.Value; + public Cursor? Referenced => _referenced.Value; public Type TypeSourceInfoType => _typeSourceInfoType.Value; } diff --git a/sources/ClangSharp/Cursors/Exprs/SYCLUniqueStableNameExpr.cs b/sources/ClangSharp/Cursors/Exprs/SYCLUniqueStableNameExpr.cs index 1244a847..804a1c33 100644 --- a/sources/ClangSharp/Cursors/Exprs/SYCLUniqueStableNameExpr.cs +++ b/sources/ClangSharp/Cursors/Exprs/SYCLUniqueStableNameExpr.cs @@ -1,7 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; -using System.Diagnostics; using ClangSharp.Interop; namespace ClangSharp; diff --git a/sources/ClangSharp/Cursors/Stmts/OMPLoopTransformationDirective.cs b/sources/ClangSharp/Cursors/Stmts/OMPLoopTransformationDirective.cs index 2e2fbcee..98f10e67 100644 --- a/sources/ClangSharp/Cursors/Stmts/OMPLoopTransformationDirective.cs +++ b/sources/ClangSharp/Cursors/Stmts/OMPLoopTransformationDirective.cs @@ -1,6 +1,5 @@ // Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT). See License.md in the repository root for more information. -using System; using ClangSharp.Interop; namespace ClangSharp; diff --git a/sources/ClangSharp/Cursors/Stmts/Stmt.cs b/sources/ClangSharp/Cursors/Stmts/Stmt.cs index 0ce01689..086f00b2 100644 --- a/sources/ClangSharp/Cursors/Stmts/Stmt.cs +++ b/sources/ClangSharp/Cursors/Stmts/Stmt.cs @@ -9,7 +9,7 @@ namespace ClangSharp; public class Stmt : Cursor { - private readonly Lazy> _children; + private readonly Lazy> _children; private readonly Lazy _declContext; private protected Stmt(CXCursor handle, CXCursorKind expectedCursorKind, CX_StmtClass expectedStmtClass) : base(handle, expectedCursorKind) @@ -19,13 +19,14 @@ private protected Stmt(CXCursor handle, CXCursorKind expectedCursorKind, CX_Stmt throw new ArgumentOutOfRangeException(nameof(handle)); } - _children = new Lazy>(() => { + _children = new Lazy>(() => { var numChildren = Handle.NumChildren; - var children = new List(numChildren); + var children = new List(numChildren); for (var i = 0; i < numChildren; i++) { - var child = TranslationUnit.GetOrCreate(Handle.GetChild(unchecked((uint)i))); + var childHandle = Handle.GetChild(unchecked((uint)i)); + var child = !childHandle.IsNull ? TranslationUnit.GetOrCreate(childHandle) : null; children.Add(child); } @@ -45,7 +46,7 @@ private protected Stmt(CXCursor handle, CXCursorKind expectedCursorKind, CX_Stmt }); } - public IReadOnlyList Children => _children.Value; + public IReadOnlyList Children => _children.Value!; public IDeclContext DeclContext => _declContext.Value; diff --git a/sources/ClangSharpPInvokeGenerator/ClangSharpPInvokeGenerator.csproj b/sources/ClangSharpPInvokeGenerator/ClangSharpPInvokeGenerator.csproj index 26d13ac9..891e1551 100644 --- a/sources/ClangSharpPInvokeGenerator/ClangSharpPInvokeGenerator.csproj +++ b/sources/ClangSharpPInvokeGenerator/ClangSharpPInvokeGenerator.csproj @@ -22,7 +22,7 @@ - + @@ -38,7 +38,7 @@ C:\Program Files\LLVM\include - /usr/lib/llvm-13/include + /usr/lib/llvm-15/include diff --git a/sources/ClangSharpPInvokeGenerator/CustomHelpBuilder.cs b/sources/ClangSharpPInvokeGenerator/CustomHelpBuilder.cs index ed0a644c..ab33ad08 100644 --- a/sources/ClangSharpPInvokeGenerator/CustomHelpBuilder.cs +++ b/sources/ClangSharpPInvokeGenerator/CustomHelpBuilder.cs @@ -13,8 +13,7 @@ internal sealed class CustomHelpBuilder : HelpBuilder { private IConsole Console { get; } - public CustomHelpBuilder(IConsole console, LocalizationResources localizationResources, - int maxWidth = int.MaxValue) + public CustomHelpBuilder(IConsole console, LocalizationResources localizationResources, int maxWidth = int.MaxValue) : base(localizationResources, maxWidth) { Console = console; diff --git a/sources/ClangSharpPInvokeGenerator/Program.cs b/sources/ClangSharpPInvokeGenerator/Program.cs index 26646541..87e500d3 100644 --- a/sources/ClangSharpPInvokeGenerator/Program.cs +++ b/sources/ClangSharpPInvokeGenerator/Program.cs @@ -197,7 +197,7 @@ static Program() s_withTypeNameValuePairs, s_withUsingNameValuePairs }; - s_rootCommand.SetHandler(Run); + Handler.SetHandler(s_rootCommand, (Action)Run); } public static async Task Main(params string[] args) From b07f9050957123020a61351f2542126b7a28e357 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Sat, 17 Sep 2022 22:25:25 -0700 Subject: [PATCH 6/6] Don't publish as trimmed when packing as a tool --- Directory.Build.targets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Build.targets b/Directory.Build.targets index 4215864b..ee04b707 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -21,7 +21,7 @@ - + true