summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2012-02-17 03:32:35 +0000
committerJohn McCall <rjmccall@apple.com>2012-02-17 03:32:35 +0000
commitc833deaa09f835bd2f4e8bbfcf6ecff1dbce8981 (patch)
tree6eb936197802f34bb1a75014923055f5cc3cc80c /clang/lib
parent1e25a97ae2613cac034633d0e591b33af8e3c33f (diff)
downloadbcm5719-llvm-c833deaa09f835bd2f4e8bbfcf6ecff1dbce8981.tar.gz
bcm5719-llvm-c833deaa09f835bd2f4e8bbfcf6ecff1dbce8981.zip
Block expressions always have a prototyped function type; expose this
in the AST accessor and micro-optimize it very slightly. llvm-svn: 150787
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/AST/Expr.cpp7
1 files changed, 4 insertions, 3 deletions
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<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 {
OpenPOWER on IntegriCloud