summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOverload.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-12-22 21:44:34 +0000
committerDouglas Gregor <dgregor@apple.com>2009-12-22 21:44:34 +0000
commit0a70c4d9a2e5f3a43a539c724923445bcd766627 (patch)
tree5f11386d63a19230a5ea0638281a3483fc98b9f9 /clang/lib/Sema/SemaOverload.cpp
parentd85498132f8b1242cd9dadf5a652f60e13ad2edf (diff)
downloadbcm5719-llvm-0a70c4d9a2e5f3a43a539c724923445bcd766627.tar.gz
bcm5719-llvm-0a70c4d9a2e5f3a43a539c724923445bcd766627.zip
Switch parameter passing for overloaded binary operators to
InitializationSequence. Fixes the -fsyntax-only failure in llvm/lib/Transforms/Scalar/InstructionCombining.cpp. llvm-svn: 91921
Diffstat (limited to 'clang/lib/Sema/SemaOverload.cpp')
-rw-r--r--clang/lib/Sema/SemaOverload.cpp38
1 files changed, 31 insertions, 7 deletions
diff --git a/clang/lib/Sema/SemaOverload.cpp b/clang/lib/Sema/SemaOverload.cpp
index 8236ad7eecb..44eb184a36f 100644
--- a/clang/lib/Sema/SemaOverload.cpp
+++ b/clang/lib/Sema/SemaOverload.cpp
@@ -13,6 +13,7 @@
#include "Sema.h"
#include "Lookup.h"
+#include "SemaInit.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/AST/ASTContext.h"
@@ -5167,17 +5168,40 @@ Sema::CreateOverloadedBinOp(SourceLocation OpLoc,
// Convert the arguments.
if (CXXMethodDecl *Method = dyn_cast<CXXMethodDecl>(FnDecl)) {
- if (PerformObjectArgumentInitialization(Args[0], Method) ||
- PerformCopyInitialization(Args[1], FnDecl->getParamDecl(0)->getType(),
- AA_Passing))
+ OwningExprResult Arg1
+ = PerformCopyInitialization(
+ InitializedEntity::InitializeParameter(
+ FnDecl->getParamDecl(0)),
+ SourceLocation(),
+ Owned(Args[1]));
+ if (Arg1.isInvalid())
return ExprError();
+
+ if (PerformObjectArgumentInitialization(Args[0], Method))
+ return ExprError();
+
+ Args[1] = RHS = Arg1.takeAs<Expr>();
} else {
// Convert the arguments.
- if (PerformCopyInitialization(Args[0], FnDecl->getParamDecl(0)->getType(),
- AA_Passing) ||
- PerformCopyInitialization(Args[1], FnDecl->getParamDecl(1)->getType(),
- AA_Passing))
+ OwningExprResult Arg0
+ = PerformCopyInitialization(
+ InitializedEntity::InitializeParameter(
+ FnDecl->getParamDecl(0)),
+ SourceLocation(),
+ Owned(Args[0]));
+ if (Arg0.isInvalid())
+ return ExprError();
+
+ OwningExprResult Arg1
+ = PerformCopyInitialization(
+ InitializedEntity::InitializeParameter(
+ FnDecl->getParamDecl(1)),
+ SourceLocation(),
+ Owned(Args[1]));
+ if (Arg1.isInvalid())
return ExprError();
+ Args[0] = LHS = Arg0.takeAs<Expr>();
+ Args[1] = RHS = Arg1.takeAs<Expr>();
}
// Determine the result type
OpenPOWER on IntegriCloud