r190213 - Remove error-prone 'list initialization' flag from an implicit conversion
Richard Smith
richard-llvm at metafoo.co.uk
Fri Sep 6 15:30:29 PDT 2013
Author: rsmith
Date: Fri Sep 6 17:30:28 2013
New Revision: 190213
URL: http://llvm.org/viewvc/llvm-project?rev=190213&view=rev
Log:
Remove error-prone 'list initialization' flag from an implicit conversion
sequence. All that matters here is whether we're doing the
std::initializer_list special case thing.
Modified:
cfe/trunk/include/clang/Sema/Overload.h
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/include/clang/Sema/Overload.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Overload.h?rev=190213&r1=190212&r2=190213&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Overload.h (original)
+++ cfe/trunk/include/clang/Sema/Overload.h Fri Sep 6 17:30:28 2013
@@ -406,9 +406,6 @@ namespace clang {
/// ConversionKind - The kind of implicit conversion sequence.
unsigned ConversionKind : 30;
- /// \brief Whether the argument is an initializer list.
- bool ListInitializationSequence : 1;
-
/// \brief Whether the target is really a std::initializer_list, and the
/// sequence only represents the worst element conversion.
bool StdInitializerListElement : 1;
@@ -441,16 +438,14 @@ namespace clang {
BadConversionSequence Bad;
};
- ImplicitConversionSequence()
- : ConversionKind(Uninitialized), ListInitializationSequence(false),
- StdInitializerListElement(false)
+ ImplicitConversionSequence()
+ : ConversionKind(Uninitialized), StdInitializerListElement(false)
{}
~ImplicitConversionSequence() {
destruct();
}
ImplicitConversionSequence(const ImplicitConversionSequence &Other)
- : ConversionKind(Other.ConversionKind),
- ListInitializationSequence(Other.ListInitializationSequence),
+ : ConversionKind(Other.ConversionKind),
StdInitializerListElement(Other.StdInitializerListElement)
{
switch (ConversionKind) {
@@ -536,16 +531,6 @@ namespace clang {
Ambiguous.construct();
}
- /// \brief Whether this sequence was created by the rules of
- /// list-initialization sequences.
- bool isListInitializationSequence() const {
- return ListInitializationSequence;
- }
-
- void setListInitializationSequence() {
- ListInitializationSequence = true;
- }
-
/// \brief Whether the target is really a std::initializer_list, and the
/// sequence only represents the worst element conversion.
bool isStdInitializerListElement() const {
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=190213&r1=190212&r2=190213&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Sep 6 17:30:28 2013
@@ -509,11 +509,8 @@ void UserDefinedConversionSequence::Debu
/// error. Useful for debugging overloading issues.
void ImplicitConversionSequence::DebugPrint() const {
raw_ostream &OS = llvm::errs();
- if (isListInitializationSequence()) {
- OS << "List-initialization sequence: ";
- if (isStdInitializerListElement())
- OS << "Worst std::initializer_list element conversion: ";
- }
+ if (isStdInitializerListElement())
+ OS << "Worst std::initializer_list element conversion: ";
switch (ConversionKind) {
case StandardConversion:
OS << "Standard conversion: ";
@@ -3321,9 +3318,7 @@ CompareImplicitConversionSequences(Sema
// list-initialization sequence L2 if L1 converts to std::initializer_list<X>
// for some X and L2 does not.
if (Result == ImplicitConversionSequence::Indistinguishable &&
- !ICS1.isBad() &&
- ICS1.isListInitializationSequence() &&
- ICS2.isListInitializationSequence()) {
+ !ICS1.isBad()) {
if (ICS1.isStdInitializerListElement() &&
!ICS2.isStdInitializerListElement())
return ImplicitConversionSequence::Better;
@@ -4402,7 +4397,6 @@ TryListConversion(Sema &S, InitListExpr
ImplicitConversionSequence Result;
Result.setBad(BadConversionSequence::no_conversion, From, ToType);
- Result.setListInitializationSequence();
// We need a complete type for what follows. Incomplete types can never be
// initialized from init lists.
@@ -4448,7 +4442,6 @@ TryListConversion(Sema &S, InitListExpr
Result.Standard.setAllToTypes(ToType);
}
- Result.setListInitializationSequence();
Result.setStdInitializerListElement(toStdInitializerList);
return Result;
}
@@ -4461,12 +4454,10 @@ TryListConversion(Sema &S, InitListExpr
// implicit conversion sequence is a user-defined conversion sequence.
if (ToType->isRecordType() && !ToType->isAggregateType()) {
// This function can deal with initializer lists.
- Result = TryUserDefinedConversion(S, From, ToType, SuppressUserConversions,
- /*AllowExplicit=*/false,
- InOverloadResolution, /*CStyle=*/false,
- AllowObjCWritebackConversion);
- Result.setListInitializationSequence();
- return Result;
+ return TryUserDefinedConversion(S, From, ToType, SuppressUserConversions,
+ /*AllowExplicit=*/false,
+ InOverloadResolution, /*CStyle=*/false,
+ AllowObjCWritebackConversion);
}
// C++11 [over.ics.list]p4:
@@ -4530,11 +4521,9 @@ TryListConversion(Sema &S, InitListExpr
dummy2, dummy3);
if (RefRelationship >= Sema::Ref_Related) {
- Result = TryReferenceInit(S, Init, ToType, /*FIXME*/From->getLocStart(),
- SuppressUserConversions,
- /*AllowExplicit=*/false);
- Result.setListInitializationSequence();
- return Result;
+ return TryReferenceInit(S, Init, ToType, /*FIXME*/From->getLocStart(),
+ SuppressUserConversions,
+ /*AllowExplicit=*/false);
}
}
@@ -4585,7 +4574,6 @@ TryListConversion(Sema &S, InitListExpr
Result.Standard.setFromType(ToType);
Result.Standard.setAllToTypes(ToType);
}
- Result.setListInitializationSequence();
return Result;
}
More information about the cfe-commits
mailing list