Skip to content

Commit

Permalink
[Analyzer] Log when auto-synthesized body is used.
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D37910

llvm-svn: 313944
  • Loading branch information
George Karpenkov committed Sep 22, 2017
1 parent dfc4bff commit 504e236
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions clang/lib/StaticAnalyzer/Core/CallEvent.cpp
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down

0 comments on commit 504e236

Please sign in to comment.