diff options
Diffstat (limited to 'contrib/llvm/tools/clang/lib/AST/ItaniumCXXABI.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/AST/ItaniumCXXABI.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/contrib/llvm/tools/clang/lib/AST/ItaniumCXXABI.cpp b/contrib/llvm/tools/clang/lib/AST/ItaniumCXXABI.cpp index c3fa466..bed02b4 100644 --- a/contrib/llvm/tools/clang/lib/AST/ItaniumCXXABI.cpp +++ b/contrib/llvm/tools/clang/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 { |