From: George Karpenkov Date: Fri, 22 Sep 2017 00:37:12 +0000 (+0000) Subject: [Analyzer] Log when auto-synthesized body is used. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0702d2e7fe5998912a9979391f64ef6bdd540f00;p=clang [Analyzer] Log when auto-synthesized body is used. Differential Revision: https://reviews.llvm.org/D37910 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@313944 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/CallEvent.cpp b/lib/StaticAnalyzer/Core/CallEvent.cpp index 8e2de7d300..f0a817616d 100644 --- a/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -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 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();