aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorCharles Davis <cdavis@mines.edu>2010-11-09 18:04:24 +0000
committerCharles Davis <cdavis@mines.edu>2010-11-09 18:04:24 +0000
commitee743f903858e337434ac0335f147f4de4ecae05 (patch)
treea8a3906857c0bc46c4bf0911c4c4fe03b73eea2a /lib/CodeGen
parent9284d215022457ba867080a713f08f026d89ea17 (diff)
Use the right calling convention when mangling names in the Microsoft C++
mangler. Now member functions and pointers thereof have their calling convention mangled as __thiscall if they have the default CC (even though, they technically still have the __cdecl CC). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@118598 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/MicrosoftCXXABI.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/CodeGen/MicrosoftCXXABI.cpp b/lib/CodeGen/MicrosoftCXXABI.cpp
index baa6ed3f82..dd2f1cb134 100644
--- a/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -72,7 +72,7 @@ private:
void mangleType(const ArrayType *T, bool IsGlobal);
void mangleExtraDimensions(QualType T);
void mangleFunctionClass(const FunctionDecl *FD);
- void mangleCallingConvention(const FunctionType *T);
+ void mangleCallingConvention(const FunctionType *T, bool IsInstMethod = false);
void mangleThrowSpecification(const FunctionProtoType *T);
};
@@ -803,7 +803,7 @@ void MicrosoftCXXNameMangler::mangleType(const FunctionType *T,
if (IsInstMethod)
mangleQualifiers(Qualifiers::fromCVRMask(Proto->getTypeQuals()), false);
- mangleCallingConvention(T);
+ mangleCallingConvention(T, IsInstMethod);
// <return-type> ::= <type>
// ::= @ # structors (they have no declared return type)
@@ -898,7 +898,8 @@ void MicrosoftCXXNameMangler::mangleFunctionClass(const FunctionDecl *FD) {
} else
Out << 'Y';
}
-void MicrosoftCXXNameMangler::mangleCallingConvention(const FunctionType *T) {
+void MicrosoftCXXNameMangler::mangleCallingConvention(const FunctionType *T,
+ bool IsInstMethod) {
// <calling-convention> ::= A # __cdecl
// ::= B # __export __cdecl
// ::= C # __pascal
@@ -914,7 +915,10 @@ void MicrosoftCXXNameMangler::mangleCallingConvention(const FunctionType *T) {
// that keyword. (It didn't actually export them, it just made them so
// that they could be in a DLL and somebody from another module could call
// them.)
- switch (T->getCallConv()) {
+ CallingConv CC = T->getCallConv();
+ if (CC == CC_Default)
+ CC = IsInstMethod ? getASTContext().getDefaultMethodCallConv() : CC_C;
+ switch (CC) {
case CC_Default:
case CC_C: Out << 'A'; break;
case CC_X86Pascal: Out << 'C'; break;