From c833deaa09f835bd2f4e8bbfcf6ecff1dbce8981 Mon Sep 17 00:00:00 2001 From: John McCall Date: Fri, 17 Feb 2012 03:32:35 +0000 Subject: Block expressions always have a prototyped function type; expose this in the AST accessor and micro-optimize it very slightly. llvm-svn: 150787 --- clang/lib/AST/Expr.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'clang/lib/AST/Expr.cpp') diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index 4b19031852c..d5eab77816c 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 { -- cgit v1.2.3