Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions src/Interop/LlvmBindingsGenerator/CmdLineArgs.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.CommandLine.Parsing;
using System.IO;

using CppSharp;

namespace LlvmBindingsGenerator
{
internal partial class CmdLineArgs
{
// [Option("-l", Required=true, Description="Root of source with the LLVM headers to parse (Assumes and validates a sub-folder 'include')"]
// [AcceptExistingFolderOnly]
// [Validator( "CmdLineArgs.ValidateIncludeFolder" )]
// [Validator( nameof(ValidateIncludeFolder) )]
public required DirectoryInfo LlvmRoot { get; init; }

// [Option("-e", Required=true, Description="Root of source with the LibLLVM extension headers to parse (Assumes and validates a sub-folder 'include')"]
// [AcceptExistingFolderOnly]
// [Validator( "CmdLineArgs.ValidateIncludeFolder" )]
// [Validator( nameof(ValidateIncludeFolder) )]
public required DirectoryInfo ExtensionsRoot { get; init; }

// [Option("-e", Required=true, Description="Output to place the generated code for handles. No handle source is generated if this is not provided")]
Expand Down
7 changes: 5 additions & 2 deletions src/Interop/LlvmBindingsGenerator/CmdLineArgs.g.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.CommandLine;
using System.CommandLine.Parsing;
Expand Down Expand Up @@ -45,7 +48,7 @@ public static AppControlledDefaultsRootCommand BuildRootCommand( CmdLineSettings
{
// description is hard coded and should come from generation attribute on the "CmdLineArgs" type
// TODO: Check for duplicate options.
// (-?,-h, --help, and --version) are used by default options so nothing should use those values.
// (-?, -h, --help, and --version) are used by default options so nothing should use those values.
// Generator/analyzer should validate that so it isn't a runtime hit.
return new AppControlledDefaultsRootCommand( settings, "LLVM handle wrapper source generator" )
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.Collections.Immutable;

namespace LlvmBindingsGenerator.Configuration
{
internal class GeneratorConfig
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;

namespace LlvmBindingsGenerator.Configuration
{
/// <summary>Details for a handle</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;

using LlvmBindingsGenerator.CppSharpExtensions;
using LlvmBindingsGenerator.Templates;

namespace LlvmBindingsGenerator.Configuration
{
/// <summary>Interface for a generator configuration</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;

using CppSharp.AST;

namespace LlvmBindingsGenerator
{
internal static class ASTContextExtensions
Expand Down
14 changes: 1 addition & 13 deletions src/Interop/LlvmBindingsGenerator/CppSharpExtensions/Driver.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

using CppSharp;
using CppSharp.AST;
using CppSharp.Generators;
using CppSharp.Parser;
using CppSharp.Passes;
using CppSharp.Types;
using CppSharp.Utils;

using ClangParser = CppSharp.ClangParser;
using Module = CppSharp.AST.Module;

namespace LlvmBindingsGenerator
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System;

using CppSharp;

namespace LlvmBindingsGenerator
{
internal class ErrorTrackingDiagnostics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using CppSharp.AST;

namespace LlvmBindingsGenerator
{
internal static class FieldExtensions
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using LlvmBindingsGenerator.CppSharpExtensions;

namespace LlvmBindingsGenerator
{
internal interface ICodeGenerator
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.Collections.Generic;
using CppSharp.Generators;

namespace LlvmBindingsGenerator
{
internal interface ICodeGeneratorTemplateFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System;

using CppSharp;
using CppSharp.Generators;
using CppSharp.Parser;
using CppSharp.Passes;

namespace LlvmBindingsGenerator
{
internal interface IDriver
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.Collections.Generic;

using CppSharp.AST;

namespace LlvmBindingsGenerator
{
internal interface ILibrary
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using CppSharp.AST;

namespace LlvmBindingsGenerator
{
internal enum TypeNameKind
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;

using CppSharp.AST;

namespace LlvmBindingsGenerator
{
internal class NativeTypePrinter
Expand Down
40 changes: 40 additions & 0 deletions src/Interop/LlvmBindingsGenerator/GlobalNamespaceImports.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

/*
NOTE:
While the MsBuild `ImplicitUsings` property is banned from this repo, the C# language feature of global usings is NOT.
The build property will auto include an invisible and undiscoverable (without looking up obscure documentation)
set of namespaces that is NOT consistent or controlled by the developer. THAT is what is BAD/BROKEN about that feature.
By banning it's use and then providing a `GlobalNamespaceImports.cs` source file with ONLY global using statements ALL of
that is eliminated. Such use of the language feature restores FULL control and visibility of the namespaces to the developer,
where it belongs. For a good explanation of this problem see: https://rehansaeed.com/the-problem-with-csharp-10-implicit-usings/.
For an explanation of the benefits of the language feature see: https://www.hanselman.com/blog/implicit-usings-in-net-6
*/

global using System;
global using System.Collections.Generic;
global using System.Collections.Immutable;
global using System.CommandLine.Parsing;
global using System.Diagnostics.CodeAnalysis;
global using System.IO;
global using System.Linq;
global using System.Reflection;
global using System.Runtime.InteropServices;
global using System.Text;

global using CppSharp;
global using CppSharp.AST;
global using CppSharp.Generators;
global using CppSharp.Generators.CSharp;
global using CppSharp.Parser;
global using CppSharp.Passes;
global using CppSharp.Types;
global using CppSharp.Utils;

global using LlvmBindingsGenerator.Configuration;
global using LlvmBindingsGenerator.CppSharpExtensions;
global using LlvmBindingsGenerator.Passes;
global using LlvmBindingsGenerator.Templates;

global using Ubiquity.NET.CommandLine;
2 changes: 0 additions & 2 deletions src/Interop/LlvmBindingsGenerator/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
// a specific target and scoped to a namespace, type, member, etc.
*/

using System.Diagnostics.CodeAnalysis;

[assembly: SuppressMessage( "", "SA0001: XML comment analysis is disabled due to project configuration", Justification = "Internal tool")]
5 changes: 0 additions & 5 deletions src/Interop/LlvmBindingsGenerator/LibLLVMTypePrinter.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System;

using CppSharp.AST;
using CppSharp.Generators.CSharp;

namespace LlvmBindingsGenerator
{
// CONSIDER: Make this type printer provide the source language name
Expand Down
8 changes: 1 addition & 7 deletions src/Interop/LlvmBindingsGenerator/LibLlvmGeneratorLibrary.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.Collections.Generic;
using System.IO;

using CppSharp.AST;

using LlvmBindingsGenerator.Configuration;
using LlvmBindingsGenerator.Passes;
using Type = CppSharp.AST.Type;

namespace LlvmBindingsGenerator
{
Expand Down
10 changes: 0 additions & 10 deletions src/Interop/LlvmBindingsGenerator/LibLlvmTemplateFactory.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.Collections.Generic;
using System.Linq;

using CppSharp;
using CppSharp.Generators;
using CppSharp.Passes;

using LlvmBindingsGenerator.Configuration;
using LlvmBindingsGenerator.CppSharpExtensions;

namespace LlvmBindingsGenerator
{
// Factory class for the templates needed in code generation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.Collections.Generic;

using CppSharp.AST;
using CppSharp.Passes;

namespace LlvmBindingsGenerator.Passes
{
/// <summary>Translation unit pass to mark duplicate function names as ignored</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.Collections.Immutable;

using CppSharp;
using CppSharp.AST;
using CppSharp.Passes;

namespace LlvmBindingsGenerator.Passes
{
/// <summary>Translation unit pass to mark system headers as ignored</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using CppSharp.AST;
using CppSharp.Passes;

namespace LlvmBindingsGenerator.Passes
{
/// <summary>Mark functions as internal or ignored</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.Linq;

using CppSharp;
using CppSharp.AST;
using CppSharp.Passes;

namespace LlvmBindingsGenerator.Passes
{
/// <summary>Translation unit pass to validate that names of all functions in the extension headers have correct prefix</summary>
Expand Down
7 changes: 0 additions & 7 deletions src/Interop/LlvmBindingsGenerator/Program.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System;
using System.Diagnostics.CodeAnalysis;

using CppSharp;

using Ubiquity.NET.CommandLine;

namespace LlvmBindingsGenerator
{
internal static partial class Program
Expand Down
4 changes: 0 additions & 4 deletions src/Interop/LlvmBindingsGenerator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System;
using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
Expand Down
2 changes: 0 additions & 2 deletions src/Interop/LlvmBindingsGenerator/StringExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System.IO;

namespace LlvmBindingsGenerator
{
internal static class StringExtensions
Expand Down
2 changes: 0 additions & 2 deletions src/Interop/LlvmBindingsGenerator/TemplateCodeGenerator.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using LlvmBindingsGenerator.CppSharpExtensions;

namespace LlvmBindingsGenerator
{
/// <summary>Adapter class from a <see cref="ICodeGenTemplate"/> generator to a CppSharp ICodeGenerator</summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
// Copyright (c) Ubiquity.NET Contributors. All rights reserved.
// Licensed under the Apache-2.0 WITH LLVM-exception license. See the LICENSE.md file in the project root for full license information.

using System;
using System.Reflection;

namespace LlvmBindingsGenerator.Templates
{
internal static class AssemblyExtensions
Expand Down
Loading
Loading