From e712295f11bb90d38c8749a338293eaba06d96a5 Mon Sep 17 00:00:00 2001 From: Gabor Marton Date: Thu, 4 Jul 2019 11:39:00 +0000 Subject: [CTU] Add support for virtual functions Reviewers: Szelethus, xazax.hun Subscribers: rnkovacs, dkrupp, gamesh411, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D63920 llvm-svn: 365133 --- clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'clang/lib/StaticAnalyzer/Core/CallEvent.cpp') diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp index 81a9ee4d90b..a5f7500e630 100644 --- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -766,8 +766,11 @@ RuntimeDefinition CXXInstanceCall::getRuntimeDefinition() const { // Does the decl that we found have an implementation? const FunctionDecl *Definition; - if (!Result->hasBody(Definition)) + if (!Result->hasBody(Definition)) { + if (!DynType.canBeASubClass()) + return AnyFunctionCall::getRuntimeDefinition(); return {}; + } // We found a definition. If we're not sure that this devirtualization is // actually what will happen at runtime, make sure to provide the region so -- cgit v1.2.3