summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib')
-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