Update QIR generation to LLVM 13, add multiplatform CI validation (#1329)

* Rework LlvmBindings to use custom interop, LLVM 13 (#1301)

* Rework LlvmBindings to use custom interop, LLVM 13

This change updates the LlvmBindings package to use the custom LLVM binaries and generated C# from the LLVM pipeline. This allows us to eliminate the dependency on LLVMSharp and control the surface area and LLVM version we use. It also includes all test updates to use LLVM 13 compatible output.

* Ensure native libs included in package

* Clean up dependency, PR feedback

* Add multiplatform testing to feature/llvm13 (#1304)

* Add multiplatform validation of compiler repo

* skip VS Extension in build script

* Use LlvmBindings MCJIT for execution

* Simplify devcontainer

* Updates for CR feedback

* More CR feedback

* Fix copyright on copied files (#1331)
This commit is contained in:
Stefan J. Wernli 2022-02-02 20:28:39 -08:00 коммит произвёл GitHub
Родитель 35973a1786
Коммит 48ee0cac98
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
294 изменённых файлов: 5621 добавлений и 1503 удалений

Просмотреть файл

@ -1,10 +1,3 @@
FROM mcr.microsoft.com/dotnet/core/sdk:3.1-focal
FROM mcr.microsoft.com/vscode/devcontainers/universal:1-linux
# Mono is required to run pack.ps1, so we install it here.
RUN apt-get -y update && \
apt-get -y install dirmngr gnupg apt-transport-https ca-certificates && \
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF && \
sh -c 'echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" > /etc/apt/sources.list.d/mono-official-stable.list' && \
apt-get -y update && \
apt-get -y install --no-install-recommends mono-complete nuget && \
apt-get clean && rm -rf /var/lib/apt/lists/
USER codespace

Просмотреть файл

@ -78,4 +78,4 @@ Push-Location (Join-Path $PSScriptRoot 'src/QsCompiler/CSharpGeneration')
Pop-Location
Push-Location (Join-Path $PSScriptRoot 'src/QsCompiler/QirGeneration')
.\FindNuspecReferences.ps1;
Pop-Location
Pop-Location

Просмотреть файл

@ -7,13 +7,6 @@ $ErrorActionPreference = 'Stop'
$all_ok = $True
Write-Host "Assembly version: $Env:ASSEMBLY_VERSION"
choco install llvm --version=11.1.0 --allow-downgrade
if (!(Get-Command clang -ErrorAction SilentlyContinue) -and (choco find --idonly -l llvm) -contains "llvm") {
# For some reason, adding to the path does not work on our build servers, even after calling refreshenv.
# LLVM was installed by Chocolatey, so add the install location to the path.
$env:PATH += ";$($env:SystemDrive)\Program Files\LLVM\bin"
}
##
# Q# compiler and Sdk tools
##
@ -145,7 +138,7 @@ Build-One '../src/QuantumSdk/Tools/Tools.sln'
Build-One '../src/Telemetry/Telemetry.sln'
Build-One '../QsFmt.sln'
if ($Env:ENABLE_VSIX -ne "false") {
if ($Env:ENABLE_VSIX -ne "false" -and $IsWindows) {
Build-VSCode
Build-VS
} else {

Просмотреть файл

@ -33,8 +33,16 @@ jobs:
- template: init.yml
- template: steps.yml
- template: wrap-up.yml
pool:
vmImage: windows-latest
strategy:
matrix:
linux:
imageName: 'ubuntu-latest'
mac:
imageName: 'macOS-latest'
windows:
imageName: 'windows-latest'
pool:
vmImage: $(imageName)
- job: Style

Просмотреть файл

@ -16,14 +16,14 @@ steps:
versionSpec: 5.8.1
- task: UseDotNet@2
displayName: Use .NET SDK 5.0.102
displayName: Use .NET SDK 5.0.404
inputs:
version: 5.0.102
version: 5.0.404
- task: UseDotNet@2
displayName: Use .NET Core SDK 3.1.405
displayName: Use .NET Core SDK 3.1.416
inputs:
version: 3.1.405
version: 3.1.416
# Make sure that npm is up to date, as is required by our VS Code extension
# build.

Просмотреть файл

@ -11,11 +11,12 @@ steps:
- pwsh: ./pack.ps1
displayName: "Pack NuGets and VS Code"
workingDirectory: $(System.DefaultWorkingDirectory)/build
condition: eq( variables['Agent.OS'], 'Windows_NT' )
# Visual Studio extension can't be built from the build script as MSBuild is not available.
- task: VSBuild@1
displayName: 'Pack VisualStudio extension'
condition: and(succeeded(), ne(variables['Enable.VSIX'], 'false'))
condition: and(succeeded(), and(ne(variables['Enable.VSIX'], 'false'), eq( variables['Agent.OS'], 'Windows_NT' )))
inputs:
solution: '$(System.DefaultWorkingDirectory)/VisualStudioExtension.sln'
msbuildArgs: >-
@ -25,5 +26,5 @@ steps:
- pwsh: ./manifest.ps1
displayName: "List built packages & assemblies"
condition: succeededOrFailed()
condition: and(succeededOrFailed(), eq( variables['Agent.OS'], 'Windows_NT' ))
workingDirectory: '$(System.DefaultWorkingDirectory)/build'

Просмотреть файл

@ -41,7 +41,11 @@ function Test-One {
Test-One '../QsCompiler.sln'
Test-One '../src/Telemetry/Telemetry.sln'
Test-One '../QsFmt.sln'
if ($IsWindows) {
# These tests should be able to run cross-platform, see tracking issue:
# https://github.com/microsoft/qsharp-compiler/issues/1319
Test-One '../QsFmt.sln'
}
if (-not $all_ok) {
throw "Running tests failed. Check the logs."

Просмотреть файл

@ -8,18 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Condition="$([MSBuild]::IsOsPlatform('Windows'))"
Include="libLLVM.runtime.win-x64" Version="11.0.0"
PrivateAssets="All" GeneratePathProperty="true" />
<PackageReference Condition="$([MSBuild]::IsOsPlatform('OSX'))"
Include="libLLVM.runtime.osx-x64" Version="11.0.0"
PrivateAssets="All" GeneratePathProperty="true" />
<PackageReference Condition="$([MSBuild]::IsOsPlatform('Linux')) And '$(UbuntuVersion)' == '18.04'"
Include="libLLVM.runtime.ubuntu.18.04-x64" Version="11.0.0"
PrivateAssets="All" GeneratePathProperty="true" />
<PackageReference Condition="$([MSBuild]::IsOsPlatform('Linux')) And '$(UbuntuVersion)' != '18.04'"
Include="libLLVM.runtime.ubuntu.20.04-x64" Version="11.0.0"
PrivateAssets="All" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Quantum.LlvmBindings.Native" Version="13.0.0-CI-20220129-005156" PrivateAssets="All" GeneratePathProperty="true"/>
<PackageReference Include="Microsoft.Quantum.Qir.Runtime" Version="0.20.2110171573-alpha" GeneratePathProperty="true" />
<PackageReference Include="Microsoft.Quantum.Simulators" Version="0.20.2110171573" GeneratePathProperty="true" />
</ItemGroup>
@ -28,6 +17,7 @@
<CSharpGeneration>false</CSharpGeneration>
<QscExe>dotnet $(MSBuildThisFileDirectory)../../../src/QsCompiler/CommandLineTool/bin/$(Configuration)/netcoreapp3.1/qsc.dll</QscExe>
<_QscCommandPredefinedAssemblyProperties>$(_QscCommandPredefinedAssemblyProperties) QirOutputPath:"qir"</_QscCommandPredefinedAssemblyProperties>
<LlvmLibsPath>$(PkgMicrosoft_Quantum_LlvmBindings_Native)</LlvmLibsPath>
</PropertyGroup>
<ItemGroup>
@ -131,9 +121,8 @@
<SimulatorRuntime Condition="$([MSBuild]::IsOsPlatform('OSX'))">$(PkgMicrosoft_Quantum_Simulators)/runtimes/osx-x64/native/libMicrosoft.Quantum.Simulator.Runtime.dylib</SimulatorRuntime>
<SimulatorRuntime Condition="$([MSBuild]::IsOsPlatform('Windows'))">$(PkgMicrosoft_Quantum_Simulators)/runtimes/win-x64/native/Microsoft.Quantum.Simulator.Runtime.dll</SimulatorRuntime>
<SimulatorRuntime Condition="$([MSBuild]::IsOsPlatform('Linux'))">$(PkgMicrosoft_Quantum_Simulators)/runtimes/linux-x64/native/libMicrosoft.Quantum.Simulator.Runtime.so</SimulatorRuntime>
<ClangName Condition="$([MSBuild]::IsOsPlatform('Windows')) Or $([MSBuild]::IsOsPlatform('OSX'))">clang++</ClangName>
<ClangName Condition="$([MSBuild]::IsOsPlatform('Linux'))">clang++-11</ClangName>
<ClangCommand>$(ClangName) -o $(ExecutablePath) $(QirOutputPath)$(PathCompatibleAssemblyName).ll $(BuildOutputPath)/Main.cpp -I$(BuildOutputPath) -L$(BuildOutputPath) -lMicrosoft.Quantum.Qir.Runtime -lMicrosoft.Quantum.Qir.QSharp.Core -lMicrosoft.Quantum.Qir.QSharp.Foundation</ClangCommand>
<ClangOptions Condition="$([MSBuild]::IsOsPlatform('Linux')) Or $([MSBuild]::IsOsPlatform('OSX'))">-fseh-exceptions -lstdc++</ClangOptions>
<ClangCommand>clang -std=c++17 -Wno-override-module $(ClangOptions) -o $(ExecutablePath) $(QirOutputPath)$(PathCompatibleAssemblyName).ll $(BuildOutputPath)/Main.cpp -I$(BuildOutputPath) -L$(BuildOutputPath) -lMicrosoft.Quantum.Qir.Runtime -lMicrosoft.Quantum.Qir.QSharp.Core -lMicrosoft.Quantum.Qir.QSharp.Foundation</ClangCommand>
</PropertyGroup>
<ItemGroup>
<_QirRuntimeLibFiles Include="$(QirRuntimeLibs)/**/*.*" Exclude="$(QirRuntimeLibs)/**/*.exe" />
@ -143,7 +132,11 @@
<Copy SourceFiles="$(SimulatorRuntime)" DestinationFolder="$(BuildOutputPath)" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(_QirRuntimeLibFiles)" DestinationFolder="$(BuildOutputPath)\%(RecursiveDir)" SkipUnchangedFiles="true" />
<Copy SourceFiles="@(_QirRuntimeHeaderFiles)" DestinationFolder="$(BuildOutputPath)\%(RecursiveDir)" SkipUnchangedFiles="true" />
<Exec Command="$(ClangCommand)" IgnoreExitCode="false" />
<Exec Command="clang --version" IgnoreExitCode="true" ContinueOnError="ErrorAndContinue">
<Output TaskParameter="ExitCode" PropertyName="ClangVersionCheckExitCode"/>
</Exec>
<Warning Text="Clang not found, skipping native build." Condition="'$(ClangVersionCheckExitCode)' != '0'" />
<Exec Command="$(ClangCommand)" Condition="'$(ClangVersionCheckExitCode)' == '0'" IgnoreExitCode="false" />
</Target>
</Project>

Просмотреть файл

@ -6,5 +6,5 @@ This is *not* how the QIR generation is meant to be used if you don't intend to
Note: If you are using the Development project on Linux, you may run into the following error: `System.DllNotFoundException: Unable to load shared library 'libLLVM' or one of its dependencies.` The solution to this is to set the LD_LIBRARY_PATH environment variable to point towards the libLLVM.so libary. This can be done using the following command in bash:
```
export LD_LIBRARY_PATH=/usr/lib/llvm-11/lib
export LD_LIBRARY_PATH=/usr/lib/llvm-13/lib
```

Просмотреть файл

@ -37,27 +37,27 @@ On Windows, the conda method is recommended since it's also able to install the
Package managers:
* **Ubuntu** : `sudo apt install clang-11`
* **Windows** : `choco install llvm --version=11.1.0` using [chocolatey](https://chocolatey.org/)
* **Ubuntu** : `sudo apt install clang-13`
* **Windows** : `choco install llvm --version=13.0.0` using [chocolatey](https://chocolatey.org/)
* **macOS** : `brew install llvm@11` using [homebrew](https://brew.sh/)
* **all** : `conda install -c conda-forge clang=11.1.0 clangxx=11.1.0 llvm=11.1.0` using [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html)
* **all** : `conda install -c conda-forge clang=13.0.0 clangxx=13.0.0 llvm=13.0.0` using [conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html)
Pre-built binaries/installers:
* **Ubuntu** : get `clang+llvm-11.1.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz` from the [GitHub release](https://github.com/llvm/llvm-project/releases/tag/llvmorg-11.1.0)
* **Windows** : get `LLVM-11.1.0-win64.exe` from the [GitHub release](https://github.com/llvm/llvm-project/releases/tag/llvmorg-11.1.0)
* **macOS** : get `clang+llvm-11.0.0-x86_64-apple-darwin.tar.xz` from the [11.0.0 release](https://github.com/llvm/llvm-project/releases/tag/llvmorg-11.0.0) (11.1.0 not released)
* **Ubuntu** : get `clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-20.10.tar.xz` from the [GitHub release](https://github.com/llvm/llvm-project/releases/tag/llvmorg-13.0.0)
* **Windows** : get `LLVM-13.0.0-win64.exe` from the [GitHub release](https://github.com/llvm/llvm-project/releases/tag/llvmorg-13.0.0)
* **macOS** : get `clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz` from the [13.0.0 release](https://github.com/llvm/llvm-project/releases/tag/llvmorg-13.0.0)
(**Linux**) If installing via `apt`, the clang/llvm commands will have `-11` attached to their name.
(**Linux**) If installing via `apt`, the clang/llvm commands will have `-13` attached to their name.
It's convenient to define aliases for these commands so as not to have to type out the full name every time.
If you want to skip this step, substitute `clang`/`clang++`/`opt` with `clang-11`/`clang++-11`/`opt-11` throughout the rest of this document.
If you want to skip this step, substitute `clang`/`clang++`/`opt` with `clang-13`/`clang++-13`/`opt-13` throughout the rest of this document.
```bash
echo 'alias clang=clang-11' >> ~/.bashrc
echo 'alias clang++=clang++-11' >> ~/.bashrc
echo 'alias opt=opt-11' >> ~/.bashrc
echo 'alias clang=clang-13' >> ~/.bashrc
echo 'alias clang++=clang++-13' >> ~/.bashrc
echo 'alias opt=opt-13' >> ~/.bashrc
```
Restart the terminal for the aliases to take effect.

Просмотреть файл

@ -10,6 +10,7 @@ LLVMAttributeReturnIndex
LLVMInitializeCore
--file
llvm-c/Analysis.h
llvm-c/BitReader.h
llvm-c/BitWriter.h
llvm-c/Comdat.h
llvm-c/Core.h
@ -17,6 +18,7 @@ llvm-c/DataTypes.h
llvm-c/DebugInfo.h
llvm-c/Error.h
llvm-c/ErrorHandling.h
llvm-c/ExecutionEngine.h
llvm-c/ExternC.h
llvm-c/Initialization.h
llvm-c/Object.h

7
llvm-build/header.txt Normal file
Просмотреть файл

@ -0,0 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

Просмотреть файл

@ -50,7 +50,7 @@ foreach ($file in $llvmArchiveFiles) {
}
# Windows: bin/LLVM-C.dll
# Linux: lib/libLLVM-11.so
# Linux: lib/libLLVM-13.so
# Darwin: lib/libLLVM.dylib
$linuxPath = Resolve-Path (Join-Path '.' "$($env:LINUX_PKG_NAME)" "lib" "libLLVM-[0-9][0-9].so")
@ -95,7 +95,8 @@ ClangSharpPInvokeGenerator `
"@$(Join-Path $PSScriptRoot GenerateLLVM.rsp)" `
--output $generatedDir `
--file-directory $includeDir `
--include-directory $includeDir
--include-directory $includeDir `
--headerFile (Join-Path $PSScriptRoot header.txt)
New-Item -ItemType Directory -Force (Join-Path $PSScriptRoot drops) | Out-Null

Просмотреть файл

@ -72,4 +72,7 @@ else()
set(LLVM_BUILD_LLVM_DYLIB ON CACHE BOOL "")
set(CPACK_BINARY_TGZ ON CACHE BOOL "")
endif()
set(LLVM_DYLIB_COMPONENTS "core;debuginfodwarf;linker;support;target;bitwriter" CACHE STRING "")
# See https://github.com/llvm/llvm-project/blob/llvmorg-13.0.0/llvm/utils/gn/build/write_library_dependencies.py for a list
# of these dependencies and what they bring into the linked binary.
set(LLVM_DYLIB_COMPONENTS "core;debuginfodwarf;linker;support;target;bitwriter;analysis;executionengine;runtimedyld;mcjit;bitstreamreader;bitreader;native" CACHE STRING "")

Просмотреть файл

@ -32,6 +32,14 @@
<ProjectReference Include="..\Compiler\Compiler.csproj" />
</ItemGroup>
<ItemGroup Condition="!$([MSBuild]::IsOsPlatform('Windows'))">
<PackageReference Include="Microsoft.Quantum.LlvmBindings.Native" Version="13.0.0-CI-20220129-005156">
<PrivateAssets>all</PrivateAssets>
<Visible>false</Visible>
<Pack>false</Pack>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\..\NOTICE.txt" Link="NOTICE.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

Просмотреть файл

@ -57,4 +57,4 @@ Add-NuGetDependencyFromCsprojToNuspec "Compiler.csproj" $dep
# Save into .nuspec file:
$nuspec.package.metadata.AppendChild($dep)
$nuspec.Save("$PSScriptRoot\Compiler.nuspec")
$nuspec.Save((Join-Path $PSScriptRoot Compiler.nuspec))

Просмотреть файл

@ -10,15 +10,13 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using LlvmBindings.DebugInfo;
using LlvmBindings.Instructions;
using LlvmBindings.Interop;
using LlvmBindings.Types;
using LlvmBindings.Values;
using LLVMSharp.Interop;
using Ubiquity.NET.Llvm.DebugInfo;
using Ubiquity.NET.Llvm.Instructions;
using Ubiquity.NET.Llvm.Types;
using Ubiquity.NET.Llvm.Values;
namespace Ubiquity.NET.Llvm
namespace LlvmBindings
{
/// <summary>Enumeration to indicate the behavior of module level flags metadata sharing the same name in a <see cref="BitcodeModule"/>.</summary>
[SuppressMessage("Design", "CA1027:Mark enums with FlagsAttribute", Justification = "It isn't a flags enum")]
@ -240,39 +238,6 @@ namespace Ubiquity.NET.Llvm
public ref LLVMModuleRef ModuleHandle => ref this.moduleHandle;
/// <summary>Load a bit-code module from a given file.</summary>
/// <param name="path">path of the file to load.</param>
/// <param name="context">Context to use for creating the module.</param>
/// <returns>Loaded <see cref="BitcodeModule"/>.</returns>
public static BitcodeModule LoadFrom(string path, Context context)
{
if (!File.Exists(path))
{
throw new FileNotFoundException();
}
var buffer = new MemoryBuffer(path);
return LoadFrom(buffer, context);
}
/// <summary>Load bit code from a memory buffer.</summary>
/// <param name="buffer">Buffer to load from.</param>
/// <param name="context">Context to load the module into.</param>
/// <returns>Loaded <see cref="BitcodeModule"/>.</returns>
/// <remarks>
/// This along with <see cref="WriteToBuffer"/> are useful for "cloning"
/// a module from one context to another. This allows creation of multiple
/// modules on different threads and contexts and later moving them to a
/// single context in order to link them into a single final module for
/// optimization.
/// </remarks>
public static BitcodeModule LoadFrom(MemoryBuffer buffer, Context context)
{
return context.ContextHandle.TryParseBitcode(buffer.BufferHandle, out LLVMModuleRef modRef, out string message)
? context.GetModuleFor(modRef)
: throw new InternalCodeGeneratorException(message);
}
/// <summary>Disposes the <see cref="BitcodeModule"/>, releasing resources associated with the module in native code.</summary>
public void Dispose()
{
@ -288,32 +253,6 @@ namespace Ubiquity.NET.Llvm
}
}
/// <summary>Link another module into this one.</summary>
/// <param name="otherModule">module to link into this one.</param>
/// <remarks>
/// <note type="warning">
/// <paramref name="otherModule"/> is destroyed by this process and no longer usable
/// when this method returns.
/// </note>
/// </remarks>
public void Link(BitcodeModule otherModule)
{
this.ThrowIfDisposed();
if (otherModule.Context != this.Context)
{
throw new ArgumentException();
}
if (this.moduleHandle.Link(otherModule.moduleHandle))
{
throw new InternalCodeGeneratorException();
}
this.Context.RemoveModule(otherModule);
otherModule.Detach().Dispose();
}
/// <summary>Verifies a bit-code module.</summary>
/// <param name="errorMessage">Error messages describing any issues found in the bit-code.</param>
/// <returns>true if the verification succeeded and false if not.</returns>
@ -654,23 +593,6 @@ namespace Ubiquity.NET.Llvm
return FromHandle(this.moduleHandle.Clone())!;
}
/// <summary>Clones the module into a new <see cref="Context"/>.</summary>
/// <param name="targetContext"><see cref="Context"/> to clone the module into.</param>
/// <returns>Cloned copy of the module.</returns>
public BitcodeModule Clone(Context targetContext)
{
this.ThrowIfDisposed();
if (targetContext == this.Context)
{
return this.Clone();
}
var buffer = this.WriteToBuffer();
var retVal = LoadFrom(buffer, targetContext);
return retVal;
}
internal static BitcodeModule FromHandle(LLVMModuleRef nativeHandle)
{
var contextRef = nativeHandle.Context;

Просмотреть файл

@ -11,12 +11,11 @@ using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Text;
using LLVMSharp.Interop;
using Ubiquity.NET.Llvm.Interop;
using Ubiquity.NET.Llvm.Types;
using Ubiquity.NET.Llvm.Values;
using LlvmBindings.Interop;
using LlvmBindings.Types;
using LlvmBindings.Values;
namespace Ubiquity.NET.Llvm
namespace LlvmBindings
{
/// <summary>Encapsulates an LLVM context.</summary>
/// <remarks>
@ -28,7 +27,7 @@ namespace Ubiquity.NET.Llvm
/// <para>LLVM Debug information is ultimately all parented to a top level <see cref="DICompileUnit"/> as
/// the scope, and a compilation unit is bound to a <see cref="BitcodeModule"/>, even though, technically
/// the types are owned by a Context. Thus to keep things simpler and help make working with debug information
/// easier. Ubiquity.NET.Llvm encapsulates the native type and the debug type in separate classes that are instances
/// easier. LlvmBindings encapsulates the native type and the debug type in separate classes that are instances
/// of the <see cref="IDebugType{NativeT, DebugT}"/> interface. </para>
///
/// <note type="note">It is important to be aware of the fact that a Context is not thread safe. The context

Просмотреть файл

@ -8,11 +8,11 @@
using System;
using System.Collections.Generic;
using LLVMSharp.Interop;
using Ubiquity.NET.Llvm.Types;
using Ubiquity.NET.Llvm.Values;
using LlvmBindings.Interop;
using LlvmBindings.Types;
using LlvmBindings.Values;
namespace Ubiquity.NET.Llvm
namespace LlvmBindings
{
/// <summary>Byte ordering for target code generation and data type layout</summary>
public enum ByteOrdering

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a basic type</summary>
/// <seealso cref="DebugInfoBuilder.CreateBasicType(string, ulong, DiTypeKind, DebugInfoFlags)"/>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug Information Compile Unit, which acts as the containing parent for debug information in a module</summary>
/// <seealso href="xref:llvm_langref#dicompileunit">LLVM DICompileUnit</seealso>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a composite type</summary>
/// <seealso href="xref:llvm_langref#dicompositetype">LLVM DICompositeType</seealso>

Просмотреть файл

@ -7,7 +7,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Array of <see cref="DICompositeType"/> debug information nodes for use with <see cref="DebugInfoBuilder"/> methods</summary>
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "This matches the wrapped native type")]

Просмотреть файл

@ -5,10 +5,10 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using Ubiquity.NET.Llvm.Values;
using LlvmBindings.Interop;
using LlvmBindings.Values;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Derived type</summary>
/// <remarks>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug Information for a name value par of an enumerated type</summary>
/// <seealso href="xref:llvm_langref#dienumerator">LLVM DIEnumerator</seealso>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information expression</summary>
/// <seealso href="xref:llvm_langref#diexpression">LLVM DIExpression</seealso>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a source file</summary>
/// <seealso href="xref:llvm_langref#difile">LLVM DIFile</seealso>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a global variable</summary>
/// <seealso href="xref:llvm_langref#diglobalvariable">LLVM DIGlobalVariable</seealso>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug Global variable expression</summary>
/// <remarks>This node binds a <see cref="DIGlobalVariable"/> and a <see cref="DIExpression"/></remarks>

Просмотреть файл

@ -7,7 +7,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Array of <see cref="DIGlobalVariableExpression"/> debug information nodes for use with <see cref="DebugInfoBuilder"/> methods</summary>
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "This matches the wrapped native type")]

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information from an imported entity</summary>
/// <seealso href="xref:llvm_langref#diimportedentity">LLVM DIImportedEntity</seealso>

Просмотреть файл

@ -7,7 +7,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Array of <see cref="DIImportedEntity"/> debug information nodes for use with <see cref="DebugInfoBuilder"/> methods</summary>
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "This matches the wrapped native type")]

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a Lexical block</summary>
/// <seealso href="xref:llvm_langref#dilexicalblock">LLVM DILexicalBlock</seealso>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Base for lexical blocks</summary>
public class DILexicalBlockBase

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a file lexical block</summary>
/// <seealso href="xref:llvm_langref#dilexicalblockfile">LLVM DILexicalBlockBase</seealso>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Legal scope for lexical blocks, local variables, and debug info locations</summary>
public class DILocalScope

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a local variable</summary>
/// <seealso href="xref:llvm_langref#dilocalvariable">LLVM DILocalVariable</seealso>

Просмотреть файл

@ -7,7 +7,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Array of <see cref="DILocalVariable"/> nodes for use with see <see cref="DebugInfoBuilder"/> methods</summary>
[SuppressMessage("Naming", "CA1710:Identifiers should have correct suffix", Justification = "Name matches underlying LLVM and is descriptive of what it is")]

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug source location information</summary>
public class DILocation

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Pre-Processor macro</summary>
public class DIMacro

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Macro file included by a unit</summary>
/// <remarks>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Base class for macro related nodes in the debug hierarchy</summary>
public class DIMacroNode

Просмотреть файл

@ -7,7 +7,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Array of <see cref="DIMacroNode"/> debug information nodes for use with <see cref="DebugInfoBuilder"/> methods</summary>
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "This matches the wrapped native type")]

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>A source module that is imported by a compile unit</summary>
public class DIModule

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information namespace scope</summary>
/// <seealso href="xref:llvm_langref#dinamespace"/>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Root of the object hierarchy for Debug information metadata nodes</summary>
public class DINode

Просмотреть файл

@ -7,7 +7,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Array of <see cref="DINode"/> debug information nodes for use with <see cref="DebugInfoBuilder"/> methods</summary>
/// <seealso cref="DebugInfoBuilder.GetOrCreateArray(System.Collections.Generic.IEnumerable{DINode})"/>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Objective-C Property</summary>
public class DIObjCProperty

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Base class for all Debug information scopes</summary>
public class DIScope

Просмотреть файл

@ -7,7 +7,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Array of <see cref="DIScope"/> debug information nodes for use with <see cref="DebugInfoBuilder"/> methods</summary>
[SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "This matches the wrapped native type")]

Просмотреть файл

@ -7,10 +7,10 @@
using System.Diagnostics.CodeAnalysis;
using LLVMSharp.Interop;
using Ubiquity.NET.Llvm.Values;
using LlvmBindings.Interop;
using LlvmBindings.Values;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a SubProgram</summary>
/// <seealso href="xref:llvm_langref#disubprogram"/>

Просмотреть файл

@ -7,10 +7,10 @@
using System;
using LLVMSharp.Interop;
using Ubiquity.NET.Llvm.Values;
using LlvmBindings.Interop;
using LlvmBindings.Values;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Sub range</summary>
/// <seealso href="xref:llvm_langref#disubrange">LLVM DISubRange</seealso>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a function signature</summary>
/// <seealso href="xref:llvm_langref#disubroutinetype"/>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Base class for template parameter information</summary>
/// <seealso cref="DITemplateTypeParameter"/>

Просмотреть файл

@ -7,7 +7,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Array of <see cref="DITemplateParameter"/> nodes for use with see <see cref="DebugInfoBuilder"/> methods</summary>
[SuppressMessage("Naming", "CA1710:Identifiers should have correct suffix", Justification = "Name matches underlying LLVM and is descriptive of what it is")]

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Template type parameter</summary>
/// <seealso href="xref:llvm_langref#ditemplatetypeparameter">LLVM DITemplateTypeParameter</seealso>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Template Value parameter</summary>
/// <seealso href="xref:llvm_langref#ditemplatevalueparameter">LLVM DITemplateValueParameter</seealso>

Просмотреть файл

@ -7,9 +7,9 @@
using System;
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Base class for Debug info types</summary>
/// <seealso href="xref:llvm_langref#ditype">LLVM DIType</seealso>

Просмотреть файл

@ -7,7 +7,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Array of <see cref="DIType"/> nodes for use with see <see cref="DebugInfoBuilder"/> methods</summary>
[SuppressMessage("Naming", "CA1710:Identifiers should have correct suffix", Justification = "Name matches underlying LLVM and is descriptive of what it is")]

Просмотреть файл

@ -7,9 +7,9 @@
using System;
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a variable</summary>
public class DIVariable

Просмотреть файл

@ -7,11 +7,11 @@
using System;
using LLVMSharp.Interop;
using LlvmBindings.Interop;
using Ubiquity.NET.Llvm.Types;
using LlvmBindings.Types;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Provides debug information binding between an <see cref="IArrayType"/> and a <see cref="DICompositeType"/></summary>
/// <seealso href="xref:llvm_langref#dicompositetype">DICompositeType</seealso>

Просмотреть файл

@ -7,9 +7,9 @@
using System;
using Ubiquity.NET.Llvm.Types;
using LlvmBindings.Types;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information binding between an LLVM native <see cref="ITypeRef"/> and a <see cref="DIBasicType"/></summary>
/// <remarks>

Просмотреть файл

@ -8,9 +8,9 @@
using System.Collections.Generic;
using System.Linq;
using Ubiquity.NET.Llvm.Types;
using LlvmBindings.Types;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>This class provides debug information binding for an <see cref="IFunctionType"/>
/// and a <see cref="DISubroutineType"/>
@ -34,7 +34,7 @@ namespace Ubiquity.NET.Llvm.DebugInfo
/// <note type="note">It is important to keep in mind that signatures are only concerned
/// with types. That is, they do not include names of parameters. Parameter information is
/// provided by <see cref="DebugInfoBuilder.CreateArgument(DIScope, string, DIFile, uint, DIType, bool, DebugInfoFlags, ushort)"/>
/// and [DebugInfoBuilder.InsertDeclare](xref:Ubiquity.NET.Llvm.DebugInfo.DebugInfoBuilder.InsertDeclare*)</note>
/// and [DebugInfoBuilder.InsertDeclare](xref:LlvmBindings.DebugInfo.DebugInfoBuilder.InsertDeclare*)</note>
/// </remarks>
/// <seealso href="xref:llvm_langref#disubroutinetype">LLVM DISubroutineType</seealso>
public class DebugFunctionType

Просмотреть файл

@ -8,15 +8,13 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using LLVMSharp.Interop;
using Ubiquity.NET.Llvm.Instructions;
using Ubiquity.NET.Llvm.Values;
using LlvmBindings.Instructions;
using LlvmBindings.Interop;
using LlvmBindings.Values;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Defines the amount of debug information to emit</summary>
public enum DwarfEmissionKind
@ -226,7 +224,17 @@ namespace Ubiquity.NET.Llvm.DebugInfo
/// </returns>
public DIFile CreateFile(string? fileName, string? directory)
{
var handle = this.BuilderHandle.CreateFile(fileName, directory);
if (fileName == null)
{
throw new ArgumentNullException(nameof(fileName));
}
if (directory == null)
{
throw new ArgumentNullException(nameof(directory));
}
var handle = this.BuilderHandle.CreateFile(fileName!, directory!);
return MDNode.FromHandle<DIFile>(handle)!;
}

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using Ubiquity.NET.Llvm.Types;
using LlvmBindings.Types;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Describes a member/field of a type for creating debug information</summary>
/// <remarks>
@ -64,7 +64,7 @@ namespace Ubiquity.NET.Llvm.DebugInfo
public IDebugType<ITypeRef, DIType> DebugType { get; }
/// <summary>Gets the explicit layout information for this member</summary>
/// <remarks>If this is <see langword="null"/> then <see href="xref:Ubiquity.NET.Llvm.DebugInfo.DebugStructType.SetBody*">DebugStructType.SetBody</see>
/// <remarks>If this is <see langword="null"/> then <see href="xref:LlvmBindings.DebugInfo.DebugStructType.SetBody*">DebugStructType.SetBody</see>
/// will default to using <see cref="BitcodeModule.Layout"/> to determine the size using the module's target specific layout.
/// <note type="Important">
/// If this property is provided (e.g. is not <see langword="null"/>) for any member of a type, then

Просмотреть файл

@ -5,12 +5,12 @@
// </copyright>
// -----------------------------------------------------------------------
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>DebugMemberLayout is used to define custom layout information for structure members</summary>
/// <remarks>
/// Ordinarily layout information is handle automatically in
/// <see href="xref:Ubiquity.NET.Llvm.DebugInfo.DebugStructType.SetBody*">DebugStructType.SetBody</see>
/// <see href="xref:LlvmBindings.DebugInfo.DebugStructType.SetBody*">DebugStructType.SetBody</see>
/// however in cases where explicitly controlled (or "packed") layout is required, instances of DebugMemberLayout are
/// used to provide the information necessary to generate a proper type and debug information.
/// </remarks>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using Ubiquity.NET.Llvm.Types;
using LlvmBindings.Types;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Binding between a <see cref="DIDerivedType"/> and an <see cref="IPointerType"/></summary>
/// <seealso href="xref:llvm_langref#diderivedtype">LLVM DIDerivedType</seealso>

Просмотреть файл

@ -10,9 +10,9 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Ubiquity.NET.Llvm.Types;
using LlvmBindings.Types;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug information for a structure type</summary>
/// <seealso href="xref:llvm_langref#dicompositetype">LLVM DICompositeType</seealso>

Просмотреть файл

@ -8,14 +8,14 @@
using System;
using System.Diagnostics.CodeAnalysis;
using LLVMSharp.Interop;
using LlvmBindings.Interop;
using Ubiquity.NET.Llvm.Types;
using Ubiquity.NET.Llvm.Values;
using LlvmBindings.Types;
using LlvmBindings.Values;
#pragma warning disable SA1649 // File name must match first type ( Justification - Interface + internal Impl + public extensions )
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Provides pairing of a <see cref="ITypeRef"/> with a <see cref="DIType"/> for function signatures</summary>
/// <typeparam name="TNative">Native LLVM type</typeparam>

Просмотреть файл

@ -10,9 +10,9 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Ubiquity.NET.Llvm.Types;
using LlvmBindings.Types;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Debug representation of a union type</summary>
/// <remarks>The underlying native LLVM type is a structure with a single member</remarks>

Просмотреть файл

@ -8,13 +8,13 @@
using System;
using System.Diagnostics.CodeAnalysis;
using LLVMSharp.Interop;
using LlvmBindings.Interop;
// The names describe what they are, further details are available in the DWARF specs
#pragma warning disable CS1591, SA1600, SA1602 // Enumeration items must be documented
// ReSharper disable IdentifierTypo
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>DWARF Debug information language</summary>
public enum SourceLanguage
@ -66,10 +66,10 @@ namespace Ubiquity.NET.Llvm.DebugInfo
/// <summary>Base value for unofficial languages ids</summary>
UserMin = 0x8000,
/// <summary>[Ubiquity.NET.Llvm] C# Language</summary>
/// <summary>[LlvmBindings] C# Language</summary>
CSharp = UserMin + 0x01000,
/// <summary>[Ubiquity.NET.Llvm] .NET IL Assembly language (ILAsm)</summary>
/// <summary>[LlvmBindings] .NET IL Assembly language (ILAsm)</summary>
ILAsm = UserMin + 0x01001,
/// <summary>Max Value for unofficial language ids</summary>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Generic tagged DWARF-like Metadata node</summary>
public class GenericDINode

Просмотреть файл

@ -10,7 +10,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
namespace Ubiquity.NET.Llvm.DebugInfo
namespace LlvmBindings.DebugInfo
{
/// <summary>Generic wrapper to treat an MDTuple as an array of elements of specific type</summary>
/// <typeparam name="T">Type of elements</typeparam>

Просмотреть файл

@ -6,7 +6,7 @@ using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
namespace Ubiquity.NET.Llvm.Interop
namespace LlvmBindings.Interop
{
/// <summary>Abstract base class for implementing the Disposable pattern.</summary>
public abstract class DisposableObject

Просмотреть файл

@ -9,7 +9,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm
namespace LlvmBindings
{
/// <summary>Common implementation of <see cref="IExtensiblePropertyContainer"/></summary>
/// <remarks>

Просмотреть файл

@ -5,7 +5,7 @@
using System;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
/// <summary>Extensions for <see cref="LLVMDIBuilderRef"/>.</summary>
public static unsafe class LLVMDIBuilderRefExtensions

Просмотреть файл

@ -0,0 +1,17 @@
// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT).
using System;
using System.Runtime.InteropServices;
namespace LlvmBindings.Interop
{
public unsafe partial struct LLVMMCJITCompilerOptions
{
public static LLVMMCJITCompilerOptions Create()
{
LLVMMCJITCompilerOptions options;
LLVM.InitializeMCJITCompilerOptions(&options, (UIntPtr)Marshal.SizeOf<LLVMMCJITCompilerOptions>());
return options;
}
}
}

Просмотреть файл

@ -5,7 +5,7 @@
using System;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
/// <summary>Extensions for <see cref="LLVMMemoryBufferRef"/>.</summary>
public static unsafe class LLVMMemoryBufferRefExtensions

Просмотреть файл

@ -5,7 +5,7 @@
using System;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
/// <summary>Extensions for <see cref="LLVMMetadataRef"/>.</summary>
public static unsafe class LLVMMetadataRefExtensions

Просмотреть файл

@ -5,7 +5,7 @@
using System;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
/// <summary>Extensions for <see cref="LLVMModuleFlagEntry"/>.</summary>
public static unsafe class LLVMModuleFlagEntryExtensions

Просмотреть файл

@ -5,7 +5,7 @@
using System;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
/// <summary>Extensions for <see cref="LLVMModuleRef"/>.</summary>
public static unsafe class LLVMModuleRefExtensions
@ -31,9 +31,6 @@ namespace LLVMSharp.Interop
return new ReadOnlySpan<byte>(pStr, (int)len).AsString();
}
/// <summary>Convenience wrapper for <see cref="LLVM.LinkModules2"/>.</summary>
public static bool Link(this LLVMModuleRef self, LLVMModuleRef other) => LLVM.LinkModules2(self, other) == 0;
/// <summary>Convenience wrapper for <see cref="LLVM.AddGlobalIFunc"/>.</summary>
public static LLVMValueRef AddGlobalIFunc(this LLVMModuleRef self, string name, LLVMTypeRef typeRef, uint addrSpace, LLVMValueRef resolver)
{

Просмотреть файл

@ -5,7 +5,7 @@
using System;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
/// <summary>Extensions for <see cref="LLVMNamedMDNodeRef"/>.</summary>
public static unsafe class LLVMNamedMDNodeRefExtensions

Просмотреть файл

@ -5,7 +5,7 @@
using System;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
/// <summary>Extensions for <see cref="LLVMTargetDataRef"/>.</summary>
public static unsafe class LLVMTargetDataRefExtensions

Просмотреть файл

@ -5,7 +5,7 @@
using System;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
/// <summary>Extensions for <see cref="LLVMUseRef"/>.</summary>
public static unsafe class LLVMUseRefExtensions

Просмотреть файл

@ -5,7 +5,7 @@
using System;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
/// <summary>Support for refs to LLVMOpaqueValueMetadataEntry*.</summary>
public unsafe partial struct LLVMValueMetadataEntryRef : IEquatable<LLVMValueMetadataEntryRef>

Просмотреть файл

@ -5,7 +5,7 @@
using System;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
/// <summary>Extensions for <see cref="LLVMValueRef"/>.</summary>
public static unsafe class LLVMValueRefExtensions

Просмотреть файл

@ -7,9 +7,9 @@ using System;
using System.Runtime.InteropServices;
using System.Text;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
internal unsafe struct MarshaledString : IDisposable
public unsafe struct MarshaledString : IDisposable
{
public MarshaledString(ReadOnlySpan<char> input)
{

Просмотреть файл

@ -0,0 +1,58 @@
// Copyright (c) .NET Foundation and Contributors. All Rights Reserved. Licensed under the MIT License (MIT).
using System;
namespace LlvmBindings.Interop
{
public unsafe struct MarshaledStringArray : IDisposable
{
public MarshaledStringArray(ReadOnlySpan<string> inputs)
{
if (inputs.IsEmpty)
{
this.Count = 0;
this.Values = null;
}
else
{
this.Count = inputs.Length;
this.Values = new MarshaledString[this.Count];
for (int i = 0; i < this.Count; i++)
{
this.Values[i] = new MarshaledString(inputs[i].AsSpan());
}
}
}
public int Count { get; private set; }
public MarshaledString[]? Values { get; private set; }
public void Dispose()
{
var values = this.Values;
if (values is object)
{
for (int i = 0; i < values.Length; i++)
{
values[i].Dispose();
}
this.Values = null;
this.Count = 0;
}
}
public void Fill(sbyte** pDestination)
{
if (this.Values is object)
{
for (int i = 0; i < this.Count; i++)
{
pDestination[i] = this.Values[i];
}
}
}
}
}

Просмотреть файл

@ -6,9 +6,9 @@
using System;
using System.Text;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
internal static unsafe class SpanExtensions
public static unsafe class SpanExtensions
{
public static string AsString(this Span<byte> self) => AsString((ReadOnlySpan<byte>)self);

Просмотреть файл

@ -6,9 +6,9 @@
using System;
using System.Text;
namespace LLVMSharp.Interop
namespace LlvmBindings.Interop
{
internal static unsafe class StringExtensions
public static unsafe class StringExtensions
{
public static MarshaledString AsMarshaledString(this string self)
{

Просмотреть файл

@ -10,7 +10,7 @@ using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace Ubiquity.NET.Llvm
namespace LlvmBindings
{
internal abstract class HandleInterningMap<THandle, TMappedType>
: IHandleInterning<THandle, TMappedType>

Просмотреть файл

@ -5,7 +5,7 @@
// </copyright>
// -----------------------------------------------------------------------
namespace Ubiquity.NET.Llvm
namespace LlvmBindings
{
/// <summary>Interface for a <see cref="BitcodeModule"/> factory.</summary>
/// <remarks>

Просмотреть файл

@ -7,7 +7,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Ubiquity.NET.Llvm
namespace LlvmBindings
{
/// <summary>Interface to allow adding arbitrary named data items to an object</summary>
/// <remarks>

Просмотреть файл

@ -12,7 +12,7 @@ using System.Collections.Generic;
// gripes about these for interfaces...
#pragma warning disable SA1600
namespace Ubiquity.NET.Llvm
namespace LlvmBindings
{
internal interface IHandleInterning<THandle, TMappedType>
: IEnumerable<TMappedType>

Просмотреть файл

@ -7,7 +7,7 @@
using System;
namespace Ubiquity.NET.Llvm.Interop
namespace LlvmBindings.Interop
{
/// <summary>Code gen target to register/initialize.</summary>
public enum CodeGenTarget
@ -111,9 +111,5 @@ namespace Ubiquity.NET.Llvm.Interop
public interface ILibLlvm
: IDisposable
{
/// <summary>Registers components for ARM AArch64 target(s).</summary>
/// <param name="target">Target architecture to register/initialize.</param>
/// <param name="registrations">Flags indicating which components to register/enable.</param>
void RegisterTarget(CodeGenTarget target, TargetRegistrations registrations = TargetRegistrations.All);
}
}

Просмотреть файл

@ -7,7 +7,7 @@
using System.Collections.Generic;
namespace Ubiquity.NET.Llvm
namespace LlvmBindings
{
/// <summary>Interface for a fixed shape collection of operands.</summary>
/// <typeparam name="T">Type of elements in the container.</typeparam>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.Instructions
namespace LlvmBindings.Instructions
{
/// <summary>Address space cast instruction.</summary>
/// <seealso href="xref:llvm_langref#addrspaceast-to-instruction">LLVM addrspacecast .. to</seealso>

Просмотреть файл

@ -5,10 +5,10 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using Ubiquity.NET.Llvm.Types;
using LlvmBindings.Interop;
using LlvmBindings.Types;
namespace Ubiquity.NET.Llvm.Instructions
namespace LlvmBindings.Instructions
{
/// <summary>Alloca instruction for allocating stack space.</summary>
/// <remarks>

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.Instructions
namespace LlvmBindings.Instructions
{
/// <summary>Base class for a binary operator.</summary>
public class BinaryOperator

Просмотреть файл

@ -5,9 +5,9 @@
// </copyright>
// -----------------------------------------------------------------------
using LLVMSharp.Interop;
using LlvmBindings.Interop;
namespace Ubiquity.NET.Llvm.Instructions
namespace LlvmBindings.Instructions
{
/// <summary>This class represents a no-op cast from one type to another.</summary>
public class BitCast

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше