diff options
| author | Eric Fiselier <eric@efcs.ca> | 2018-05-08 00:52:19 +0000 |
|---|---|---|
| committer | Eric Fiselier <eric@efcs.ca> | 2018-05-08 00:52:19 +0000 |
| commit | c5fb8580536e421e3d18ac0dd82615d2e87a1131 (patch) | |
| tree | dd70622074da959c03921edde44f16afc764cf72 /clang/lib/Sema | |
| parent | fb00bde419b4dd51de5b3b15ade3ef1cdc481ddc (diff) | |
| download | bcm5719-llvm-c5fb8580536e421e3d18ac0dd82615d2e87a1131.tar.gz bcm5719-llvm-c5fb8580536e421e3d18ac0dd82615d2e87a1131.zip | |
[C++2a] Implement operator<=>: Address bugs and post-commit review comments after r331677.
This patch addresses some mostly trivial post-commit review comments received
on r331677.
Additionally, this patch fixes an assertion in `getNarrowingKind` caused by
the use of an uninitialized value from `checkThreeWayNarrowingConversion`.
llvm-svn: 331707
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 6 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 8 |
2 files changed, 8 insertions, 6 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index fb168957bd7..caa0b746439 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -8938,8 +8938,10 @@ QualType Sema::CheckComparisonCategoryType(ComparisonCategoryType Kind, // If lookup failed if (!Info) { + auto NameForDiags = + llvm::Twine("std::") + ComparisonCategories::getCategoryString(Kind); Diag(Loc, diag::err_implied_comparison_category_type_not_found) - << ComparisonCategories::getCategoryString(Kind); + << NameForDiags.str(); return QualType(); } @@ -8947,7 +8949,7 @@ QualType Sema::CheckComparisonCategoryType(ComparisonCategoryType Kind, assert(Info->Record); // Update the Record decl in case we encountered a forward declaration on our - // first pass. FIXME(EricWF): This is a bit of a hack. + // first pass. FIXME: This is a bit of a hack. if (Info->Record->hasDefinition()) Info->Record = Info->Record->getDefinition(); diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 177cfd7354a..8522c04e73b 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -9757,12 +9757,12 @@ static bool checkThreeWayNarrowingConversion(Sema &S, QualType ToType, Expr *E, SourceLocation Loc) { // Check for a narrowing implicit conversion. StandardConversionSequence SCS; + SCS.setAsIdentityConversion(); SCS.setToType(0, FromType); SCS.setToType(1, ToType); - if (const auto *ICE = dyn_cast<ImplicitCastExpr>(E)) { - auto CastK = ICE->getCastKind(); - SCS.Second = castKindToImplicitConversionKind(CastK); - } + if (const auto *ICE = dyn_cast<ImplicitCastExpr>(E)) + SCS.Second = castKindToImplicitConversionKind(ICE->getCastKind()); + APValue PreNarrowingValue; QualType PreNarrowingType; switch (SCS.getNarrowingKind(S.Context, E, PreNarrowingValue, |

