summaryrefslogtreecommitdiffstats
path: root/lib/AST/ItaniumCXXABI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AST/ItaniumCXXABI.cpp')
-rw-r--r--lib/AST/ItaniumCXXABI.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/AST/ItaniumCXXABI.cpp b/lib/AST/ItaniumCXXABI.cpp
index c3fa466..bed02b4 100644
--- a/lib/AST/ItaniumCXXABI.cpp
+++ b/lib/AST/ItaniumCXXABI.cpp
@@ -19,7 +19,10 @@
#include "CXXABI.h"
#include "clang/AST/ASTContext.h"
+#include "clang/AST/RecordLayout.h"
+#include "clang/AST/DeclCXX.h"
#include "clang/AST/Type.h"
+#include "clang/Basic/TargetInfo.h"
using namespace clang;
@@ -35,6 +38,24 @@ public:
if (Pointee->isFunctionType()) return 2;
return 1;
}
+
+ CallingConv getDefaultMethodCallConv() const {
+ return CC_C;
+ }
+
+ // We cheat and just check that the class has a vtable pointer, and that it's
+ // only big enough to have a vtable pointer and nothing more (or less).
+ bool isNearlyEmpty(const CXXRecordDecl *RD) const {
+
+ // Check that the class has a vtable pointer.
+ if (!RD->isDynamicClass())
+ return false;
+
+ const ASTRecordLayout &Layout = Context.getASTRecordLayout(RD);
+ CharUnits PointerSize =
+ Context.toCharUnitsFromBits(Context.Target.getPointerWidth(0));
+ return Layout.getNonVirtualSize() == PointerSize;
+ }
};
class ARMCXXABI : public ItaniumCXXABI {
OpenPOWER on IntegriCloud