Alignment = NewAlignment;
}
+static bool MethodHasBody(const CXXMethodDecl *MD, const FunctionDecl *&fn) {
+ // Simple case: function has a body
+ if (MD->getBody(fn))
+ return true;
+
+ // Complex case: function is an instantiation of a function which has a
+ // body, but the definition hasn't been instantiated.
+ const FunctionDecl *PatternDecl = MD->getTemplateInstantiationPattern();
+ if (PatternDecl && PatternDecl->getBody(fn))
+ return true;
+
+ return false;
+}
+
static const CXXMethodDecl *GetKeyFunction(const CXXRecordDecl *RD) {
if (!RD->isDynamicClass())
return 0;
continue;
const FunctionDecl *fn;
- if (MD->getBody(fn) && !fn->isOutOfLine())
+ if (MethodHasBody(MD, fn) && !fn->isOutOfLine())
continue;
// We found it.
--- /dev/null
+// RUN: clang-cc %s -emit-llvm -o - | FileCheck %s
+
+template<class T> class A {
+ A() {}
+ virtual void a() {}
+};
+class B : A<int> {
+ B();
+};
+B::B() {}
+
+// CHECK: @_ZTV1AIiE = linkonce_odr constant