Collapse the three separate initialization paths in
TryStaticImplicitCast (for references, class types, and everything
else, respectively) into a single invocation of
InitializationSequence.
One of the paths (for class types) was the only client of
Sema::TryInitializationByConstructor, which I have eliminated. This
also simplified the interface for much of the cast-checking logic,
eliminating yet more code.
I've kept the representation of C++ functional casts with <> 1
arguments the same, despite the fact that I hate it. That fix will
come soon. To satisfy my paranoia, I've bootstrapped + tested Clang
with these changes.
llvm-svn: 101549
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index c906d22..f52bc84 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -504,21 +504,10 @@
//
if (NumExprs == 1) {
CastExpr::CastKind Kind = CastExpr::CK_Unknown;
- CXXMethodDecl *Method = 0;
- if (CheckCastTypes(TypeRange, Ty, Exprs[0], Kind, Method,
- /*FunctionalStyle=*/true))
+ if (CheckCastTypes(TypeRange, Ty, Exprs[0], Kind, /*FunctionalStyle=*/true))
return ExprError();
exprs.release();
- if (Method) {
- OwningExprResult CastArg
- = BuildCXXCastArgument(TypeRange.getBegin(), Ty.getNonReferenceType(),
- Kind, Method, Owned(Exprs[0]));
- if (CastArg.isInvalid())
- return ExprError();
-
- Exprs[0] = CastArg.takeAs<Expr>();
- }
return Owned(new (Context) CXXFunctionalCastExpr(Ty.getNonReferenceType(),
TInfo, TyBeginLoc, Kind,