[cfe-commits] r80258 - in /cfe/trunk/lib/Sema: Sema.h SemaCXXCast.cpp SemaDeclCXX.cpp SemaExprCXX.cpp SemaOverload.cpp
Anders Carlsson
andersca at mac.com
Thu Aug 27 10:24:15 PDT 2009
Author: andersca
Date: Thu Aug 27 12:24:15 2009
New Revision: 80258
URL: http://llvm.org/viewvc/llvm-project?rev=80258&view=rev
Log:
Remove default arguments from TryImplicitConversion and fix a bug found in the process.
Modified:
cfe/trunk/lib/Sema/Sema.h
cfe/trunk/lib/Sema/SemaCXXCast.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/lib/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/Sema.h?rev=80258&r1=80257&r2=80258&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Thu Aug 27 12:24:15 2009
@@ -725,9 +725,9 @@
OverloadedFunctionDecl::function_iterator &MatchedDecl);
ImplicitConversionSequence
TryImplicitConversion(Expr* From, QualType ToType,
- bool SuppressUserConversions = false,
- bool AllowExplicit = false,
- bool ForceRValue = false);
+ bool SuppressUserConversions,
+ bool AllowExplicit,
+ bool ForceRValue);
bool IsStandardConversion(Expr *From, QualType ToType,
StandardConversionSequence& SCS);
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
Modified: cfe/trunk/lib/Sema/SemaCXXCast.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXCast.cpp?rev=80258&r1=80257&r2=80258&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCXXCast.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCXXCast.cpp Thu Aug 27 12:24:15 2009
@@ -788,8 +788,12 @@
// reimplement more of this.
// FIXME: This does not actually perform the conversion, and thus does not
// check for ambiguity or access.
- ImplicitConversionSequence ICS = Self.TryImplicitConversion(
- SrcExpr, DestType);
+ ImplicitConversionSequence ICS =
+ Self.TryImplicitConversion(SrcExpr, DestType,
+ /*SuppressUserConversions=*/false,
+ /*AllowExplicit=*/false,
+ /*ForceRValue=*/false);
+
if (ICS.ConversionKind == ImplicitConversionSequence::UserDefinedConversion)
if (CXXConversionDecl *CV =
dyn_cast<CXXConversionDecl>(ICS.UserDefined.ConversionFunction))
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=80258&r1=80257&r2=80258&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Aug 27 12:24:15 2009
@@ -3144,7 +3144,10 @@
// the argument expression. Any difference in top-level
// cv-qualification is subsumed by the initialization itself
// and does not constitute a conversion.
- *ICS = TryImplicitConversion(Init, T1, SuppressUserConversions);
+ *ICS = TryImplicitConversion(Init, T1, SuppressUserConversions,
+ /*AllowExplicit=*/false,
+ /*ForceRValue=*/false);
+
// Of course, that's still a reference binding.
if (ICS->ConversionKind == ImplicitConversionSequence::StandardConversion) {
ICS->Standard.ReferenceBinding = true;
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=80258&r1=80257&r2=80258&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Aug 27 12:24:15 2009
@@ -884,11 +884,16 @@
ImplicitConversionSequence ICS;
ICS.ConversionKind = ImplicitConversionSequence::BadConversion;
if (Elidable && getLangOptions().CPlusPlus0x) {
- ICS = TryImplicitConversion(From, ToType, /*SuppressUserConversions*/false,
- AllowExplicit, /*ForceRValue*/true);
+ ICS = TryImplicitConversion(From, ToType,
+ /*SuppressUserConversions=*/false,
+ AllowExplicit,
+ /*ForceRValue=*/true);
}
if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion) {
- ICS = TryImplicitConversion(From, ToType, false, AllowExplicit);
+ ICS = TryImplicitConversion(From, ToType,
+ /*SuppressUserConversions=*/false,
+ AllowExplicit,
+ /*ForceRValue=*/false);
}
return PerformImplicitConversion(From, ToType, ICS, Flavor);
}
@@ -1244,7 +1249,10 @@
// Now try the implicit conversion.
// FIXME: This doesn't detect ambiguities.
- ICS = Self.TryImplicitConversion(From, TTy);
+ ICS = Self.TryImplicitConversion(From, TTy,
+ /*SuppressUserConversions=*/false,
+ /*AllowExplicit=*/false,
+ /*ForceRValue=*/false);
}
return false;
}
@@ -1627,15 +1635,30 @@
}
}
- ImplicitConversionSequence E1ToC1 = TryImplicitConversion(E1, Composite1);
- ImplicitConversionSequence E2ToC1 = TryImplicitConversion(E2, Composite1);
+ ImplicitConversionSequence E1ToC1 =
+ TryImplicitConversion(E1, Composite1,
+ /*SuppressUserConversions=*/false,
+ /*AllowExplicit=*/false,
+ /*ForceRValue=*/false);
+ ImplicitConversionSequence E2ToC1 =
+ TryImplicitConversion(E2, Composite1,
+ /*SuppressUserConversions=*/false,
+ /*AllowExplicit=*/false,
+ /*ForceRValue=*/false);
+
ImplicitConversionSequence E1ToC2, E2ToC2;
E1ToC2.ConversionKind = ImplicitConversionSequence::BadConversion;
E2ToC2.ConversionKind = ImplicitConversionSequence::BadConversion;
if (Context.getCanonicalType(Composite1) !=
Context.getCanonicalType(Composite2)) {
- E1ToC2 = TryImplicitConversion(E1, Composite2);
- E2ToC2 = TryImplicitConversion(E2, Composite2);
+ E1ToC2 = TryImplicitConversion(E1, Composite2,
+ /*SuppressUserConversions=*/false,
+ /*AllowExplicit=*/false,
+ /*ForceRValue=*/false);
+ E2ToC2 = TryImplicitConversion(E2, Composite2,
+ /*SuppressUserConversions=*/false,
+ /*AllowExplicit=*/false,
+ /*ForceRValue=*/false);
}
bool ToC1Viable = E1ToC1.ConversionKind !=
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=80258&r1=80257&r2=80258&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Aug 27 12:24:15 2009
@@ -1929,7 +1929,9 @@
/*AllowExplicit=*/false, ForceRValue);
return ICS;
} else {
- return TryImplicitConversion(From, ToType, SuppressUserConversions,
+ return TryImplicitConversion(From, ToType,
+ SuppressUserConversions,
+ /*AllowExplicit=*/false,
ForceRValue);
}
}
@@ -2064,7 +2066,11 @@
/// TryContextuallyConvertToBool - Attempt to contextually convert the
/// expression From to bool (C++0x [conv]p3).
ImplicitConversionSequence Sema::TryContextuallyConvertToBool(Expr *From) {
- return TryImplicitConversion(From, Context.BoolTy, false, true);
+ return TryImplicitConversion(From, Context.BoolTy,
+ // FIXME: Are these flags correct?
+ /*SuppressUserConversions=*/false,
+ /*AllowExplicit=*/true,
+ /*ForceRValue=*/false);
}
/// PerformContextuallyConvertToBool - Perform a contextual conversion
More information about the cfe-commits
mailing list