summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-05-26 04:57:27 +0000
committerAnders Carlsson <andersca@mac.com>2009-05-26 04:57:27 +0000
commit00a2759ca98e53daf2bad21ead8b4209f2858246 (patch)
tree1fc469a6eee9002f15c1fe18eef16ac6d50e8cdb /clang/lib/AST/Expr.cpp
parent3b70b300b086ff666c954434bcaadc85c4c90d7b (diff)
downloadbcm5719-llvm-00a2759ca98e53daf2bad21ead8b4209f2858246.tar.gz
bcm5719-llvm-00a2759ca98e53daf2bad21ead8b4209f2858246.zip
Add a new CallExpr::getCallReturnType and use it in Expr::isLvalueInternal. No intended functionality change.
llvm-svn: 72410
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index fbc8889567d..6711faffe74 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -278,6 +278,16 @@ unsigned CallExpr::isBuiltinCall(ASTContext &Context) const {
return FDecl->getBuiltinID(Context);
}
+QualType CallExpr::getCallReturnType() const {
+ QualType CalleeType = getCallee()->getType();
+ if (const PointerType *FnTypePtr = CalleeType->getAsPointerType())
+ CalleeType = FnTypePtr->getPointeeType();
+ else if (const BlockPointerType *BPT = CalleeType->getAsBlockPointerType())
+ CalleeType = BPT->getPointeeType();
+
+ const FunctionType *FnType = CalleeType->getAsFunctionType();
+ return FnType->getResultType();
+}
/// getOpcodeStr - Turn an Opcode enum value into the punctuation char it
/// corresponds to, e.g. "<<=".
@@ -773,15 +783,9 @@ Expr::isLvalueResult Expr::isLvalueInternal(ASTContext &Ctx) const {
// C++0x [expr.call]p10
// A function call is an lvalue if and only if the result type
// is an lvalue reference.
- QualType CalleeType = cast<CallExpr>(this)->getCallee()->getType();
- if (const PointerType *FnTypePtr = CalleeType->getAsPointerType())
- CalleeType = FnTypePtr->getPointeeType();
- else if (const BlockPointerType *BPT = CalleeType->getAsBlockPointerType())
- CalleeType = BPT->getPointeeType();
-
- if (const FunctionType *FnType = CalleeType->getAsFunctionType())
- if (FnType->getResultType()->isLValueReferenceType())
- return LV_Valid;
+ QualType ReturnType = cast<CallExpr>(this)->getCallReturnType();
+ if (ReturnType->isLValueReferenceType())
+ return LV_Valid;
break;
}
OpenPOWER on IntegriCloud