Block expressions always have a prototyped function type; expose this

in the AST accessor and micro-optimize it very slightly.

llvm-svn: 150787
This commit is contained in:
John McCall 2012-02-17 03:32:35 +00:00
parent 1e25a97ae2
commit c833deaa09
2 changed files with 5 additions and 4 deletions

View File

@ -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;

View File

@ -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 {