From d1307a532f4f88f46b343755cc864dc70dc50dea Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Thu, 1 Feb 2024 11:21:52 +0000 Subject: [PATCH] Add support for AArch64 C++ ABI. --- src/AST/ASTContext.cs | 1 + .../CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs | 7 ++++--- .../CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs | 7 ++++--- .../CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs | 7 ++++--- .../CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs | 7 ++++--- .../Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs | 7 ++++--- .../CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs | 7 ++++--- src/CppParser/Decl.h | 1 + src/CppParser/Parser.cpp | 4 ++++ src/Generator/AST/VTables.cs | 1 + src/Parser/ASTConverter.cs | 2 ++ 11 files changed, 33 insertions(+), 18 deletions(-) diff --git a/src/AST/ASTContext.cs b/src/AST/ASTContext.cs index 827ce261f..a9cb6831d 100644 --- a/src/AST/ASTContext.cs +++ b/src/AST/ASTContext.cs @@ -10,6 +10,7 @@ public enum CppAbi Itanium, Microsoft, ARM, + AArch64, iOS, iOS64, WebAssembly diff --git a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs index 2f075705a..f11b94cdc 100644 --- a/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs index 80f6d22dd..951d7a1f5 100644 --- a/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/i686-pc-win32-msvc/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs index 5f7e6c23c..6c8c1e3e4 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-apple-darwin12.4.0/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs index c4efef79d..a962c0034 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu-cxx11abi/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs index 1aec7530f..832b9e9ef 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-linux-gnu/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs index c626a8ec5..436fe3946 100644 --- a/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs +++ b/src/CppParser/Bindings/CSharp/x86_64-pc-win32-msvc/CppSharp.CppParser.cs @@ -6401,9 +6401,10 @@ public enum CppAbi Itanium = 0, Microsoft = 1, ARM = 2, - iOS = 3, - iOS64 = 4, - WebAssembly = 5 + AArch64 = 3, + iOS = 4, + iOS64 = 5, + WebAssembly = 6 } public enum RecordArgABI diff --git a/src/CppParser/Decl.h b/src/CppParser/Decl.h index e8665ca7d..2a26940a7 100644 --- a/src/CppParser/Decl.h +++ b/src/CppParser/Decl.h @@ -471,6 +471,7 @@ namespace CppSharp Itanium, Microsoft, ARM, + AArch64, iOS, iOS64, WebAssembly diff --git a/src/CppParser/Parser.cpp b/src/CppParser/Parser.cpp index 06b39aa12..02b83ebb8 100644 --- a/src/CppParser/Parser.cpp +++ b/src/CppParser/Parser.cpp @@ -100,6 +100,8 @@ static CppAbi GetClassLayoutAbi(clang::TargetCXXABI::Kind abi) return CppAbi::Itanium; case clang::TargetCXXABI::GenericARM: return CppAbi::ARM; + case clang::TargetCXXABI::GenericAArch64: + return CppAbi::AArch64; case clang::TargetCXXABI::iOS: return CppAbi::iOS; case clang::TargetCXXABI::AppleARM64: @@ -231,6 +233,8 @@ ConvertToClangTargetCXXABI(CppSharp::CppParser::AST::CppAbi abi) return TargetCXXABI::Microsoft; case CppSharp::CppParser::AST::CppAbi::ARM: return TargetCXXABI::GenericARM; + case CppSharp::CppParser::AST::CppAbi::AArch64: + return TargetCXXABI::GenericARM; case CppSharp::CppParser::AST::CppAbi::iOS: return TargetCXXABI::iOS; case CppSharp::CppParser::AST::CppAbi::iOS64: diff --git a/src/Generator/AST/VTables.cs b/src/Generator/AST/VTables.cs index 93e59ed9d..59bc2909c 100644 --- a/src/Generator/AST/VTables.cs +++ b/src/Generator/AST/VTables.cs @@ -15,6 +15,7 @@ public static List GatherVTableMethodEntries(Class @class) case CppAbi.Microsoft: return GatherVTableMethodsMS(@class); case CppAbi.Itanium: + default: return GatherVTableMethodsItanium(@class); } diff --git a/src/Parser/ASTConverter.cs b/src/Parser/ASTConverter.cs index ea827d097..f74799ef1 100644 --- a/src/Parser/ASTConverter.cs +++ b/src/Parser/ASTConverter.cs @@ -1719,6 +1719,8 @@ AST.CppAbi VisitCppAbi(CppAbi abi) return AST.CppAbi.Microsoft; case CppAbi.ARM: return AST.CppAbi.ARM; + case CppAbi.AArch64: + return AST.CppAbi.AArch64; case CppAbi.iOS: return AST.CppAbi.iOS; case CppAbi.iOS64: