Mangle Objective-C interfaces correctly (where correctly refers to what gcc does)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66349 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp
index 525f0fe..490936f 100644
--- a/lib/CodeGen/Mangle.cpp
+++ b/lib/CodeGen/Mangle.cpp
@@ -18,6 +18,7 @@
#include "clang/AST/ASTContext.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclCXX.h"
+#include "clang/AST/DeclObjC.h"
#include "clang/Basic/SourceManager.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/raw_ostream.h"
@@ -49,6 +50,7 @@
void mangleType(const ArrayType *T);
void mangleType(const MemberPointerType *T);
void mangleType(const TemplateTypeParmType *T);
+ void mangleType(const ObjCInterfaceType *T);
void mangleExpression(Expr *E);
};
}
@@ -377,6 +379,9 @@
// GNU extension: vector types
Out << "U8__vector";
mangleType(VT->getElementType());
+ } else if (const ObjCInterfaceType *IT =
+ dyn_cast<ObjCInterfaceType>(T.getTypePtr())) {
+ mangleType(IT);
}
// FIXME: ::= G <type> # imaginary (C 2000)
// FIXME: ::= U <source-name> <type> # vendor extended type qualifier
@@ -504,6 +509,10 @@
Out << 'T' << (T->getIndex() - 1) << '_';
}
+void CXXNameMangler::mangleType(const ObjCInterfaceType *T) {
+ mangleSourceName(T->getDecl()->getIdentifier());
+}
+
void CXXNameMangler::mangleExpression(Expr *E) {
assert(false && "Cannot mangle expressions yet");
}