Skip to content

Commit 4d46c33

Browse files
committed
[𝘀𝗽𝗿] changes to main this commit is based on
Created using spr 1.3.5 [skip ci]
1 parent 3ccba24 commit 4d46c33

File tree

15 files changed

+109
-75
lines changed

15 files changed

+109
-75
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4933,6 +4933,8 @@ def err_template_param_shadow : Error<
49334933
def ext_template_param_shadow : ExtWarn<
49344934
err_template_param_shadow.Summary>, InGroup<MicrosoftTemplateShadow>;
49354935
def note_template_param_here : Note<"template parameter is declared here">;
4936+
def note_template_param_external : Note<
4937+
"template parameter from hidden source: %0">;
49364938
def warn_template_export_unsupported : Warning<
49374939
"exported templates are unsupported">;
49384940
def err_template_outside_namespace_or_class_scope : Error<
@@ -5061,6 +5063,8 @@ def err_template_arg_list_different_arity : Error<
50615063
"%select{class template|function template|variable template|alias template|"
50625064
"template template parameter|concept|template}1 %2">;
50635065
def note_template_decl_here : Note<"template is declared here">;
5066+
def note_template_decl_external : Note<
5067+
"template declaration from hidden source: %0">;
50645068
def err_template_arg_must_be_type : Error<
50655069
"template argument for template type parameter must be a type">;
50665070
def err_template_arg_must_be_type_suggest : Error<

clang/include/clang/Sema/Sema.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8557,6 +8557,10 @@ class Sema final {
85578557
TemplateParameterList *Params,
85588558
TemplateArgumentLoc &Arg);
85598559

8560+
void NoteTemplateLocation(const NamedDecl &Decl,
8561+
std::optional<SourceRange> ParamRange = {});
8562+
void NoteTemplateParameterLocation(const NamedDecl &Decl);
8563+
85608564
ExprResult
85618565
BuildExpressionFromDeclTemplateArgument(const TemplateArgument &Arg,
85628566
QualType ParamType,

clang/lib/Sema/HLSLExternalSemaSource.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ void HLSLExternalSemaSource::forwardDeclareHLSLTypes() {
471471
CXXRecordDecl *Decl;
472472
Decl = BuiltinTypeDeclBuilder(*SemaPtr, HLSLNamespace, "RWBuffer")
473473
.addTemplateArgumentList()
474-
.addTypeParameter("element_type", SemaPtr->getASTContext().FloatTy)
474+
.addTypeParameter("element_type")
475475
.finalizeTemplateArgs()
476476
.Record;
477477
if (!Decl->isCompleteDefinition())

clang/lib/Sema/SemaDecl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5971,7 +5971,7 @@ Sema::GetNameFromUnqualifiedId(const UnqualifiedId &Name) {
59715971
diag::err_deduction_guide_name_not_class_template)
59725972
<< (int)getTemplateNameKindForDiagnostics(TN) << TN;
59735973
if (Template)
5974-
Diag(Template->getLocation(), diag::note_template_decl_here);
5974+
NoteTemplateLocation(*Template);
59755975
return DeclarationNameInfo();
59765976
}
59775977

clang/lib/Sema/SemaDeclCXX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11462,7 +11462,7 @@ bool Sema::CheckDeductionGuideDeclarator(Declarator &D, QualType &R,
1146211462
GuidedTemplateDecl->getDeclContext()->getRedeclContext())) {
1146311463
Diag(D.getIdentifierLoc(), diag::err_deduction_guide_wrong_scope)
1146411464
<< GuidedTemplateDecl;
11465-
Diag(GuidedTemplateDecl->getLocation(), diag::note_template_decl_here);
11465+
NoteTemplateLocation(*GuidedTemplateDecl);
1146611466
}
1146711467

1146811468
auto &DS = D.getMutableDeclSpec();

clang/lib/Sema/SemaInit.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10573,7 +10573,7 @@ QualType Sema::DeduceTemplateSpecializationFromInitializer(
1057310573
diag::err_deduced_non_class_template_specialization_type)
1057410574
<< (int)getTemplateNameKindForDiagnostics(TemplateName) << TemplateName;
1057510575
if (auto *TD = TemplateName.getAsTemplateDecl())
10576-
Diag(TD->getLocation(), diag::note_template_decl_here);
10576+
NoteTemplateLocation(*TD);
1057710577
return QualType();
1057810578
}
1057910579

clang/lib/Sema/SemaLambda.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1444,7 +1444,7 @@ void Sema::ActOnStartOfLambdaDefinition(LambdaIntroducer &Intro,
14441444
for (const auto &Capture : Intro.Captures) {
14451445
if (Capture.Id == TP->getIdentifier()) {
14461446
Diag(Capture.Loc, diag::err_template_param_shadow) << Capture.Id;
1447-
Diag(TP->getLocation(), diag::note_template_param_here);
1447+
NoteTemplateParameterLocation(*TP);
14481448
}
14491449
}
14501450
}

0 commit comments

Comments
 (0)