]> granicus.if.org Git - clang/commitdiff
[Analyzer] Log when auto-synthesized body is used.
authorGeorge Karpenkov <ekarpenkov@apple.com>
Fri, 22 Sep 2017 00:37:12 +0000 (00:37 +0000)
committerGeorge Karpenkov <ekarpenkov@apple.com>
Fri, 22 Sep 2017 00:37:12 +0000 (00:37 +0000)
Differential Revision: https://reviews.llvm.org/D37910

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313944 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/CallEvent.cpp

index 8e2de7d300bcf8d1565d97338738bf49d2cdf1e8..f0a817616dbc27829c87a11a8d17677ec65f76f1 100644 (file)
@@ -21,6 +21,9 @@
 #include "llvm/ADT/SmallSet.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Support/Debug.h"
+
+#define DEBUG_TYPE "static-analyzer-call-event"
 
 using namespace clang;
 using namespace ento;
@@ -343,7 +346,6 @@ ArrayRef<ParmVarDecl*> AnyFunctionCall::parameters() const {
   return D->parameters();
 }
 
-
 RuntimeDefinition AnyFunctionCall::getRuntimeDefinition() const {
   const FunctionDecl *FD = getDecl();
   // Note that the AnalysisDeclContext will have the FunctionDecl with
@@ -352,8 +354,17 @@ RuntimeDefinition AnyFunctionCall::getRuntimeDefinition() const {
     AnalysisDeclContext *AD =
       getLocationContext()->getAnalysisDeclContext()->
       getManager()->getContext(FD);
-    if (AD->getBody())
-      return RuntimeDefinition(AD->getDecl());
+    bool IsAutosynthesized;
+    Stmt* Body = AD->getBody(IsAutosynthesized);
+    DEBUG({
+        if (IsAutosynthesized)
+          llvm::dbgs() << "Using autosynthesized body for " << FD->getName()
+                       << "\n";
+    });
+    if (Body) {
+      const Decl* Decl = AD->getDecl();
+      return RuntimeDefinition(Decl);
+    }
   }
 
   return RuntimeDefinition();