diff options
Diffstat (limited to 'clang/lib/StaticAnalyzer/Core/CallEvent.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp index 8ac09ebb2d1..dd33e014c30 100644 --- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -245,12 +245,17 @@ QualType CallEvent::getDeclaredResultType(const Decl *D) { // Blocks are difficult because the return type may not be stored in the // BlockDecl itself. The AST should probably be enhanced, but for now we // just do what we can. + // If the block is declared without an explicit argument list, the + // signature-as-written just includes the return type, not the entire + // function type. // FIXME: All blocks should have signatures-as-written, even if the return - // type is inferred. (That's signified is with a dependent result type.) + // type is inferred. (That's signified with a dependent result type.) if (const TypeSourceInfo *TSI = BD->getSignatureAsWritten()) { - const FunctionType *FT = TSI->getType()->castAs<FunctionType>(); - if (!FT->getResultType()->isDependentType()) - return FT->getResultType(); + QualType Ty = TSI->getType(); + if (const FunctionType *FT = Ty->getAs<FunctionType>()) + Ty = FT->getResultType(); + if (!Ty->isDependentType()) + return Ty; } return QualType(); |