]> granicus.if.org Git - clang/commitdiff
Add mangling for variadic functions and conversion functions
authorDouglas Gregor <dgregor@apple.com>
Fri, 13 Feb 2009 01:28:03 +0000 (01:28 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 13 Feb 2009 01:28:03 +0000 (01:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64425 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Mangle.cpp
test/CodeGen/overloadable.c

index a97ac58dd7815c73e7e2ffac7eca819d35526b44..9ad98d787a8b0c0a285e4786cb814b376a61c095 100644 (file)
@@ -161,7 +161,9 @@ void CXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND) {
     break;
 
   case DeclarationName::CXXConversionFunctionName:
-    assert(false && "Not sure how to mangle conversion functions yet");
+    // <operator-name> ::= cv <type>   # (cast) 
+    Out << "cv";
+    mangleType(Context.getCanonicalType(Name.getCXXNameType()));
     break;
 
   case DeclarationName::CXXOperatorName:
@@ -171,6 +173,7 @@ void CXXNameMangler::mangleUnqualifiedName(const NamedDecl *ND) {
 
   case DeclarationName::CXXUsingDirective:
     assert(false && "Can't mangle a using directive name!");
+    break;
   }
 }
 
@@ -398,7 +401,6 @@ void CXXNameMangler::mangleType(const BuiltinType *T) {
   //                 ::= d  # double
   //                 ::= e  # long double, __float80
   // UNSUPPORTED:    ::= g  # __float128
-  // NOT HERE:       ::= z  # ellipsis
   // UNSUPPORTED:    ::= Dd # IEEE 754r decimal floating point (64 bits)
   // UNSUPPORTED:    ::= De # IEEE 754r decimal floating point (128 bits)
   // UNSUPPORTED:    ::= Df # IEEE 754r decimal floating point (32 bits)
@@ -455,6 +457,10 @@ void CXXNameMangler::mangleBareFunctionType(const FunctionType *T,
                                          ArgEnd = Proto->arg_type_end(); 
        Arg != ArgEnd; ++Arg)
     mangleType(*Arg);
+
+  // <builtin-type>      ::= z  # ellipsis
+  if (Proto->isVariadic())
+    Out << 'z';
 }
 
 void CXXNameMangler::mangleType(const TagType *T) {
index 6b1cb351e6302a51cb5ab85898bf3d9977a36448..4e24c91a79f8e7a743deee4dbaa45706c811c4de 100644 (file)
@@ -9,6 +9,8 @@ v4hi __attribute__((overloadable)) f(v4hi x) { return x; }
 struct X { };
 void  __attribute__((overloadable)) f(struct X (*ptr)[10]) { }
 
+void __attribute__((overloadable)) f(int x, int y, ...) { }
+
 int main() {
   int iv = 17;
   float fv = 3.0f;