By C++ standard, the vtable should be generated if the first non-inline
virtual function is defined in the TU. Current version of clang doesn't
generate vtable if the first virtual function is defaulted, because the
key function is regarded as the defaulted function.
Patch by Li Kan!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161236
91177308-0d34-0410-b5e6-
96231b3b80d8
if (MD->hasInlineBody())
continue;
+ if (!MD->isUserProvided())
+ continue;
+
// We found it.
return MD;
}
--- /dev/null
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - -std=c++11 | FileCheck %s
+// PR13424
+
+struct X {
+ virtual ~X() = default;
+ virtual void f();
+};
+
+void X::f() {}
+
+// CHECK: @_ZTV1X = unnamed_addr constant