diff options
author | Richard Smith <richard@metafoo.co.uk> | 2019-12-04 15:25:27 -0800 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2019-12-08 23:21:52 -0800 |
commit | cafc7416baf7eecef8ecaf05802f2f7c0da725c0 (patch) | |
tree | 3ba432597b80af750b0263767ed58d5df9f46865 /clang/lib/Sema/SemaTemplateInstantiate.cpp | |
parent | 27f5d35137cb45e60d9988a9b55875883c55023c (diff) | |
download | bcm5719-llvm-cafc7416baf7eecef8ecaf05802f2f7c0da725c0.tar.gz bcm5719-llvm-cafc7416baf7eecef8ecaf05802f2f7c0da725c0.zip |
[c++20] Synthesis of defaulted comparison functions.
Array members are not yet handled. In addition, defaulted comparisons
can't yet find comparison operators by unqualified lookup (only by
member lookup and ADL). These issues will be fixed in follow-on changes.
Diffstat (limited to 'clang/lib/Sema/SemaTemplateInstantiate.cpp')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiate.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 2496c919311..4d54ec17b99 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -672,13 +672,23 @@ void Sema::PrintInstantiationStack() { break; case CodeSynthesisContext::DefiningSynthesizedFunction: { - // FIXME: For synthesized members other than special members, produce a note. - auto *MD = dyn_cast<CXXMethodDecl>(Active->Entity); - auto CSM = MD ? getSpecialMember(MD) : CXXInvalid; - if (CSM != CXXInvalid) { + // FIXME: For synthesized functions that are not defaulted, + // produce a note. + auto *FD = dyn_cast<FunctionDecl>(Active->Entity); + DefaultedFunctionKind DFK = + FD ? getDefaultedFunctionKind(FD) : DefaultedFunctionKind(); + if (DFK.isSpecialMember()) { + auto *MD = cast<CXXMethodDecl>(FD); Diags.Report(Active->PointOfInstantiation, diag::note_member_synthesized_at) - << CSM << Context.getTagDeclType(MD->getParent()); + << MD->isExplicitlyDefaulted() << DFK.asSpecialMember() + << Context.getTagDeclType(MD->getParent()); + } else if (DFK.isComparison()) { + Diags.Report(Active->PointOfInstantiation, + diag::note_comparison_synthesized_at) + << (int)DFK.asComparison() + << Context.getTagDeclType( + cast<CXXRecordDecl>(FD->getLexicalDeclContext())); } break; } |