llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Vlad Serebrennikov (Endilll) <details> <summary>Changes</summary> This fixes layering violation introduced in 2fd01d75a863184766ee0c82b5c0fc8be172448a. The declaration is moved to `SemaTemplateInstantiate` section of `Sema.h`, after the file where it's implemented. --- Full diff: https://github.com/llvm/llvm-project/pull/113294.diff 4 Files Affected: - (modified) clang/include/clang/AST/ExprConcepts.h (-8) - (modified) clang/include/clang/Sema/Sema.h (+7) - (modified) clang/lib/Sema/SemaExprCXX.cpp (+5-5) - (modified) clang/lib/Sema/SemaTemplateInstantiate.cpp (+3-4) ``````````diff diff --git a/clang/include/clang/AST/ExprConcepts.h b/clang/include/clang/AST/ExprConcepts.h index 29913fd84c58b4..f3e32ce3961981 100644 --- a/clang/include/clang/AST/ExprConcepts.h +++ b/clang/include/clang/AST/ExprConcepts.h @@ -489,14 +489,6 @@ class NestedRequirement : public Requirement { return R->getKind() == RK_Nested; } }; - -using EntityPrinter = llvm::function_ref<void(llvm::raw_ostream &)>; - -/// \brief create a Requirement::SubstitutionDiagnostic with only a -/// SubstitutedEntity and DiagLoc using Sema's allocator. -Requirement::SubstitutionDiagnostic * -createSubstDiagAt(Sema &S, SourceLocation Location, EntityPrinter Printer); - } // namespace concepts /// C++2a [expr.prim.req]: diff --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h index bc9c422ed4c477..18ba63ab5a7867 100644 --- a/clang/include/clang/Sema/Sema.h +++ b/clang/include/clang/Sema/Sema.h @@ -13435,6 +13435,13 @@ class Sema final : public SemaBase { return CodeSynthesisContexts.size() > NonInstantiationEntries; } + using EntityPrinter = llvm::function_ref<void(llvm::raw_ostream &)>; + + /// \brief create a Requirement::SubstitutionDiagnostic with only a + /// SubstitutedEntity and DiagLoc using Sema's allocator. + concepts::Requirement::SubstitutionDiagnostic * + createSubstDiagAt(SourceLocation Location, EntityPrinter Printer); + ///@} // diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp index 40f24ea0ab2eaa..e19016ab23abe7 100644 --- a/clang/lib/Sema/SemaExprCXX.cpp +++ b/clang/lib/Sema/SemaExprCXX.cpp @@ -9444,11 +9444,11 @@ Sema::BuildExprRequirement( ExprResult Constraint = SubstExpr(IDC, MLTAL); if (Constraint.isInvalid()) { return new (Context) concepts::ExprRequirement( - concepts::createSubstDiagAt(*this, IDC->getExprLoc(), - [&](llvm::raw_ostream &OS) { - IDC->printPretty(OS, /*Helper=*/nullptr, - getPrintingPolicy()); - }), + createSubstDiagAt(IDC->getExprLoc(), + [&](llvm::raw_ostream &OS) { + IDC->printPretty(OS, /*Helper=*/nullptr, + getPrintingPolicy()); + }), IsSimple, NoexceptLoc, ReturnTypeRequirement); } SubstitutedConstraintExpr = diff --git a/clang/lib/Sema/SemaTemplateInstantiate.cpp b/clang/lib/Sema/SemaTemplateInstantiate.cpp index 457a9968c32a4a..198442dd9821ec 100644 --- a/clang/lib/Sema/SemaTemplateInstantiate.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiate.cpp @@ -2654,7 +2654,7 @@ QualType TemplateInstantiator::TransformSubstTemplateTypeParmPackType( static concepts::Requirement::SubstitutionDiagnostic * createSubstDiag(Sema &S, TemplateDeductionInfo &Info, - concepts::EntityPrinter Printer) { + Sema::EntityPrinter Printer) { SmallString<128> Message; SourceLocation ErrorLoc; if (Info.hasSFINAEDiagnostic()) { @@ -2675,12 +2675,11 @@ createSubstDiag(Sema &S, TemplateDeductionInfo &Info, } concepts::Requirement::SubstitutionDiagnostic * -concepts::createSubstDiagAt(Sema &S, SourceLocation Location, - EntityPrinter Printer) { +Sema::createSubstDiagAt(SourceLocation Location, EntityPrinter Printer) { SmallString<128> Entity; llvm::raw_svector_ostream OS(Entity); Printer(OS); - const ASTContext &C = S.Context; + const ASTContext &C = Context; return new (C) concepts::Requirement::SubstitutionDiagnostic{ /*SubstitutedEntity=*/C.backupStr(Entity), /*DiagLoc=*/Location, /*DiagMessage=*/StringRef()}; `````````` </details> https://github.com/llvm/llvm-project/pull/113294 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits