[LLVMbugs] [Bug 16233] New: [-cxx-abi microsoft] Wrong function type for the deleting destructor?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 5 04:53:26 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16233

            Bug ID: 16233
           Summary: [-cxx-abi microsoft] Wrong function type for the
                    deleting destructor?
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: timurrrr at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In the Itanium ABI, all the destructor types have the same function prototype,
including argument types.

In the Microsoft ABI however the deleting destructor takes an implicit argument
whilst the vbase and "simple" destructor take no extra arguments.

As of r183303, Clang has the wrong function type for the deleting destructor,
see below.

=== test.cpp ===
struct ABC {
  virtual ~ABC() {}
};

void foo() {
  ABC z;
}
================


=== patch to clang ===
Index: lib/AST/MicrosoftMangle.cpp
===================================================================
--- lib/AST/MicrosoftMangle.cpp    (revision 183303)
+++ lib/AST/MicrosoftMangle.cpp    (working copy)
@@ -11,6 +11,8 @@
 //

//===----------------------------------------------------------------------===//

+#include <stdio.h>
+
 #include "clang/AST/Mangle.h"
 #include "clang/AST/ASTContext.h"
 #include "clang/AST/Attr.h"
@@ -1187,6 +1189,12 @@
   // <return-type> ::= <type>
   //               ::= @ # structors (they have no declared return type)
   if (IsStructor) {
+    if (isa<CXXDestructorDecl>(D)) {
+      fprintf(stderr, "Dtor type = %s:\n",
+              StructorType == Dtor_Deleting ? "Deleting" : "Complete");
+      D->dump();
+      fprintf(stderr, "\n");
+    }
     if (isa<CXXDestructorDecl>(D) && D == Structor &&
         StructorType == Dtor_Deleting) {
       // The scalar deleting destructor takes an extra int argument.
======================

$ clang++ -cc1 -cxx-abi microsoft -fno-rtti -emit-llvm -o zz test.cpp
Dtor type = Complete:
CXXDestructorDecl 0x59e1c10 <test.cpp:2:3, col:19> ~ABC 'void (void)' virtual
`-CompoundStmt 0x5a16978 <col:18, col:19>

Dtor type = Deleting:
CXXDestructorDecl 0x59e1c10 <test.cpp:2:3, col:19> ~ABC 'void (void)' virtual
`-CompoundStmt 0x5a16978 <col:18, col:19>

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130605/ccadd320/attachment.html>


More information about the llvm-bugs mailing list