forked from OSchip/llvm-project
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:
parent
1e25a97ae2
commit
c833deaa09
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue