]> granicus.if.org Git - clang/commitdiff
Correctly mangle variadic functions that don't have any other parameters.
authorAnders Carlsson <andersca@mac.com>
Wed, 2 Jun 2010 04:40:13 +0000 (04:40 +0000)
committerAnders Carlsson <andersca@mac.com>
Wed, 2 Jun 2010 04:40:13 +0000 (04:40 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105311 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/Mangle.cpp
test/CodeGenCXX/mangle.cpp

index 4d98deec3d3ba2beb4697840fb1cc4fce4ead83b..fa42b638e074a4356b5bcfaa676958b2dc2d31a7 100644 (file)
@@ -1143,7 +1143,8 @@ void CXXNameMangler::mangleBareFunctionType(const FunctionType *T,
   if (MangleReturnType)
     mangleType(Proto->getResultType());
 
-  if (Proto->getNumArgs() == 0) {
+  if (Proto->getNumArgs() == 0 && !Proto->isVariadic()) {
+    //   <builtin-type> ::= v  # void
     Out << 'v';
     return;
   }
index 8f3d3568488438468b6ecbe950c713eed1fc5aa6..9d153b59b0169cf1ddf153b6965e85a05b6c1354 100644 (file)
@@ -477,3 +477,15 @@ namespace test10 {
   // CHECK: define weak_odr void @_ZN6test101fILc3EEEvNS_1SIXquLb0ELc97ET_EEE(
   template void f<(char) 3>(struct S<3>);
 }
+
+namespace test11 {
+  // CHECK: @_ZN6test111fEz
+  void f(...) { }
+
+  struct A {
+    void f(...);
+  };
+  
+  // CHECK: @_ZN6test111A1fEz
+  void A::f(...) { }
+}