diff --git a/clang/include/clang/AST/Expr.h b/clang/include/clang/AST/Expr.h index 8a80803f01c2..0f325bdcc915 100644 --- a/clang/include/clang/AST/Expr.h +++ b/clang/include/clang/AST/Expr.h @@ -4233,7 +4233,7 @@ public: } /// getFunctionType - Return the underlying function type for this block. - const FunctionType *getFunctionType() const; + const FunctionProtoType *getFunctionType() const; static bool classof(const Stmt *T) { return T->getStmtClass() == BlockExprClass; diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 4b19031852c6..d5eab77816c6 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -1512,9 +1512,10 @@ SourceRange InitListExpr::getSourceRange() const { /// getFunctionType - Return the underlying function type for this block. /// -const FunctionType *BlockExpr::getFunctionType() const { - return getType()->getAs()-> - getPointeeType()->getAs(); +const FunctionProtoType *BlockExpr::getFunctionType() const { + // The block pointer is never sugared, but the function type might be. + return cast(getType()) + ->getPointeeType()->castAs(); } SourceLocation BlockExpr::getCaretLocation() const {