r255225 - libclang: correct inverted logic

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 9 22:30:23 PST 2015


Author: compnerd
Date: Thu Dec 10 00:30:23 2015
New Revision: 255225

URL: http://llvm.org/viewvc/llvm-project?rev=255225&view=rev
Log:
libclang: correct inverted logic

The complete dtor is only emitted when there is a virtual destructor.  The test
itself was incorrect, so the issue in the code was not noticed.

Modified:
    cfe/trunk/test/Index/print-cxx-manglings.cpp
    cfe/trunk/tools/libclang/CIndex.cpp

Modified: cfe/trunk/test/Index/print-cxx-manglings.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/print-cxx-manglings.cpp?rev=255225&r1=255224&r2=255225&view=diff
==============================================================================
--- cfe/trunk/test/Index/print-cxx-manglings.cpp (original)
+++ cfe/trunk/test/Index/print-cxx-manglings.cpp Thu Dec 10 00:30:23 2015
@@ -16,10 +16,10 @@ struct s {
 };
 
 // ITANIUM: CXXConstructor=s{{.*}}[mangled=_ZN1sC2Ei] [mangled=_ZN1sC1Ei]
-// ITANIUM: CXXDestructor=~s{{.*}}[mangled=_ZN1sD2Ev] [mangled=_ZN1sD1Ev] [mangled=_ZN1sD0Ev]
+// ITANIUM: CXXDestructor=~s{{.*}}[mangled=_ZN1sD2Ev] [mangled=_ZN1sD1Ev]
 
 // MACHO: CXXConstructor=s{{.*}}[mangled=__ZN1sC2Ei] [mangled=__ZN1sC1Ei]
-// MACHO: CXXDestructor=~s{{.*}}[mangled=__ZN1sD2Ev] [mangled=__ZN1sD1Ev] [mangled=__ZN1sD0Ev]
+// MACHO: CXXDestructor=~s{{.*}}[mangled=__ZN1sD2Ev] [mangled=__ZN1sD1Ev]
 
 // MSVC: CXXConstructor=s{{.*}}[mangled=??0s@@QAE at H@Z]
 // MSVC: CXXDestructor=~s{{.*}}[mangled=??1s@@QAE at XZ]
@@ -31,10 +31,10 @@ struct t {
 };
 
 // ITANIUM: CXXConstructor=t{{.*}}[mangled=_ZN1tC2Ei] [mangled=_ZN1tC1Ei]
-// ITANIUM: CXXDestructor=~t{{.*}}[mangled=_ZN1tD2Ev] [mangled=_ZN1tD1Ev]
+// ITANIUM: CXXDestructor=~t{{.*}}[mangled=_ZN1tD2Ev] [mangled=_ZN1tD1Ev] [mangled=_ZN1tD0Ev]
 
 // MACHO: CXXConstructor=t{{.*}}[mangled=__ZN1tC2Ei] [mangled=__ZN1tC1Ei]
-// MACHO: CXXDestructor=~t{{.*}}[mangled=__ZN1tD2Ev] [mangled=__ZN1tD1Ev]
+// MACHO: CXXDestructor=~t{{.*}}[mangled=__ZN1tD2Ev] [mangled=__ZN1tD1Ev] [mangled=__ZN1tD0Ev]
 
 // MSVC: CXXConstructor=t{{.*}}[mangled=??0t@@QAE at H@Z]
 // MSVC: CXXDestructor=~t{{.*}}[mangled=??1t@@UAE at XZ]
@@ -46,10 +46,10 @@ struct u {
 };
 
 // ITANIUM: CXXConstructor=u{{.*}}[mangled=_ZN1uC2Ev]
-// ITANIUM: CXXDestructor=~u{{.*}}[mangled=_ZN1uD2Ev] [mangled=_ZN1uD1Ev]
+// ITANIUM: CXXDestructor=~u{{.*}}[mangled=_ZN1uD2Ev] [mangled=_ZN1uD1Ev] [mangled=_ZN1uD0Ev]
 
 // MACHO: CXXConstructor=u{{.*}}[mangled=__ZN1uC2Ev]
-// MACHO: CXXDestructor=~u{{.*}}[mangled=__ZN1uD2Ev] [mangled=__ZN1uD1Ev]
+// MACHO: CXXDestructor=~u{{.*}}[mangled=__ZN1uD2Ev] [mangled=__ZN1uD1Ev] [mangled=__ZN1uD0Ev]
 
 // MSVC: CXXConstructor=u{{.*}}[mangled=??0u@@QAE at XZ]
 // MSVC: CXXDestructor=~u{{.*}}[mangled=??1u@@UAE at XZ]

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=255225&r1=255224&r2=255225&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Dec 10 00:30:23 2015
@@ -4025,8 +4025,7 @@ CXStringSet *clang_Cursor_getCXXMangling
     Manglings.emplace_back(getMangledStructor(M, DL, DD, Dtor_Base));
     if (Ctx.getTargetInfo().getCXXABI().isItaniumFamily()) {
       Manglings.emplace_back(getMangledStructor(M, DL, DD, Dtor_Complete));
-
-      if (!DD->isVirtual())
+      if (DD->isVirtual())
         Manglings.emplace_back(getMangledStructor(M, DL, DD, Dtor_Deleting));
     }
   }




More information about the cfe-commits mailing list