[cfe-commits] r145581 - in /cfe/trunk: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/mangle-ms.cpp
Michael J. Spencer
bigcheesegs at gmail.com
Thu Dec 1 01:55:00 PST 2011
Author: mspencer
Date: Thu Dec 1 03:55:00 2011
New Revision: 145581
URL: http://llvm.org/viewvc/llvm-project?rev=145581&view=rev
Log:
Add Microsoft mangling of constructors and destructors. Patch by Dmitry!
Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-ms.cpp
Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=145581&r1=145580&r2=145581&view=diff
==============================================================================
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Thu Dec 1 03:55:00 2011
@@ -335,10 +335,12 @@
llvm_unreachable("Can't mangle Objective-C selector names here!");
case DeclarationName::CXXConstructorName:
- llvm_unreachable("Can't mangle constructors yet!");
+ Out << "?0";
+ break;
case DeclarationName::CXXDestructorName:
- llvm_unreachable("Can't mangle destructors yet!");
+ Out << "?1";
+ break;
case DeclarationName::CXXConversionFunctionName:
// <operator-name> ::= ?B # (cast)
@@ -1168,13 +1170,15 @@
}
void MicrosoftMangleContext::mangleCXXCtor(const CXXConstructorDecl *D,
CXXCtorType Type,
- raw_ostream &) {
- llvm_unreachable("Can't yet mangle constructors!");
+ raw_ostream & Out) {
+ MicrosoftCXXNameMangler mangler(*this, Out);
+ mangler.mangle(D);
}
void MicrosoftMangleContext::mangleCXXDtor(const CXXDestructorDecl *D,
CXXDtorType Type,
- raw_ostream &) {
- llvm_unreachable("Can't yet mangle destructors!");
+ raw_ostream & Out) {
+ MicrosoftCXXNameMangler mangler(*this, Out);
+ mangler.mangle(D);
}
void MicrosoftMangleContext::mangleReferenceTemporary(const clang::VarDecl *,
raw_ostream &) {
Modified: cfe/trunk/test/CodeGenCXX/mangle-ms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms.cpp?rev=145581&r1=145580&r2=145581&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-ms.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-ms.cpp Thu Dec 1 03:55:00 2011
@@ -28,7 +28,18 @@
public:
static const volatile char f;
int operator+(int a);
-};
+ foo(){}
+//CHECK: @"\01??0foo@@QAE at XZ"
+
+ ~foo(){}
+//CHECK: @"\01??1foo@@QAE at XZ"
+
+ foo(int i){}
+//CHECK: @"\01??0foo@@QAE at H@Z"
+
+ foo(char *q){}
+//CHECK: @"\01??0foo@@QAE at PAD@Z"
+}f,s1(1),s2((char*)0);
struct bar {
static int g;
More information about the cfe-commits
mailing list