[analyzer] Quickfix: don't crash when runtime definition is not available.

llvm-svn: 326230
This commit is contained in:
George Karpenkov 2018-02-27 19:19:49 +00:00
parent fa5d70e623
commit 482bf0f531
1 changed files with 5 additions and 3 deletions

View File

@ -321,9 +321,11 @@ private:
/// Get parameters associated with runtime definition in order
/// to get the correct parameter name.
ArrayRef<ParmVarDecl *> getCallParameters(CallEventRef<> Call) {
if (isa<FunctionDecl>(Call->getDecl()))
return dyn_cast<FunctionDecl>(Call->getRuntimeDefinition().getDecl())
->parameters();
// Use runtime definition, if available.
RuntimeDefinition RD = Call->getRuntimeDefinition();
if (auto *FD = dyn_cast_or_null<FunctionDecl>(RD.getDecl()))
return FD->parameters();
return Call->parameters();
}