diff options
author | John McCall <rjmccall@apple.com> | 2012-02-17 03:32:35 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2012-02-17 03:32:35 +0000 |
commit | a345edb668380691fc92d4e4aa0a5ffec366ca6a (patch) | |
tree | 0f83203e4c7abb9dc3dd05edbf43f69331650007 /lib/AST/Expr.cpp | |
parent | 84fa9cd13c2b260937625b6ad7445af7f7648565 (diff) |
Block expressions always have a prototyped function type; expose this
in the AST accessor and micro-optimize it very slightly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150787 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/Expr.cpp')
-rw-r--r-- | lib/AST/Expr.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp index 4b19031852..d5eab77816 100644 --- a/lib/AST/Expr.cpp +++ b/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<BlockPointerType>()-> - getPointeeType()->getAs<FunctionType>(); +const FunctionProtoType *BlockExpr::getFunctionType() const { + // The block pointer is never sugared, but the function type might be. + return cast<BlockPointerType>(getType()) + ->getPointeeType()->castAs<FunctionProtoType>(); } SourceLocation BlockExpr::getCaretLocation() const { |