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: http://review.tizen.org/git/?a=commitdiff_plain;h=482bf0f5315726c02afc3737a60ef6c857234265;p=platform%2Fupstream%2Fllvm.git [analyzer] Quickfix: don't crash when runtime definition is not available. llvm-svn: 326230 --- diff --git a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp b/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp index 54150ef..f5b4e7c 100644 --- a/clang/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp +++ b/clang/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(); }