From: George Karpenkov Date: Tue, 27 Feb 2018 19:19:49 +0000 (+0000) Subject: [analyzer] Quickfix: don't crash when runtime definition is not available. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77aa5a16bf26da61137626bdf85d42634a8b6005;p=clang [analyzer] Quickfix: don't crash when runtime definition is not available. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326230 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 54150ef2f2..f5b4e7c3a7 100644 --- a/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp @@ -321,9 +321,11 @@ private: /// Get parameters associated with runtime definition in order /// to get the correct parameter name. ArrayRef getCallParameters(CallEventRef<> Call) { - if (isa(Call->getDecl())) - return dyn_cast(Call->getRuntimeDefinition().getDecl()) - ->parameters(); + // Use runtime definition, if available. + RuntimeDefinition RD = Call->getRuntimeDefinition(); + if (auto *FD = dyn_cast_or_null(RD.getDecl())) + return FD->parameters(); + return Call->parameters(); }