Move helper onto CXXMethodDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90716 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 5064ec5..766cb01 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -644,6 +644,25 @@
   return C.getPointerType(ClassTy);
 }
 
+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;
+}
+
+bool CXXMethodDecl::hasInlineBody() const {
+  const FunctionDecl *fn;
+  return MethodHasBody(this, fn) && !fn->isOutOfLine();
+}
+
 CXXBaseOrMemberInitializer::
 CXXBaseOrMemberInitializer(ASTContext &Context,
                            DeclaratorInfo *DInfo, CXXConstructorDecl *C,