Browse Source

Renamed Cxxi references to CppSharp.

pull/1/head
triton 12 years ago
parent
commit
cc8f7cd1db
  1. 7
      src/Bridge/ASTVisitor.cs
  2. 2
      src/Bridge/Class.cs
  3. 2
      src/Bridge/Comment.cs
  4. 2
      src/Bridge/Conversions.cs
  5. 4
      src/Bridge/Declaration.cs
  6. 2
      src/Bridge/Delegate.cs
  7. 2
      src/Bridge/Enumeration.cs
  8. 2
      src/Bridge/Event.cs
  9. 2
      src/Bridge/Field.cs
  10. 2
      src/Bridge/Function.cs
  11. 2
      src/Bridge/Library.cs
  12. 2
      src/Bridge/Method.cs
  13. 2
      src/Bridge/Namespace.cs
  14. 2
      src/Bridge/Property.cs
  15. 2
      src/Bridge/Template.cs
  16. 2
      src/Bridge/TranslationUnit.cs
  17. 2
      src/Bridge/Type.cs
  18. 2
      src/Bridge/Variable.cs
  19. 2
      src/Cxxi/Program.cs
  20. 4
      src/Generator.Tests/HeaderTestFixture.cs
  21. 4
      src/Generator.Tests/Passes/TestPasses.cs
  22. 2
      src/Generator.Tests/QueryHelpers.cs
  23. 6
      src/Generator.Tests/TestCLITypePrinter.cs
  24. 2
      src/Generator/AST/Utils.cs
  25. 2
      src/Generator/Diagnostics.cs
  26. 12
      src/Generator/Driver.cs
  27. 2
      src/Generator/Generators/CLI/CLIForwardReferencePrinter.cs
  28. 4
      src/Generator/Generators/CLI/CLIGenerator.cs
  29. 4
      src/Generator/Generators/CLI/CLIHeadersTemplate.cs
  30. 4
      src/Generator/Generators/CLI/CLIMarshal.cs
  31. 4
      src/Generator/Generators/CLI/CLISourcesTemplate.cs
  32. 4
      src/Generator/Generators/CLI/CLITextTemplate.cs
  33. 4
      src/Generator/Generators/CLI/CLITypePrinter.cs
  34. 4
      src/Generator/Generators/CSharp/CSharpGenerator.cs
  35. 4
      src/Generator/Generators/CSharp/CSharpMarshal.cs
  36. 6
      src/Generator/Generators/CSharp/CSharpTextTemplate.cs
  37. 4
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  38. 2
      src/Generator/Generators/Generator.cs
  39. 2
      src/Generator/Generators/Marshal.cs
  40. 2
      src/Generator/Generators/Template.cs
  41. 4
      src/Generator/Library.cs
  42. 2
      src/Generator/Parser.cs
  43. 2
      src/Generator/Passes/CheckAbiParameters.cs
  44. 6
      src/Generator/Passes/CheckAmbiguousOverloads.cs
  45. 2
      src/Generator/Passes/CheckFlagEnumsPass.cs
  46. 4
      src/Generator/Passes/CheckOperatorsOverloads.cs
  47. 2
      src/Generator/Passes/CheckTypeReferencesPass.cs
  48. 2
      src/Generator/Passes/CleanInvalidDeclNamesPass.cs
  49. 2
      src/Generator/Passes/CleanUnitPass.cs
  50. 2
      src/Generator/Passes/DuplicatedNamesCheckerPass.cs
  51. 2
      src/Generator/Passes/FunctionToInstanceMethodPass.cs
  52. 2
      src/Generator/Passes/FunctionToStaticMethodPass.cs
  53. 2
      src/Generator/Passes/Pass.cs
  54. 4
      src/Generator/Passes/PassBuilder.cs
  55. 2
      src/Generator/Passes/RenamePass.cs
  56. 4
      src/Generator/Passes/ResolveIncompleteDeclsPass.cs
  57. 4
      src/Generator/Passes/SortDeclarationsPass.cs
  58. 2
      src/Generator/Types/CppTypePrinter.cs
  59. 2
      src/Generator/Types/ITypePrinter.cs
  60. 8
      src/Generator/Types/Std/Stdlib.cs
  61. 8
      src/Generator/Types/TypeMap.cs
  62. 4
      src/Generator/Types/Types.cs
  63. 4
      src/Generator/Utils/TestsUtils.cs
  64. 2
      src/Generator/Utils/TextGenerator.cs
  65. 2
      src/Generator/Utils/Utils.cs
  66. 2
      src/Parser/Main.cpp
  67. 198
      src/Parser/Parser.cpp
  68. 38
      src/Parser/Parser.h
  69. 2
      src/Parser/VSLookup.cpp
  70. 6
      tests/Hello/Hello.cs
  71. 14
      tests/Hello/Hello.h

7
src/Bridge/ASTVisitor.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace Cxxi
namespace CppSharp
{
public interface IAstVisited
{
@ -171,8 +171,11 @@ namespace Cxxi @@ -171,8 +171,11 @@ namespace Cxxi
VisitProperty(property);
if (Options.VisitClassMethods)
foreach (var method in @class.Methods)
{
var methods = @class.Methods.ToArray();
foreach (var method in methods)
VisitMethodDecl(method);
}
if (Options.VisitClassEvents)
foreach (var @event in @class.Events)

2
src/Bridge/Class.cs

@ -2,7 +2,7 @@ using System; @@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
namespace Cxxi
namespace CppSharp
{
// A C++ access specifier.
public enum AccessSpecifier

2
src/Bridge/Comment.cs

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Text;
namespace Cxxi
namespace CppSharp
{
/// <summary>
/// Represents a C++ comment.

2
src/Bridge/Conversions.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
namespace Cxxi
namespace CppSharp
{
public enum MethodConversionKind
{

4
src/Bridge/Declaration.cs

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Cxxi;
using CppSharp;
namespace Cxxi
namespace CppSharp
{
public interface IRedeclarableDecl
{

2
src/Bridge/Delegate.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
namespace Cxxi
namespace CppSharp
{
public class Delegate : Declaration
{

2
src/Bridge/Enumeration.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace Cxxi
namespace CppSharp
{
/// <summary>
/// Represents a C/C++ enumeration declaration.

2
src/Bridge/Event.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace Cxxi
namespace CppSharp
{
public class Event : Declaration, ITypedDecl
{

2
src/Bridge/Field.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
namespace Cxxi
namespace CppSharp
{
/// <summary>
/// Represents a a C/C++ record field Decl.

2
src/Bridge/Function.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
namespace Cxxi
namespace CppSharp
{
public enum CallingConvention
{

2
src/Bridge/Library.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace Cxxi
namespace CppSharp
{
public enum CppAbi
{

2
src/Bridge/Method.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
namespace Cxxi
namespace CppSharp
{
public enum CXXMethodKind
{

2
src/Bridge/Namespace.cs

@ -3,7 +3,7 @@ using System.Collections.Generic; @@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
namespace Cxxi
namespace CppSharp
{
/// <summary>
/// Represents a C++ namespace.

2
src/Bridge/Property.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace Cxxi
namespace CppSharp
{
/// <summary>
/// Represents a C++ property.

2
src/Bridge/Template.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace Cxxi
namespace CppSharp
{
public struct TemplateParameter
{

2
src/Bridge/TranslationUnit.cs

@ -2,7 +2,7 @@ using System.Collections.Generic; @@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
namespace Cxxi
namespace CppSharp
{
/// <summary>
/// Represents a parsed C++ unit.

2
src/Bridge/Type.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace Cxxi
namespace CppSharp
{
/// <summary>
/// Represents a C++ type.

2
src/Bridge/Variable.cs

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@

namespace Cxxi
namespace CppSharp
{
public class Variable : Declaration, ITypedDecl
{

2
src/Cxxi/Program.cs

@ -3,7 +3,7 @@ using System.IO; @@ -3,7 +3,7 @@ using System.IO;
using System.Reflection;
using Mono.Options;
namespace Cxxi
namespace CppSharp
{
internal class Program
{

4
src/Generator.Tests/HeaderTestFixture.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System;
using System.IO;
using Cxxi;
using Cxxi.Types;
using CppSharp;
using CppSharp.Types;
namespace Generator.Tests
{

4
src/Generator.Tests/Passes/TestPasses.cs

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
using Cxxi;
using Cxxi.Passes;
using CppSharp;
using CppSharp.Passes;
using NUnit.Framework;
namespace Generator.Tests.Passes

2
src/Generator.Tests/QueryHelpers.cs

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
using System.Linq;
using Cxxi;
using CppSharp;
namespace Generator.Tests
{

6
src/Generator.Tests/TestCLITypePrinter.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using Cxxi;
using Cxxi.Generators.CLI;
using Cxxi.Types;
using CppSharp;
using CppSharp.Generators.CLI;
using CppSharp.Types;
using NUnit.Framework;
namespace Generator.Tests

2
src/Generator/AST/Utils.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace Cxxi.AST
namespace CppSharp.AST
{
public static class Utils
{

2
src/Generator/Diagnostics.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using System;
namespace Cxxi
namespace CppSharp
{
public enum DiagnosticId
{

12
src/Generator/Driver.cs

@ -1,13 +1,13 @@ @@ -1,13 +1,13 @@
using System.IO;
using Cxxi.Generators;
using Cxxi.Generators.CLI;
using Cxxi.Generators.CSharp;
using Cxxi.Passes;
using Cxxi.Types;
using CppSharp.Generators;
using CppSharp.Generators.CLI;
using CppSharp.Generators.CSharp;
using CppSharp.Passes;
using CppSharp.Types;
using System;
using System.Collections.Generic;
namespace Cxxi
namespace CppSharp
{
public class Driver
{

2
src/Generator/Generators/CLI/CLIForwardReferencePrinter.cs

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.IO;
namespace Cxxi.Generators.CLI
namespace CppSharp.Generators.CLI
{
public struct CLIForwardReference
{

4
src/Generator/Generators/CLI/CLIGenerator.cs

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
using System;
using System.IO;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Generators.CLI
namespace CppSharp.Generators.CLI
{
public class CLIGenerator : Generator
{

4
src/Generator/Generators/CLI/CLIHeadersTemplate.cs

@ -2,9 +2,9 @@ @@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Generators.CLI
namespace CppSharp.Generators.CLI
{
public class CLIHeadersTemplate : CLITextTemplate
{

4
src/Generator/Generators/CLI/CLIMarshal.cs

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
using System;
using System.Text;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Generators.CLI
namespace CppSharp.Generators.CLI
{
public class CLIMarshalNativeToManagedPrinter : MarshalPrinter
{

4
src/Generator/Generators/CLI/CLISourcesTemplate.cs

@ -3,9 +3,9 @@ using System.Collections.Generic; @@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Generators.CLI
namespace CppSharp.Generators.CLI
{
public class CLISourcesTemplate : CLITextTemplate
{

4
src/Generator/Generators/CLI/CLITextTemplate.cs

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Generators.CLI
namespace CppSharp.Generators.CLI
{
public struct Include
{

4
src/Generator/Generators/CLI/CLITypePrinter.cs

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Generators.CLI
namespace CppSharp.Generators.CLI
{
public class CLITypePrinterContext : TypePrinterContext
{

4
src/Generator/Generators/CSharp/CSharpGenerator.cs

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
using System;
using System.IO;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Generators.CSharp
namespace CppSharp.Generators.CSharp
{
public class CSharpGenerator : Generator
{

4
src/Generator/Generators/CSharp/CSharpMarshal.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System.Text;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Generators.CSharp
namespace CppSharp.Generators.CSharp
{
public enum CSharpMarshalKind
{

6
src/Generator/Generators/CSharp/CSharpTextTemplate.cs

@ -4,7 +4,7 @@ using System.Globalization; @@ -4,7 +4,7 @@ using System.Globalization;
using System.IO;
using System.Linq;
namespace Cxxi.Generators.CSharp
namespace CppSharp.Generators.CSharp
{
public static class Helpers
{
@ -122,7 +122,7 @@ namespace Cxxi.Generators.CSharp @@ -122,7 +122,7 @@ namespace Cxxi.Generators.CSharp
}
WriteLine("//----------------------------------------------------------------------------");
WriteLine("// This is autogenerated code by Cxxi.");
WriteLine("// This is autogenerated code by CppSharp.");
WriteLine("// Do not edit this file or all your changes will be lost after re-generation.");
WriteLine("//----------------------------------------------------------------------------");
}
@ -544,7 +544,7 @@ namespace Cxxi.Generators.CSharp @@ -544,7 +544,7 @@ namespace Cxxi.Generators.CSharp
NativeLibrary library;
Driver.LibrarySymbols.FindLibraryBySymbol(symbol, out library);
return string.Format("Cxxi.SymbolResolver.ResolveSymbol(\"{0}\", \"{1}\")",
return string.Format("CppSharp.SymbolResolver.ResolveSymbol(\"{0}\", \"{1}\")",
Path.GetFileNameWithoutExtension(library.FileName), symbol);
}

4
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
using System;
using System.Collections.Generic;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Generators.CSharp
namespace CppSharp.Generators.CSharp
{
public enum CSharpTypePrinterContextKind
{

2
src/Generator/Generators/Generator.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
namespace Cxxi.Generators
namespace CppSharp.Generators
{
public enum LanguageGeneratorKind
{

2
src/Generator/Generators/Marshal.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
namespace Cxxi.Generators
namespace CppSharp.Generators
{
public class MarshalContext
{

2
src/Generator/Generators/Template.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
namespace Cxxi.Generators
namespace CppSharp.Generators
{
public abstract class TextTemplate : TextGenerator
{

4
src/Generator/Library.cs

@ -3,9 +3,9 @@ using System.Collections.Generic; @@ -3,9 +3,9 @@ using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text.RegularExpressions;
using Cxxi.Generators;
using CppSharp.Generators;
namespace Cxxi
namespace CppSharp
{
[AttributeUsage(AttributeTargets.Class)]
public class LibraryTransformAttribute : Attribute

2
src/Generator/Parser.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace Cxxi
namespace CppSharp
{
public class Parser
{

2
src/Generator/Passes/CheckAbiParameters.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
namespace Cxxi.Passes
namespace CppSharp.Passes
{
public class CheckAbiParameters : TranslationUnitPass
{

6
src/Generator/Passes/CheckAmbiguousOverloads.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Linq;
using Cxxi.Generators;
using Cxxi.Types;
using CppSharp.Generators;
using CppSharp.Types;
namespace Cxxi.Passes
namespace CppSharp.Passes
{
struct OverloadSignature
{

2
src/Generator/Passes/CheckFlagEnumsPass.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using System;
namespace Cxxi.Passes
namespace CppSharp.Passes
{
class CheckFlagEnumsPass : TranslationUnitPass
{

4
src/Generator/Passes/CheckOperatorsOverloads.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System.Linq;
using Cxxi.Generators.CSharp;
using CppSharp.Generators.CSharp;
namespace Cxxi.Passes
namespace CppSharp.Passes
{
/// <summary>
/// Checks for missing operator overloads required by C#.

2
src/Generator/Passes/CheckTypeReferencesPass.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
namespace Cxxi.Passes
namespace CppSharp.Passes
{
public class CheckTypeReferencesPass : TranslationUnitPass
{

2
src/Generator/Passes/CleanInvalidDeclNamesPass.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System;
using System.Linq;
namespace Cxxi.Passes
namespace CppSharp.Passes
{
public class CleanInvalidDeclNamesPass : TranslationUnitPass
{

2
src/Generator/Passes/CleanUnitPass.cs

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
namespace Cxxi.Passes
namespace CppSharp.Passes
{
public class CleanUnitPass : TranslationUnitPass
{

2
src/Generator/Passes/DuplicatedNamesCheckerPass.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace Cxxi.Passes
namespace CppSharp.Passes
{
public class DuplicatedNamesCheckerPass : TranslationUnitPass
{

2
src/Generator/Passes/FunctionToInstanceMethodPass.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using System;
namespace Cxxi.Passes
namespace CppSharp.Passes
{
/// <summary>
/// This pass will try to hoist functions into classes so they

2
src/Generator/Passes/FunctionToStaticMethodPass.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using System;
namespace Cxxi.Passes
namespace CppSharp.Passes
{
/// <summary>
/// This pass will try to hoist functions as class static methods.

2
src/Generator/Passes/Pass.cs

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@

namespace Cxxi.Passes
namespace CppSharp.Passes
{
/// <summary>
/// Used to provide different types of code transformation on a module

4
src/Generator/Passes/PassBuilder.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System.Collections.Generic;
using Cxxi.Passes;
using CppSharp.Passes;
namespace Cxxi
namespace CppSharp
{
/// <summary>
/// This class is used to build passes that will be run against the AST

2
src/Generator/Passes/RenamePass.cs

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
using System.Text;
using System.Text.RegularExpressions;
namespace Cxxi.Passes
namespace CppSharp.Passes
{
/// <summary>
/// Base class for transform that perform renames of declarations.

4
src/Generator/Passes/ResolveIncompleteDeclsPass.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Passes
namespace CppSharp.Passes
{
public class ResolveIncompleteDeclsPass : TranslationUnitPass
{

4
src/Generator/Passes/SortDeclarationsPass.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi.Passes
namespace CppSharp.Passes
{
class SortDeclarationsPass : TranslationUnitPass
{

2
src/Generator/Types/CppTypePrinter.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace Cxxi.Types
namespace CppSharp.Types
{
public class CppTypePrinter : ITypePrinter<string>, IDeclVisitor<string>
{

2
src/Generator/Types/ITypePrinter.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;
namespace Cxxi.Types
namespace CppSharp.Types
{
public enum TypePrinterContextKind
{

8
src/Generator/Types/Std/Stdlib.cs

@ -1,9 +1,9 @@ @@ -1,9 +1,9 @@
using System;
using Cxxi.Generators;
using Cxxi.Generators.CLI;
using Cxxi.Generators.CSharp;
using CppSharp.Generators;
using CppSharp.Generators.CLI;
using CppSharp.Generators.CSharp;
namespace Cxxi.Types.Std
namespace CppSharp.Types.Std
{
[TypeMap("va_list")]
public class VaList : TypeMap

8
src/Generator/Types/TypeMap.cs

@ -1,10 +1,10 @@ @@ -1,10 +1,10 @@
using System;
using System.Collections.Generic;
using Cxxi.Generators;
using Cxxi.Generators.CLI;
using Cxxi.Generators.CSharp;
using CppSharp.Generators;
using CppSharp.Generators.CLI;
using CppSharp.Generators.CSharp;
namespace Cxxi.Types
namespace CppSharp.Types
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
public class TypeMapAttribute : Attribute

4
src/Generator/Types/Types.cs

@ -1,8 +1,8 @@ @@ -1,8 +1,8 @@
using System.Collections.Generic;
using System.Linq;
using Cxxi.Types;
using CppSharp.Types;
namespace Cxxi
namespace CppSharp
{
/// <summary>
/// This type checker is used to check if a type is complete.

4
src/Generator/Utils/TestsUtils.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using System.IO;
using Cxxi.Generators;
using CppSharp.Generators;
namespace Cxxi.Utils
namespace CppSharp.Utils
{
public abstract class LibraryTest : ILibrary
{

2
src/Generator/Utils/TextGenerator.cs

@ -3,7 +3,7 @@ using System.Collections.Generic; @@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Cxxi
namespace CppSharp
{
public class TextGenerator
{

2
src/Generator/Utils/Utils.cs

@ -4,7 +4,7 @@ using System.Linq; @@ -4,7 +4,7 @@ using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
namespace Cxxi
namespace CppSharp
{
public static class IntHelpers
{

2
src/Parser/Main.cpp

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/************************************************************************
*
* Cxxi
* CppSharp
* Licensed under the simplified BSD license. All rights reserved.
*
************************************************************************/

198
src/Parser/Parser.cpp

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/************************************************************************
*
* Cxxi
* CppSharp
* Licensed under the simplified BSD license. All rights reserved.
*
************************************************************************/
@ -248,18 +248,18 @@ std::string Parser::GetTypeName(const clang::Type* Type) @@ -248,18 +248,18 @@ std::string Parser::GetTypeName(const clang::Type* Type)
return TypeName;
}
Cxxi::TypeQualifiers GetTypeQualifiers(clang::QualType Type)
CppSharp::TypeQualifiers GetTypeQualifiers(clang::QualType Type)
{
Cxxi::TypeQualifiers quals;
CppSharp::TypeQualifiers quals;
quals.IsConst = Type.isLocalConstQualified();
quals.IsRestrict = Type.isLocalRestrictQualified();
quals.IsVolatile = Type.isVolatileQualified();
return quals;
}
Cxxi::QualifiedType GetQualifiedType(clang::QualType qual, Cxxi::Type^ type)
CppSharp::QualifiedType GetQualifiedType(clang::QualType qual, CppSharp::Type^ type)
{
Cxxi::QualifiedType qualType;
CppSharp::QualifiedType qualType;
qualType.Type = type;
qualType.Qualifiers = GetTypeQualifiers(qual);
return qualType;
@ -267,19 +267,19 @@ Cxxi::QualifiedType GetQualifiedType(clang::QualType qual, Cxxi::Type^ type) @@ -267,19 +267,19 @@ Cxxi::QualifiedType GetQualifiedType(clang::QualType qual, Cxxi::Type^ type)
//-----------------------------------//
static Cxxi::AccessSpecifier ConvertToAccess(clang::AccessSpecifier AS)
static CppSharp::AccessSpecifier ConvertToAccess(clang::AccessSpecifier AS)
{
switch(AS)
{
case clang::AS_private:
return Cxxi::AccessSpecifier::Private;
return CppSharp::AccessSpecifier::Private;
case clang::AS_protected:
return Cxxi::AccessSpecifier::Protected;
return CppSharp::AccessSpecifier::Protected;
case clang::AS_public:
return Cxxi::AccessSpecifier::Public;
return CppSharp::AccessSpecifier::Public;
}
return Cxxi::AccessSpecifier::Public;
return CppSharp::AccessSpecifier::Public;
}
static bool HasClassDependentFields(clang::CXXRecordDecl* Record)
@ -302,7 +302,7 @@ static bool HasClassDependentFields(clang::CXXRecordDecl* Record) @@ -302,7 +302,7 @@ static bool HasClassDependentFields(clang::CXXRecordDecl* Record)
return false;
}
Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependent)
CppSharp::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependent)
{
using namespace clang;
using namespace clix;
@ -345,7 +345,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen @@ -345,7 +345,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen
for(auto it = Record->ctor_begin(); it != Record->ctor_end(); ++it)
{
CXXMethodDecl* Ctor = (*it);
Cxxi::Method^ Method = WalkMethodCXX(Ctor);
CppSharp::Method^ Method = WalkMethodCXX(Ctor);
RC->Methods->Add(Method);
}
@ -357,7 +357,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen @@ -357,7 +357,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen
if( isa<CXXConstructorDecl>(M) || isa<CXXDestructorDecl>(M) )
continue;
Cxxi::Method^ Method = WalkMethodCXX(M);
CppSharp::Method^ Method = WalkMethodCXX(M);
RC->Methods->Add(Method);
}
@ -379,7 +379,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen @@ -379,7 +379,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen
{
FieldDecl* FD = (*it);
Cxxi::Field^ Field = WalkFieldCXX(FD, RC);
CppSharp::Field^ Field = WalkFieldCXX(FD, RC);
if (Layout)
Field->Offset = Layout->getFieldOffset(FD->getFieldIndex());
@ -393,7 +393,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen @@ -393,7 +393,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen
auto Decl = *it;
if (!isa<VarDecl>(Decl)) continue;
Cxxi::Variable^ Var = WalkVariable(cast<VarDecl>(Decl));
CppSharp::Variable^ Var = WalkVariable(cast<VarDecl>(Decl));
RC->Variables->Add(Var);
}
@ -403,7 +403,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen @@ -403,7 +403,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen
auto Decl = *it;
if (!isa<FunctionTemplateDecl>(Decl)) continue;
Cxxi::FunctionTemplate^ FT = WalkFunctionTemplate(
CppSharp::FunctionTemplate^ FT = WalkFunctionTemplate(
cast<FunctionTemplateDecl>(Decl));
RC->FunctionTemplates->Add(FT);
}
@ -413,7 +413,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen @@ -413,7 +413,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen
{
clang::CXXBaseSpecifier &BS = *it;
Cxxi::BaseClassSpecifier^ Base = gcnew Cxxi::BaseClassSpecifier();
CppSharp::BaseClassSpecifier^ Base = gcnew CppSharp::BaseClassSpecifier();
Base->Access = ConvertToAccess(BS.getAccessSpecifier());
Base->IsVirtual = BS.isVirtual();
Base->Type = WalkType(BS.getType(), &BS.getTypeSourceInfo()->getTypeLoc());
@ -428,7 +428,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen @@ -428,7 +428,7 @@ Cxxi::Class^ Parser::WalkRecordCXX(clang::CXXRecordDecl* Record, bool IsDependen
//-----------------------------------//
Cxxi::ClassTemplate^ Parser::WalkClassTemplate(clang::ClassTemplateDecl* TD)
CppSharp::ClassTemplate^ Parser::WalkClassTemplate(clang::ClassTemplateDecl* TD)
{
using namespace clang;
using namespace clix;
@ -436,14 +436,14 @@ Cxxi::ClassTemplate^ Parser::WalkClassTemplate(clang::ClassTemplateDecl* TD) @@ -436,14 +436,14 @@ Cxxi::ClassTemplate^ Parser::WalkClassTemplate(clang::ClassTemplateDecl* TD)
auto NS = GetNamespace(TD);
auto Class = WalkRecordCXX(TD->getTemplatedDecl(), /*IsDependent*/true);
Cxxi::ClassTemplate^ CT = gcnew Cxxi::ClassTemplate(Class);
CppSharp::ClassTemplate^ CT = gcnew CppSharp::ClassTemplate(Class);
return CT;
}
//-----------------------------------//
Cxxi::FunctionTemplate^ Parser::WalkFunctionTemplate(clang::FunctionTemplateDecl* TD)
CppSharp::FunctionTemplate^ Parser::WalkFunctionTemplate(clang::FunctionTemplateDecl* TD)
{
using namespace clang;
using namespace clix;
@ -452,14 +452,14 @@ Cxxi::FunctionTemplate^ Parser::WalkFunctionTemplate(clang::FunctionTemplateDecl @@ -452,14 +452,14 @@ Cxxi::FunctionTemplate^ Parser::WalkFunctionTemplate(clang::FunctionTemplateDecl
auto Function = WalkFunction(TD->getTemplatedDecl(), /*IsDependent=*/true,
/*AddToNamespace=*/false);
Cxxi::FunctionTemplate^ FT = gcnew Cxxi::FunctionTemplate(Function);
CppSharp::FunctionTemplate^ FT = gcnew CppSharp::FunctionTemplate(Function);
auto TPL = TD->getTemplateParameters();
for(auto it = TPL->begin(); it != TPL->end(); ++it)
{
auto ND = *it;
auto TP = Cxxi::TemplateParameter();
auto TP = CppSharp::TemplateParameter();
TP.Name = clix::marshalString<clix::E_UTF8>(ND->getNameAsString());
FT->Parameters->Add(TP);
@ -470,7 +470,7 @@ Cxxi::FunctionTemplate^ Parser::WalkFunctionTemplate(clang::FunctionTemplateDecl @@ -470,7 +470,7 @@ Cxxi::FunctionTemplate^ Parser::WalkFunctionTemplate(clang::FunctionTemplateDecl
//-----------------------------------//
static Cxxi::CXXMethodKind GetMethodKindFromDecl(clang::DeclarationName Name)
static CppSharp::CXXMethodKind GetMethodKindFromDecl(clang::DeclarationName Name)
{
using namespace clang;
@ -480,46 +480,46 @@ static Cxxi::CXXMethodKind GetMethodKindFromDecl(clang::DeclarationName Name) @@ -480,46 +480,46 @@ static Cxxi::CXXMethodKind GetMethodKindFromDecl(clang::DeclarationName Name)
case DeclarationName::ObjCZeroArgSelector:
case DeclarationName::ObjCOneArgSelector:
case DeclarationName::ObjCMultiArgSelector:
return Cxxi::CXXMethodKind::Normal;
return CppSharp::CXXMethodKind::Normal;
case DeclarationName::CXXConstructorName:
return Cxxi::CXXMethodKind::Constructor;
return CppSharp::CXXMethodKind::Constructor;
case DeclarationName::CXXDestructorName:
return Cxxi::CXXMethodKind::Destructor;
return CppSharp::CXXMethodKind::Destructor;
case DeclarationName::CXXConversionFunctionName:
return Cxxi::CXXMethodKind::Conversion;
return CppSharp::CXXMethodKind::Conversion;
case DeclarationName::CXXOperatorName:
case DeclarationName::CXXLiteralOperatorName:
return Cxxi::CXXMethodKind::Operator;
return CppSharp::CXXMethodKind::Operator;
case DeclarationName::CXXUsingDirective:
return Cxxi::CXXMethodKind::UsingDirective;
return CppSharp::CXXMethodKind::UsingDirective;
}
return Cxxi::CXXMethodKind::Normal;
return CppSharp::CXXMethodKind::Normal;
}
static Cxxi::CXXOperatorKind GetOperatorKindFromDecl(clang::DeclarationName Name)
static CppSharp::CXXOperatorKind GetOperatorKindFromDecl(clang::DeclarationName Name)
{
using namespace clang;
if (Name.getNameKind() != DeclarationName::CXXOperatorName)
return Cxxi::CXXOperatorKind::None;
return CppSharp::CXXOperatorKind::None;
switch(Name.getCXXOverloadedOperator())
{
#define OVERLOADED_OPERATOR(Name,Spelling,Token,Unary,Binary,MemberOnly) \
case OO_##Name: return Cxxi::CXXOperatorKind::Name;
case OO_##Name: return CppSharp::CXXOperatorKind::Name;
#include "clang/Basic/OperatorKinds.def"
}
return Cxxi::CXXOperatorKind::None;
return CppSharp::CXXOperatorKind::None;
}
Cxxi::Method^ Parser::WalkMethodCXX(clang::CXXMethodDecl* MD)
CppSharp::Method^ Parser::WalkMethodCXX(clang::CXXMethodDecl* MD)
{
using namespace clang;
DeclarationName Name = MD->getDeclName();
Cxxi::Method^ Method = gcnew Cxxi::Method();
CppSharp::Method^ Method = gcnew CppSharp::Method();
Method->Access = ConvertToAccess(MD->getAccess());
Method->Kind = GetMethodKindFromDecl(Name);
Method->OperatorKind = GetOperatorKindFromDecl(Name);
@ -544,7 +544,7 @@ Cxxi::Method^ Parser::WalkMethodCXX(clang::CXXMethodDecl* MD) @@ -544,7 +544,7 @@ Cxxi::Method^ Parser::WalkMethodCXX(clang::CXXMethodDecl* MD)
//-----------------------------------//
Cxxi::Field^ Parser::WalkFieldCXX(clang::FieldDecl* FD, Cxxi::Class^ Class)
CppSharp::Field^ Parser::WalkFieldCXX(clang::FieldDecl* FD, CppSharp::Class^ Class)
{
using namespace clang;
using namespace clix;
@ -552,7 +552,7 @@ Cxxi::Field^ Parser::WalkFieldCXX(clang::FieldDecl* FD, Cxxi::Class^ Class) @@ -552,7 +552,7 @@ Cxxi::Field^ Parser::WalkFieldCXX(clang::FieldDecl* FD, Cxxi::Class^ Class)
auto NS = GetNamespace(FD);
assert(NS && "Expected a valid namespace");
Cxxi::Field^ F = gcnew Cxxi::Field();
CppSharp::Field^ F = gcnew CppSharp::Field();
F->Namespace = NS;
F->Name = marshalString<E_UTF8>(FD->getName());
@ -568,13 +568,13 @@ Cxxi::Field^ Parser::WalkFieldCXX(clang::FieldDecl* FD, Cxxi::Class^ Class) @@ -568,13 +568,13 @@ Cxxi::Field^ Parser::WalkFieldCXX(clang::FieldDecl* FD, Cxxi::Class^ Class)
//-----------------------------------//
Cxxi::Namespace^ Parser::GetNamespace(const clang::NamedDecl* ND)
CppSharp::Namespace^ Parser::GetNamespace(const clang::NamedDecl* ND)
{
using namespace clang;
using namespace clix;
SourceLocation Loc = ND->getLocation();
Cxxi::TranslationUnit^ M = GetModule(Loc);
CppSharp::TranslationUnit^ M = GetModule(Loc);
// If the declaration is at global scope, just early exit.
const DeclContext *Ctx = ND->getDeclContext();
@ -592,7 +592,7 @@ Cxxi::Namespace^ Parser::GetNamespace(const clang::NamedDecl* ND) @@ -592,7 +592,7 @@ Cxxi::Namespace^ Parser::GetNamespace(const clang::NamedDecl* ND)
assert(Contexts.back()->isTranslationUnit());
Contexts.pop_back();
Cxxi::Namespace^ NS = M;
CppSharp::Namespace^ NS = M;
for (auto I = Contexts.rbegin(), E = Contexts.rend(); I != E; ++I)
{
@ -637,9 +637,9 @@ Cxxi::Namespace^ Parser::GetNamespace(const clang::NamedDecl* ND) @@ -637,9 +637,9 @@ Cxxi::Namespace^ Parser::GetNamespace(const clang::NamedDecl* ND)
return NS;
}
static Cxxi::PrimitiveType WalkBuiltinType(const clang::BuiltinType* Builtin)
static CppSharp::PrimitiveType WalkBuiltinType(const clang::BuiltinType* Builtin)
{
using namespace Cxxi;
using namespace CppSharp;
assert(Builtin && "Expected a builtin type");
@ -713,7 +713,7 @@ clang::TypeLoc ResolveTypeLoc(clang::TypeLoc TL, clang::TypeLoc::TypeLocClass Cl @@ -713,7 +713,7 @@ clang::TypeLoc ResolveTypeLoc(clang::TypeLoc TL, clang::TypeLoc::TypeLocClass Cl
return TL;
}
Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
CppSharp::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
bool DesugarType)
{
using namespace clang;
@ -739,7 +739,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -739,7 +739,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
auto Builtin = Type->getAs<clang::BuiltinType>();
assert(Builtin && "Expected a builtin type");
auto BT = gcnew Cxxi::BuiltinType();
auto BT = gcnew CppSharp::BuiltinType();
BT->Type = WalkBuiltinType(Builtin);
return BT;
@ -751,7 +751,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -751,7 +751,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
//auto Name = marshalString<E_UTF8>(GetTagDeclName(ED));
auto TT = gcnew Cxxi::TagType();
auto TT = gcnew CppSharp::TagType();
TT->Declaration = WalkDeclaration(ED, 0, /*IgnoreSystemDecls=*/false);
return TT;
@ -760,8 +760,8 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -760,8 +760,8 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
{
auto Pointer = Type->getAs<clang::PointerType>();
auto P = gcnew Cxxi::PointerType();
P->Modifier = Cxxi::PointerType::TypeModifier::Pointer;
auto P = gcnew CppSharp::PointerType();
P->Modifier = CppSharp::PointerType::TypeModifier::Pointer;
auto Next = TL->getNextTypeLoc();
@ -776,10 +776,10 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -776,10 +776,10 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
TypedefNameDecl* TD = TT->getDecl();
auto TTL = TD->getTypeSourceInfo()->getTypeLoc();
auto TDD = safe_cast<Cxxi::TypedefDecl^>(WalkDeclaration(TD, &TTL,
auto TDD = safe_cast<CppSharp::TypedefDecl^>(WalkDeclaration(TD, &TTL,
/*IgnoreSystemDecls=*/false));
auto Type = gcnew Cxxi::TypedefType();
auto Type = gcnew CppSharp::TypedefType();
Type->Declaration = TDD;
return Type;
@ -795,7 +795,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -795,7 +795,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
auto RT = Type->getAs<clang::RecordType>();
RecordDecl* RD = RT->getDecl();
auto TT = gcnew Cxxi::TagType();
auto TT = gcnew CppSharp::TagType();
TT->Declaration = WalkDeclaration(RD, 0, /*IgnoreSystemDecls=*/false);
return TT;
@ -810,10 +810,10 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -810,10 +810,10 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
{
auto AT = AST->getAsConstantArrayType(QualType);
auto A = gcnew Cxxi::ArrayType();
auto A = gcnew CppSharp::ArrayType();
auto Next = TL->getNextTypeLoc();
A->Type = WalkType(AT->getElementType(), &Next);
A->SizeType = Cxxi::ArrayType::ArraySize::Constant;
A->SizeType = CppSharp::ArrayType::ArraySize::Constant;
A->Size = AST->getConstantArrayElementCount(AT);
return A;
@ -825,12 +825,12 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -825,12 +825,12 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
auto FTL = TL->getAs<FunctionProtoTypeLoc>();
auto RL = FTL.getResultLoc();
auto F = gcnew Cxxi::FunctionType();
auto F = gcnew CppSharp::FunctionType();
F->ReturnType = WalkType(FP->getResultType(), &RL);
for (unsigned i = 0; i < FP->getNumArgs(); ++i)
{
auto FA = gcnew Cxxi::Parameter();
auto FA = gcnew CppSharp::Parameter();
auto PVD = FTL.getArg(i);
auto PTL = PVD->getTypeSourceInfo()->getTypeLoc();
@ -858,7 +858,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -858,7 +858,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
auto MP = Type->getAs<clang::MemberPointerType>();
auto Next = TL->getNextTypeLoc();
auto MPT = gcnew Cxxi::MemberPointerType();
auto MPT = gcnew CppSharp::MemberPointerType();
MPT->Pointee = WalkType(MP->getPointeeType(), &Next);
return MPT;
@ -866,10 +866,10 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -866,10 +866,10 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
case Type::TemplateSpecialization:
{
auto TS = Type->getAs<clang::TemplateSpecializationType>();
auto TST = gcnew Cxxi::TemplateSpecializationType();
auto TST = gcnew CppSharp::TemplateSpecializationType();
TemplateName Name = TS->getTemplateName();
TST->Template = safe_cast<Cxxi::Template^>(WalkDeclaration(
TST->Template = safe_cast<CppSharp::Template^>(WalkDeclaration(
Name.getAsTemplateDecl(), 0, /*IgnoreSystemDecls=*/false));
auto TypeLocClass = TL->getTypeLocClass();
@ -892,7 +892,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -892,7 +892,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
for (unsigned I = 0, E = TS->getNumArgs(); I != E; ++I)
{
const TemplateArgument& TA = TS->getArg(I);
auto Arg = Cxxi::TemplateArgument();
auto Arg = CppSharp::TemplateArgument();
TemplateArgumentLoc ArgLoc;
ArgLoc = TSTL.getArgLoc(I);
@ -901,35 +901,35 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -901,35 +901,35 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
{
case TemplateArgument::Type:
{
Arg.Kind = Cxxi::TemplateArgument::ArgumentKind::Type;
Arg.Kind = CppSharp::TemplateArgument::ArgumentKind::Type;
TypeLoc ArgTL;
ArgTL = ArgLoc.getTypeSourceInfo()->getTypeLoc();
Arg.Type = GetQualifiedType(TA.getAsType(), WalkType(TA.getAsType(), &ArgTL));
break;
}
case TemplateArgument::Declaration:
Arg.Kind = Cxxi::TemplateArgument::ArgumentKind::Declaration;
Arg.Kind = CppSharp::TemplateArgument::ArgumentKind::Declaration;
Arg.Declaration = WalkDeclaration(TA.getAsDecl(), 0);
break;
case TemplateArgument::NullPtr:
Arg.Kind = Cxxi::TemplateArgument::ArgumentKind::NullPtr;
Arg.Kind = CppSharp::TemplateArgument::ArgumentKind::NullPtr;
break;
case TemplateArgument::Integral:
Arg.Kind = Cxxi::TemplateArgument::ArgumentKind::Integral;
Arg.Kind = CppSharp::TemplateArgument::ArgumentKind::Integral;
//Arg.Type = WalkType(TA.getIntegralType(), 0);
Arg.Integral = TA.getAsIntegral().getLimitedValue();
break;
case TemplateArgument::Template:
Arg.Kind = Cxxi::TemplateArgument::ArgumentKind::Template;
Arg.Kind = CppSharp::TemplateArgument::ArgumentKind::Template;
break;
case TemplateArgument::TemplateExpansion:
Arg.Kind = Cxxi::TemplateArgument::ArgumentKind::TemplateExpansion;
Arg.Kind = CppSharp::TemplateArgument::ArgumentKind::TemplateExpansion;
break;
case TemplateArgument::Expression:
Arg.Kind = Cxxi::TemplateArgument::ArgumentKind::Expression;
Arg.Kind = CppSharp::TemplateArgument::ArgumentKind::Expression;
break;
case TemplateArgument::Pack:
Arg.Kind = Cxxi::TemplateArgument::ArgumentKind::Pack;
Arg.Kind = CppSharp::TemplateArgument::ArgumentKind::Pack;
break;
}
@ -942,7 +942,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -942,7 +942,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
{
auto TP = Type->getAs<TemplateTypeParmType>();
auto TPT = gcnew Cxxi::TemplateParameterType();
auto TPT = gcnew CppSharp::TemplateParameterType();
if (auto Ident = TP->getIdentifier())
TPT->Parameter.Name = marshalString<E_UTF8>(Ident->getName());
@ -951,7 +951,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -951,7 +951,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
}
case Type::SubstTemplateTypeParm:
{
auto TPT = gcnew Cxxi::TemplateParameterType();
auto TPT = gcnew CppSharp::TemplateParameterType();
return TPT;
}
case Type::InjectedClassName:
@ -968,8 +968,8 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -968,8 +968,8 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
{
auto LR = Type->getAs<clang::LValueReferenceType>();
auto P = gcnew Cxxi::PointerType();
P->Modifier = Cxxi::PointerType::TypeModifier::LVReference;
auto P = gcnew CppSharp::PointerType();
P->Modifier = CppSharp::PointerType::TypeModifier::LVReference;
TypeLoc Next;
if (!TL->isNull())
@ -984,8 +984,8 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -984,8 +984,8 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
{
auto LR = Type->getAs<clang::RValueReferenceType>();
auto P = gcnew Cxxi::PointerType();
P->Modifier = Cxxi::PointerType::TypeModifier::RVReference;
auto P = gcnew CppSharp::PointerType();
P->Modifier = CppSharp::PointerType::TypeModifier::RVReference;
TypeLoc Next;
if (!TL->isNull())
@ -1015,7 +1015,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL, @@ -1015,7 +1015,7 @@ Cxxi::Type^ Parser::WalkType(clang::QualType QualType, clang::TypeLoc* TL,
//-----------------------------------//
Cxxi::Enumeration^ Parser::WalkEnum(clang::EnumDecl* ED)
CppSharp::Enumeration^ Parser::WalkEnum(clang::EnumDecl* ED)
{
using namespace clang;
using namespace clix;
@ -1033,12 +1033,12 @@ Cxxi::Enumeration^ Parser::WalkEnum(clang::EnumDecl* ED) @@ -1033,12 +1033,12 @@ Cxxi::Enumeration^ Parser::WalkEnum(clang::EnumDecl* ED)
E = NS->FindEnum(Name, /*Create=*/true);
if (ED->isScoped())
E->Modifiers |= Cxxi::Enumeration::EnumModifiers::Scoped;
E->Modifiers |= CppSharp::Enumeration::EnumModifiers::Scoped;
// Get the underlying integer backing the enum.
QualType IntType = ED->getIntegerType();
E->Type = WalkType(IntType, 0);
E->BuiltinType = safe_cast<Cxxi::BuiltinType^>(WalkType(IntType, 0,
E->BuiltinType = safe_cast<CppSharp::BuiltinType^>(WalkType(IntType, 0,
/*DesugarType=*/true));
if (!ED->isThisDeclarationADefinition())
@ -1056,7 +1056,7 @@ Cxxi::Enumeration^ Parser::WalkEnum(clang::EnumDecl* ED) @@ -1056,7 +1056,7 @@ Cxxi::Enumeration^ Parser::WalkEnum(clang::EnumDecl* ED)
if (const RawComment* Comment = AST->getRawCommentForAnyRedecl(ECD))
BriefText = Comment->getBriefText(*AST);
auto EnumItem = gcnew Cxxi::Enumeration::Item();
auto EnumItem = gcnew CppSharp::Enumeration::Item();
EnumItem->Name = marshalString<E_UTF8>(ECD->getNameAsString());
EnumItem->Value = (int) ECD->getInitVal().getLimitedValue();
EnumItem->Comment = marshalString<E_UTF8>(BriefText);
@ -1089,7 +1089,7 @@ clang::CallingConv Parser::GetAbiCallConv(clang::CallingConv CC, @@ -1089,7 +1089,7 @@ clang::CallingConv Parser::GetAbiCallConv(clang::CallingConv CC,
return CC;
}
static Cxxi::CallingConvention ConvertCallConv(clang::CallingConv CC)
static CppSharp::CallingConvention ConvertCallConv(clang::CallingConv CC)
{
using namespace clang;
@ -1097,23 +1097,23 @@ static Cxxi::CallingConvention ConvertCallConv(clang::CallingConv CC) @@ -1097,23 +1097,23 @@ static Cxxi::CallingConvention ConvertCallConv(clang::CallingConv CC)
{
case CC_Default:
case CC_C:
return Cxxi::CallingConvention::C;
return CppSharp::CallingConvention::C;
case CC_X86StdCall:
return Cxxi::CallingConvention::StdCall;
return CppSharp::CallingConvention::StdCall;
case CC_X86FastCall:
return Cxxi::CallingConvention::FastCall;
return CppSharp::CallingConvention::FastCall;
case CC_X86ThisCall:
return Cxxi::CallingConvention::ThisCall;
return CppSharp::CallingConvention::ThisCall;
case CC_X86Pascal:
case CC_AAPCS:
case CC_AAPCS_VFP:
return Cxxi::CallingConvention::Unknown;
return CppSharp::CallingConvention::Unknown;
}
return Cxxi::CallingConvention::Default;
return CppSharp::CallingConvention::Default;
}
void Parser::WalkFunction(clang::FunctionDecl* FD, Cxxi::Function^ F,
void Parser::WalkFunction(clang::FunctionDecl* FD, CppSharp::Function^ F,
bool IsDependent)
{
using namespace clang;
@ -1151,7 +1151,7 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, Cxxi::Function^ F, @@ -1151,7 +1151,7 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, Cxxi::Function^ F,
{
ParmVarDecl* VD = (*it);
auto P = gcnew Cxxi::Parameter();
auto P = gcnew CppSharp::Parameter();
P->Name = marshalString<E_UTF8>(VD->getNameAsString());
TypeLoc PTL;
@ -1165,7 +1165,7 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, Cxxi::Function^ F, @@ -1165,7 +1165,7 @@ void Parser::WalkFunction(clang::FunctionDecl* FD, Cxxi::Function^ F,
}
}
Cxxi::Function^ Parser::WalkFunction(clang::FunctionDecl* FD, bool IsDependent,
CppSharp::Function^ Parser::WalkFunction(clang::FunctionDecl* FD, bool IsDependent,
bool AddToNamespace)
{
using namespace clang;
@ -1177,12 +1177,12 @@ Cxxi::Function^ Parser::WalkFunction(clang::FunctionDecl* FD, bool IsDependent, @@ -1177,12 +1177,12 @@ Cxxi::Function^ Parser::WalkFunction(clang::FunctionDecl* FD, bool IsDependent,
assert(NS && "Expected a valid namespace");
auto Name = marshalString<E_UTF8>(FD->getNameAsString());
Cxxi::Function^ F = NS->FindFunction(Name, /*Create=*/ false);
CppSharp::Function^ F = NS->FindFunction(Name, /*Create=*/ false);
if (F != nullptr)
return F;
F = gcnew Cxxi::Function();
F = gcnew CppSharp::Function();
WalkFunction(FD, F, IsDependent);
if (AddToNamespace)
@ -1248,7 +1248,7 @@ void Parser::WalkAST() @@ -1248,7 +1248,7 @@ void Parser::WalkAST()
//-----------------------------------//
Cxxi::TranslationUnit^ Parser::GetModule(clang::SourceLocation Loc)
CppSharp::TranslationUnit^ Parser::GetModule(clang::SourceLocation Loc)
{
using namespace clang;
using namespace clix;
@ -1324,7 +1324,7 @@ void Parser::WalkMacros(clang::PreprocessingRecord* PR) @@ -1324,7 +1324,7 @@ void Parser::WalkMacros(clang::PreprocessingRecord* PR)
if (Invalid || Expression.empty())
break;
auto macro = gcnew Cxxi::MacroDefinition();
auto macro = gcnew CppSharp::MacroDefinition();
macro->Name = marshalString<E_UTF8>(II->getName())->Trim();
macro->Expression = marshalString<E_UTF8>(Expression)->Trim();
@ -1341,12 +1341,12 @@ void Parser::WalkMacros(clang::PreprocessingRecord* PR) @@ -1341,12 +1341,12 @@ void Parser::WalkMacros(clang::PreprocessingRecord* PR)
//-----------------------------------//
Cxxi::Variable^ Parser::WalkVariable(clang::VarDecl *VD)
CppSharp::Variable^ Parser::WalkVariable(clang::VarDecl *VD)
{
using namespace clang;
using namespace clix;
auto Var = gcnew Cxxi::Variable();
auto Var = gcnew CppSharp::Variable();
Var->Name = marshalString<E_UTF8>(VD->getName());
Var->Access = ConvertToAccess(VD->getAccess());
@ -1361,7 +1361,7 @@ Cxxi::Variable^ Parser::WalkVariable(clang::VarDecl *VD) @@ -1361,7 +1361,7 @@ Cxxi::Variable^ Parser::WalkVariable(clang::VarDecl *VD)
//-----------------------------------//
void Parser::HandleComments(clang::Decl* D, Cxxi::Declaration^ Decl)
void Parser::HandleComments(clang::Decl* D, CppSharp::Declaration^ Decl)
{
using namespace clang;
using namespace clix;
@ -1388,13 +1388,13 @@ void Parser::HandleComments(clang::Decl* D, Cxxi::Declaration^ Decl) @@ -1388,13 +1388,13 @@ void Parser::HandleComments(clang::Decl* D, Cxxi::Declaration^ Decl)
//-----------------------------------//
Cxxi::Declaration^ Parser::WalkDeclarationDef(clang::Decl* D)
CppSharp::Declaration^ Parser::WalkDeclarationDef(clang::Decl* D)
{
return WalkDeclaration(D, 0, /*IgnoreSystemDecls=*/true,
/*CanBeDefinition=*/true);
}
Cxxi::Declaration^ Parser::WalkDeclaration(clang::Decl* D, clang::TypeLoc* TL,
CppSharp::Declaration^ Parser::WalkDeclaration(clang::Decl* D, clang::TypeLoc* TL,
bool IgnoreSystemDecls,
bool CanBeDefinition)
{
@ -1419,7 +1419,7 @@ Cxxi::Declaration^ Parser::WalkDeclaration(clang::Decl* D, clang::TypeLoc* TL, @@ -1419,7 +1419,7 @@ Cxxi::Declaration^ Parser::WalkDeclaration(clang::Decl* D, clang::TypeLoc* TL,
StringRef AnnotationText = Annotation->getAnnotation();
}
Cxxi::Declaration^ Decl;
CppSharp::Declaration^ Decl;
auto Kind = D->getKind();
switch(D->getKind())
@ -1463,7 +1463,7 @@ Cxxi::Declaration^ Parser::WalkDeclaration(clang::Decl* D, clang::TypeLoc* TL, @@ -1463,7 +1463,7 @@ Cxxi::Declaration^ Parser::WalkDeclaration(clang::Decl* D, clang::TypeLoc* TL,
{
auto TS = cast<ClassTemplateSpecializationDecl>(D);
auto CT = gcnew Cxxi::ClassTemplateSpecialization();
auto CT = gcnew CppSharp::ClassTemplateSpecialization();
Decl = CT;
@ -1472,7 +1472,7 @@ Cxxi::Declaration^ Parser::WalkDeclaration(clang::Decl* D, clang::TypeLoc* TL, @@ -1472,7 +1472,7 @@ Cxxi::Declaration^ Parser::WalkDeclaration(clang::Decl* D, clang::TypeLoc* TL,
case Decl::ClassTemplatePartialSpecialization:
{
auto TS = cast<ClassTemplatePartialSpecializationDecl>(D);
auto CT = gcnew Cxxi::ClassTemplatePartialSpecialization();
auto CT = gcnew CppSharp::ClassTemplatePartialSpecialization();
Decl = CT;
break;
}

38
src/Parser/Parser.h

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/************************************************************************
*
* Cxxi
* CppSharp
* Licensed under the simplified BSD license. All rights reserved.
*
************************************************************************/
@ -49,7 +49,7 @@ public ref struct ParserOptions @@ -49,7 +49,7 @@ public ref struct ParserOptions
// C/C++ header file name.
System::String^ FileName;
Cxxi::Library^ Library;
CppSharp::Library^ Library;
// Toolset version - 2005 - 8, 2008 - 9, 2010 - 10, 0 - autoprobe for any.
int ToolSetToUse;
@ -90,7 +90,7 @@ public ref struct ParserResult @@ -90,7 +90,7 @@ public ref struct ParserResult
}
ParserResultKind Kind;
Cxxi::Library^ Library;
CppSharp::Library^ Library;
List<ParserDiagnostic>^ Diagnostics;
};
@ -107,20 +107,20 @@ protected: @@ -107,20 +107,20 @@ protected:
// AST traversers
void WalkAST();
void WalkMacros(clang::PreprocessingRecord* PR);
Cxxi::Declaration^ WalkDeclaration(clang::Decl* D, clang::TypeLoc* = 0,
CppSharp::Declaration^ WalkDeclaration(clang::Decl* D, clang::TypeLoc* = 0,
bool IgnoreSystemDecls = true, bool CanBeDefinition = false);
Cxxi::Declaration^ WalkDeclarationDef(clang::Decl* D);
Cxxi::Enumeration^ WalkEnum(clang::EnumDecl*);
Cxxi::Function^ WalkFunction(clang::FunctionDecl*, bool IsDependent = false,
CppSharp::Declaration^ WalkDeclarationDef(clang::Decl* D);
CppSharp::Enumeration^ WalkEnum(clang::EnumDecl*);
CppSharp::Function^ WalkFunction(clang::FunctionDecl*, bool IsDependent = false,
bool AddToNamespace = true);
Cxxi::Class^ WalkRecordCXX(clang::CXXRecordDecl*, bool IsDependent = false);
Cxxi::Method^ WalkMethodCXX(clang::CXXMethodDecl*);
Cxxi::Field^ WalkFieldCXX(clang::FieldDecl*, Cxxi::Class^);
Cxxi::ClassTemplate^ Parser::WalkClassTemplate(clang::ClassTemplateDecl*);
Cxxi::FunctionTemplate^ Parser::WalkFunctionTemplate(
CppSharp::Class^ WalkRecordCXX(clang::CXXRecordDecl*, bool IsDependent = false);
CppSharp::Method^ WalkMethodCXX(clang::CXXMethodDecl*);
CppSharp::Field^ WalkFieldCXX(clang::FieldDecl*, CppSharp::Class^);
CppSharp::ClassTemplate^ Parser::WalkClassTemplate(clang::ClassTemplateDecl*);
CppSharp::FunctionTemplate^ Parser::WalkFunctionTemplate(
clang::FunctionTemplateDecl*);
Cxxi::Variable^ WalkVariable(clang::VarDecl*);
Cxxi::Type^ WalkType(clang::QualType, clang::TypeLoc* = 0,
CppSharp::Variable^ WalkVariable(clang::VarDecl*);
CppSharp::Type^ WalkType(clang::QualType, clang::TypeLoc* = 0,
bool DesugarType = false);
// Clang helpers
@ -128,18 +128,18 @@ protected: @@ -128,18 +128,18 @@ protected:
std::string GetDeclMangledName(clang::Decl*, clang::TargetCXXABI,
bool IsDependent = false);
std::string GetTypeName(const clang::Type*);
void HandleComments(clang::Decl* D, Cxxi::Declaration^);
void WalkFunction(clang::FunctionDecl* FD, Cxxi::Function^ F,
void HandleComments(clang::Decl* D, CppSharp::Declaration^);
void WalkFunction(clang::FunctionDecl* FD, CppSharp::Function^ F,
bool IsDependent = false);
Cxxi::TranslationUnit^ GetModule(clang::SourceLocation Loc);
Cxxi::Namespace^ GetNamespace(const clang::NamedDecl*);
CppSharp::TranslationUnit^ GetModule(clang::SourceLocation Loc);
CppSharp::Namespace^ GetNamespace(const clang::NamedDecl*);
clang::CallingConv GetAbiCallConv(clang::CallingConv CC,
bool IsInstMethod, bool IsVariadic);
int Index;
gcroot<Cxxi::Library^> Lib;
gcroot<CppSharp::Library^> Lib;
gcroot<ParserOptions^> Opts;
llvm::OwningPtr<clang::CompilerInstance> C;
clang::ASTContext* AST;

2
src/Parser/VSLookup.cpp

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
/************************************************************************
*
* Cxxi
* CppSharp
* Licensed under the simplified BSD license. All rights reserved.
*
************************************************************************/

6
tests/Hello/Hello.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
using Cxxi.Generators;
using Cxxi.Utils;
using CppSharp.Generators;
using CppSharp.Utils;
namespace Cxxi.Tests
namespace CppSharp.Tests
{
public class Hello : LibraryTest
{

14
tests/Hello/Hello.h

@ -1,12 +1,12 @@ @@ -1,12 +1,12 @@
//#include <string>
#if defined(_MSC_VER)
#define CXXI_API __declspec(dllexport)
#define CppSharp_API __declspec(dllexport)
#else
#define CXXI_API
#define CppSharp_API
#endif
class CXXI_API Foo
class CppSharp_API Foo
{
public:
@ -15,21 +15,21 @@ public: @@ -15,21 +15,21 @@ public:
float B;
};
class CXXI_API Foo2 : public Foo
class CppSharp_API Foo2 : public Foo
{
public:
int C;
};
struct CXXI_API Bar
struct CppSharp_API Bar
{
Bar();
int A;
float B;
};
struct CXXI_API Bar2 : public Bar
struct CppSharp_API Bar2 : public Bar
{
int C;
};
@ -39,7 +39,7 @@ enum class Enum @@ -39,7 +39,7 @@ enum class Enum
A = 0, B = 2, C = 5
};
class CXXI_API Hello
class CppSharp_API Hello
{
public:
Hello ();

Loading…
Cancel
Save