[PATCH] D70575: [Clang] Define Fuchsia C++ABI
Petr Hosek via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 21 16:10:47 PST 2019
phosek created this revision.
phosek added a reviewer: leonardchan.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
It is a modified version of the Itanium ABI. The only change is that
constructors and destructors return 'this'.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70575
Files:
clang/include/clang/Basic/TargetCXXABI.h
clang/lib/Basic/Targets/OSTargets.h
clang/lib/CodeGen/ItaniumCXXABI.cpp
Index: clang/lib/CodeGen/ItaniumCXXABI.cpp
===================================================================
--- clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -487,6 +487,19 @@
bool shouldRTTIBeUnique() const override { return false; }
};
+class FuchsiaCXXABI final : public ItaniumCXXABI {
+public:
+ explicit FuchsiaCXXABI(CodeGen::CodeGenModule &CGM)
+ : ItaniumCXXABI(CGM) {}
+
+private:
+ bool HasThisReturn(GlobalDecl GD) const override {
+ return isa<CXXConstructorDecl>(GD.getDecl()) ||
+ (isa<CXXDestructorDecl>(GD.getDecl()) &&
+ GD.getDtorType() != Dtor_Deleting);
+ }
+};
+
class WebAssemblyCXXABI final : public ItaniumCXXABI {
public:
explicit WebAssemblyCXXABI(CodeGen::CodeGenModule &CGM)
@@ -516,6 +529,9 @@
case TargetCXXABI::iOS64:
return new iOS64CXXABI(CGM);
+ case TargetCXXABI::Fuchsia:
+ return new FuchsiaCXXABI(CGM);
+
// Note that AArch64 uses the generic ItaniumCXXABI class since it doesn't
// include the other 32-bit ARM oddities: constructor/destructor return values
// and array cookies.
Index: clang/lib/Basic/Targets/OSTargets.h
===================================================================
--- clang/lib/Basic/Targets/OSTargets.h
+++ clang/lib/Basic/Targets/OSTargets.h
@@ -808,6 +808,7 @@
FuchsiaTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts)
: OSTargetInfo<Target>(Triple, Opts) {
this->MCountName = "__mcount";
+ this->TheCXXABI.set(TargetCXXABI::Fuchsia);
}
};
Index: clang/include/clang/Basic/TargetCXXABI.h
===================================================================
--- clang/include/clang/Basic/TargetCXXABI.h
+++ clang/include/clang/Basic/TargetCXXABI.h
@@ -103,6 +103,12 @@
/// of these details is necessarily final yet.
WebAssembly,
+ /// The Fuchsia ABI is a modified version of the Itanium ABI.
+ ///
+ /// The relevant changes from the Itanium ABI are:
+ /// - constructors and destructors return 'this', as in ARM.
+ Fuchsia,
+
/// The Microsoft ABI is the ABI used by Microsoft Visual Studio (and
/// compatible compilers).
///
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70575.230556.patch
Type: text/x-patch
Size: 2182 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191122/bd31381b/attachment.bin>
More information about the cfe-commits
mailing list