[CGDebugInfo] Fix -femit-debug-entry-values crash on os_log_helpers

An os_log_helper FunctionDecl may not have a body. Ignore these for the
purposes of debug entry value emission.

Fixes an assertion failure seen in a stage2 build of clang:

Assertion failed: (FD->hasBody() && "Functions must have body here"),
function analyzeParametersModification

llvm-svn: 365716
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index f49d1ef..f6ee7ee 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -3587,9 +3587,12 @@
 
   // We use the SPDefCache only in the case when the debug entry values option
   // is set, in order to speed up parameters modification analysis.
-  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl &&
-      isa<FunctionDecl>(D))
-    SPDefCache[cast<FunctionDecl>(D)].reset(SP);
+  //
+  // FIXME: Use AbstractCallee here to support ObjCMethodDecl.
+  if (CGM.getCodeGenOpts().EnableDebugEntryValues && HasDecl)
+    if (auto *FD = dyn_cast<FunctionDecl>(D))
+      if (FD->hasBody() && !FD->param_empty())
+        SPDefCache[FD].reset(SP);
 
   if (CGM.getCodeGenOpts().DwarfVersion >= 5) {
     // Starting with DWARF V5 method declarations are emitted as children of