summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaDeclCXX.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard@metafoo.co.uk>2019-12-11 17:28:46 -0800
committerRichard Smith <richard@metafoo.co.uk>2019-12-13 18:41:54 -0800
commit38c3b5d562ac6a5ab0ef5503838aad362af866e0 (patch)
tree6288cc3dd7013d6589514f2a8e4d3723ccfffd05 /clang/lib/Sema/SemaDeclCXX.cpp
parent5688f168528377d1c55fe1feff82c9caa21a7c0a (diff)
downloadbcm5719-llvm-38c3b5d562ac6a5ab0ef5503838aad362af866e0.tar.gz
bcm5719-llvm-38c3b5d562ac6a5ab0ef5503838aad362af866e0.zip
[c++20] Improve phrasing of diagnostic for missing #include <compare>.
Diffstat (limited to 'clang/lib/Sema/SemaDeclCXX.cpp')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index ba4d450984a..239aaf65c86 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -7599,7 +7599,8 @@ public:
// Per C++2a [class.spaceship]p3, as a fallback add:
// return static_cast<R>(std::strong_ordering::equal);
QualType StrongOrdering = S.CheckComparisonCategoryType(
- ComparisonCategoryType::StrongOrdering, Loc);
+ ComparisonCategoryType::StrongOrdering, Loc,
+ Sema::ComparisonCategoryUsage::DefaultedOperator);
if (StrongOrdering.isNull())
return StmtError();
VarDecl *EqualVD = S.Context.CompCategories.getInfoForType(StrongOrdering)
@@ -8057,7 +8058,8 @@ bool Sema::CheckExplicitlyDefaultedComparison(Scope *S, FunctionDecl *FD,
RetLoc = FD->getBeginLoc();
// FIXME: Should we really care whether we have the complete type and the
// 'enumerator' constants here? A forward declaration seems sufficient.
- QualType Cat = CheckComparisonCategoryType(Info.Category, RetLoc);
+ QualType Cat = CheckComparisonCategoryType(
+ Info.Category, RetLoc, ComparisonCategoryUsage::DefaultedOperator);
if (Cat.isNull())
return true;
Context.adjustDeducedFunctionResultType(
@@ -10591,7 +10593,8 @@ struct InvalidSTLDiagnoser {
} // namespace
QualType Sema::CheckComparisonCategoryType(ComparisonCategoryType Kind,
- SourceLocation Loc) {
+ SourceLocation Loc,
+ ComparisonCategoryUsage Usage) {
assert(getLangOpts().CPlusPlus &&
"Looking for comparison category type outside of C++.");
@@ -10620,7 +10623,7 @@ QualType Sema::CheckComparisonCategoryType(ComparisonCategoryType Kind,
std::string NameForDiags = "std::";
NameForDiags += ComparisonCategories::getCategoryString(Kind);
Diag(Loc, diag::err_implied_comparison_category_type_not_found)
- << NameForDiags;
+ << NameForDiags << (int)Usage;
return QualType();
}
OpenPOWER on IntegriCloud