summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-07-13 08:18:22 +0000
committerDouglas Gregor <dgregor@apple.com>2010-07-13 08:18:22 +0000
commit603d81bf8d055732b3ba24899dd9c443e1ef243b (patch)
treeddea48df7318af2c406d98e6bbeee74b066139ae /clang/lib/Sema/SemaOverload.cpp
parentd8f446f1b2dbe66cfa30335b60d6217fef684811 (diff)
downloadbcm5719-llvm-603d81bf8d055732b3ba24899dd9c443e1ef243b.tar.gz
bcm5719-llvm-603d81bf8d055732b3ba24899dd9c443e1ef243b.zip
When forming a function call or message send expression, be sure to
strip cv-qualifiers from the expression's type when the language calls for it: in C, that's all the time, while C++ only does it for non-class types. Centralized the computation of the call expression type in QualType::getCallResultType() and some helper functions in other nodes (FunctionDecl, ObjCMethodDecl, FunctionType), and updated all relevant callers of getResultType() to getCallResultType(). Fixes PR7598 and PR7463, along with a bunch of getResultType() call sites that weren't stripping references off the result type (nothing stripped cv-qualifiers properly before this change). llvm-svn: 108234
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 5b511d7d03c..ee4c479f728 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -6668,7 +6668,7 @@ Sema::CreateOverloadedUnaryOp(SourceLocation OpLoc, unsigned OpcIn,
DiagnoseUseOfDecl(Best->FoundDecl, OpLoc);
// Determine the result type
- QualType ResultTy = FnDecl->getResultType().getNonReferenceType();
+ QualType ResultTy = FnDecl->getCallResultType();
// Build the actual expression node.
Expr *FnExpr = new (Context) DeclRefExpr(FnDecl, FnDecl->getType(),
@@ -6875,8 +6875,8 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// Determine the result type
QualType ResultTy
- = FnDecl->getType()->getAs<FunctionType>()->getResultType();
- ResultTy = ResultTy.getNonReferenceType();
+ = FnDecl->getType()->getAs<FunctionType>()
+ ->getCallResultType(Context);
// Build the actual expression node.
Expr *FnExpr = new (Context) DeclRefExpr(FnDecl, FnDecl->getType(),
@@ -7032,8 +7032,8 @@ Sema::CreateOverloadedArraySubscriptExpr(SourceLocation LLoc,
// Determine the result type
QualType ResultTy
- = FnDecl->getType()->getAs<FunctionType>()->getResultType();
- ResultTy = ResultTy.getNonReferenceType();
+ = FnDecl->getType()->getAs<FunctionType>()
+ ->getCallResultType(Context);
// Build the actual expression node.
Expr *FnExpr = new (Context) DeclRefExpr(FnDecl, FnDecl->getType(),
@@ -7221,7 +7221,7 @@ Sema::BuildCallToMemberFunction(Scope *S, Expr *MemExprE,
ExprOwningPtr<CXXMemberCallExpr>
TheCall(this, new (Context) CXXMemberCallExpr(Context, MemExprE, Args,
NumArgs,
- Method->getResultType().getNonReferenceType(),
+ Method->getCallResultType(),
RParenLoc));
// Check for a valid return type.
@@ -7436,7 +7436,7 @@ Sema::BuildCallToObjectOfClassType(Scope *S, Expr *Object,
// Once we've built TheCall, all of the expressions are properly
// owned.
- QualType ResultTy = Method->getResultType().getNonReferenceType();
+ QualType ResultTy = Method->getCallResultType();
ExprOwningPtr<CXXOperatorCallExpr>
TheCall(this, new (Context) CXXOperatorCallExpr(Context, OO_Call, NewFn,
MethodArgs, NumArgs + 1,
@@ -7592,7 +7592,7 @@ Sema::BuildOverloadedArrowExpr(Scope *S, ExprArg BaseIn, SourceLocation OpLoc) {
SourceLocation());
UsualUnaryConversions(FnExpr);
- QualType ResultTy = Method->getResultType().getNonReferenceType();
+ QualType ResultTy = Method->getCallResultType();
ExprOwningPtr<CXXOperatorCallExpr>
TheCall(this, new (Context) CXXOperatorCallExpr(Context, OO_Arrow, FnExpr,
&Base, 1, ResultTy, OpLoc));
OpenPOWER on IntegriCloud