aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorCharles Davis <cdavis@mines.edu>2010-10-29 03:25:11 +0000
committerCharles Davis <cdavis@mines.edu>2010-10-29 03:25:11 +0000
commit424ae9882e8a6eecc9dfe7c2d8623e72b2563873 (patch)
tree85da91ccd08c960c4339ea1c8ab9793fa5564e93 /lib
parent74faec22ec84c54bcbd82cb6c48b72cb466b945f (diff)
Add a hook to the CXXABI object to get the default method calling convention.
This isn't used yet, because someone more experienced than I needs to look at the type system about gutting getCanonicalCallConv(). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117638 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/AST/CXXABI.h5
-rw-r--r--lib/AST/ItaniumCXXABI.cpp4
-rw-r--r--lib/AST/MicrosoftCXXABI.cpp8
3 files changed, 17 insertions, 0 deletions
diff --git a/lib/AST/CXXABI.h b/lib/AST/CXXABI.h
index 4b38d7afb6..5326cd4826 100644
--- a/lib/AST/CXXABI.h
+++ b/lib/AST/CXXABI.h
@@ -15,6 +15,8 @@
#ifndef LLVM_CLANG_AST_CXXABI_H
#define LLVM_CLANG_AST_CXXABI_H
+#include "clang/AST/Type.h"
+
namespace clang {
class ASTContext;
@@ -28,6 +30,9 @@ public:
/// Returns the size of a member pointer in multiples of the target
/// pointer size.
virtual unsigned getMemberPointerSize(const MemberPointerType *MPT) const = 0;
+
+ /// Returns the default calling convention for C++ methods.
+ virtual CallingConv getDefaultMethodCallConv() const = 0;
};
/// Creates an instance of a C++ ABI class.
diff --git a/lib/AST/ItaniumCXXABI.cpp b/lib/AST/ItaniumCXXABI.cpp
index c3fa466653..f5f5f438e7 100644
--- a/lib/AST/ItaniumCXXABI.cpp
+++ b/lib/AST/ItaniumCXXABI.cpp
@@ -35,6 +35,10 @@ public:
if (Pointee->isFunctionType()) return 2;
return 1;
}
+
+ CallingConv getDefaultMethodCallConv() const {
+ return CC_C;
+ }
};
class ARMCXXABI : public ItaniumCXXABI {
diff --git a/lib/AST/MicrosoftCXXABI.cpp b/lib/AST/MicrosoftCXXABI.cpp
index 87b7767392..b1f032b897 100644
--- a/lib/AST/MicrosoftCXXABI.cpp
+++ b/lib/AST/MicrosoftCXXABI.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "CXXABI.h"
+#include "clang/Basic/TargetInfo.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/Type.h"
#include "clang/AST/DeclCXX.h"
@@ -26,6 +27,13 @@ public:
MicrosoftCXXABI(ASTContext &Ctx) : Context(Ctx) { }
unsigned getMemberPointerSize(const MemberPointerType *MPT) const;
+
+ CallingConv getDefaultMethodCallConv() const {
+ if (Context.Target.getTriple().getArch() == llvm::Triple::x86)
+ return CC_X86ThisCall;
+ else
+ return CC_C;
+ }
};
}