[cfe-commits] r80255 - in /cfe/trunk/lib/Sema: Sema.h SemaDeclCXX.cpp SemaExprCXX.cpp SemaOverload.cpp
Anders Carlsson
andersca at mac.com
Thu Aug 27 10:14:02 PDT 2009
Author: andersca
Date: Thu Aug 27 12:14:02 2009
New Revision: 80255
URL: http://llvm.org/viewvc/llvm-project?rev=80255&view=rev
Log:
Revert the flags change for now, I have a better idea for this.
Modified:
cfe/trunk/lib/Sema/Sema.h
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=80255&r1=80254&r2=80255&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/Sema.h (original)
+++ cfe/trunk/lib/Sema/Sema.h Thu Aug 27 12:14:02 2009
@@ -721,17 +721,13 @@
bool MergeCXXFunctionDecl(FunctionDecl *New, FunctionDecl *Old);
/// C++ Overloading.
- enum OverloadResolutionFlags {
- ORF_None = 0x0,
- ORF_SuppressUserConversions = 0x1,
- ORF_AllowExplicit = 0x2,
- ORF_ForceRValue = 0x4
- };
-
bool IsOverload(FunctionDecl *New, Decl* OldD,
OverloadedFunctionDecl::function_iterator &MatchedDecl);
ImplicitConversionSequence
- TryImplicitConversion(Expr* From, QualType ToType, unsigned Flags = ORF_None);
+ TryImplicitConversion(Expr* From, QualType ToType,
+ bool SuppressUserConversions = false,
+ bool AllowExplicit = false,
+ bool ForceRValue = false);
bool IsStandardConversion(Expr *From, QualType ToType,
StandardConversionSequence& SCS);
bool IsIntegralPromotion(Expr *From, QualType FromType, QualType ToType);
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=80255&r1=80254&r2=80255&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Thu Aug 27 12:14:02 2009
@@ -3144,10 +3144,7 @@
// 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 ?
- ORF_SuppressUserConversions :
- ORF_None);
+ *ICS = TryImplicitConversion(Init, T1, SuppressUserConversions);
// 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=80255&r1=80254&r2=80255&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu Aug 27 12:14:02 2009
@@ -881,19 +881,14 @@
const char *Flavor, bool AllowExplicit,
bool Elidable)
{
- unsigned Flags = ORF_None;
- if (AllowExplicit)
- Flags |= ORF_AllowExplicit;
-
ImplicitConversionSequence ICS;
ICS.ConversionKind = ImplicitConversionSequence::BadConversion;
if (Elidable && getLangOptions().CPlusPlus0x) {
- Flags |= ORF_ForceRValue;
-
- ICS = TryImplicitConversion(From, ToType, Flags);
+ ICS = TryImplicitConversion(From, ToType, /*SuppressUserConversions*/false,
+ AllowExplicit, /*ForceRValue*/true);
}
if (ICS.ConversionKind == ImplicitConversionSequence::BadConversion) {
- ICS = TryImplicitConversion(From, ToType, Flags);
+ ICS = TryImplicitConversion(From, ToType, false, AllowExplicit);
}
return PerformImplicitConversion(From, ToType, ICS, Flavor);
}
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=80255&r1=80254&r2=80255&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Thu Aug 27 12:14:02 2009
@@ -408,11 +408,10 @@
/// If @p ForceRValue, then overloading is performed as if From was an rvalue,
/// no matter its actual lvalueness.
ImplicitConversionSequence
-Sema::TryImplicitConversion(Expr* From, QualType ToType, unsigned Flags) {
- bool SuppressUserConversions = Flags & ORF_SuppressUserConversions;
- bool AllowExplicit = Flags & ORF_AllowExplicit;
- bool ForceRValue = Flags & ORF_ForceRValue;
-
+Sema::TryImplicitConversion(Expr* From, QualType ToType,
+ bool SuppressUserConversions,
+ bool AllowExplicit, bool ForceRValue)
+{
ImplicitConversionSequence ICS;
if (IsStandardConversion(From, ToType, ICS.Standard))
ICS.ConversionKind = ImplicitConversionSequence::StandardConversion;
@@ -1930,11 +1929,8 @@
/*AllowExplicit=*/false, ForceRValue);
return ICS;
} else {
- unsigned Flags = ORF_None;
- if (SuppressUserConversions) Flags |= ORF_SuppressUserConversions;
- if (ForceRValue) Flags |= ORF_ForceRValue;
-
- return TryImplicitConversion(From, ToType, Flags);
+ return TryImplicitConversion(From, ToType, SuppressUserConversions,
+ ForceRValue);
}
}
@@ -2068,7 +2064,7 @@
/// TryContextuallyConvertToBool - Attempt to contextually convert the
/// expression From to bool (C++0x [conv]p3).
ImplicitConversionSequence Sema::TryContextuallyConvertToBool(Expr *From) {
- return TryImplicitConversion(From, Context.BoolTy, ORF_AllowExplicit);
+ return TryImplicitConversion(From, Context.BoolTy, false, true);
}
/// PerformContextuallyConvertToBool - Perform a contextual conversion
More information about the cfe-commits
mailing list