diff --git a/interpreter/llvm-project/clang/lib/AST/NestedNameSpecifier.cpp b/interpreter/llvm-project/clang/lib/AST/NestedNameSpecifier.cpp index 36f2c47b30005..01adf429f2f26 100644 --- a/interpreter/llvm-project/clang/lib/AST/NestedNameSpecifier.cpp +++ b/interpreter/llvm-project/clang/lib/AST/NestedNameSpecifier.cpp @@ -285,13 +285,16 @@ void NestedNameSpecifier::print(raw_ostream &OS, const PrintingPolicy &Policy, case TypeSpec: { const auto *Record = dyn_cast_or_null(getAsRecordDecl()); - if (ResolveTemplateArguments && Record) { + const TemplateParameterList *TPL = nullptr; + if (Record) { + TPL = Record->getSpecializedTemplate()->getTemplateParameters(); + if (ResolveTemplateArguments) { // Print the type trait with resolved template parameters. Record->printName(OS, Policy); - printTemplateArgumentList( - OS, Record->getTemplateArgs().asArray(), Policy, - Record->getSpecializedTemplate()->getTemplateParameters()); + printTemplateArgumentList(OS, Record->getTemplateArgs().asArray(), + Policy, TPL); break; + } } const Type *T = getAsType(); @@ -315,8 +318,8 @@ void NestedNameSpecifier::print(raw_ostream &OS, const PrintingPolicy &Policy, TemplateName::Qualified::None); // Print the template argument list. - printTemplateArgumentList(OS, SpecType->template_arguments(), - InnerPolicy); + printTemplateArgumentList(OS, SpecType->template_arguments(), InnerPolicy, + TPL); } else if (const auto *DepSpecType = dyn_cast(T)) { // Print the template name without its corresponding @@ -324,7 +327,7 @@ void NestedNameSpecifier::print(raw_ostream &OS, const PrintingPolicy &Policy, OS << DepSpecType->getIdentifier()->getName(); // Print the template argument list. printTemplateArgumentList(OS, DepSpecType->template_arguments(), - InnerPolicy); + InnerPolicy, TPL); } else { // Print the type normally QualType(T, 0).print(OS, InnerPolicy); diff --git a/interpreter/llvm-project/llvm-project.tag b/interpreter/llvm-project/llvm-project.tag index 5233b016951cc..be7c2e0f4ec51 100644 --- a/interpreter/llvm-project/llvm-project.tag +++ b/interpreter/llvm-project/llvm-project.tag @@ -1 +1 @@ -ROOT-llvm18-20250407-01 +ROOT-llvm18-20250506-01 diff --git a/roottest/root/meta/naming/CMakeLists.txt b/roottest/root/meta/naming/CMakeLists.txt index 88d8058a7a0ed..b1045cd9fcb50 100644 --- a/roottest/root/meta/naming/CMakeLists.txt +++ b/roottest/root/meta/naming/CMakeLists.txt @@ -4,3 +4,5 @@ ROOTTEST_ADD_AUTOMACROS(DEPENDS namingMatches.cxx ROOTTEST_ADD_TEST(execCheckNaming MACRO execCheckNaming.C OUTREF execCheckNaming${ref_suffix}) + +ROOTTEST_ADD_TESTDIRS() diff --git a/roottest/root/meta/naming/issue-18363/CMakeLists.txt b/roottest/root/meta/naming/issue-18363/CMakeLists.txt new file mode 100644 index 0000000000000..e95fdbc1dcb2a --- /dev/null +++ b/roottest/root/meta/naming/issue-18363/CMakeLists.txt @@ -0,0 +1,6 @@ +ROOTTEST_GENERATE_REFLEX_DICTIONARY(templateDict Objects.h SELECTION selection.xml FIXTURES_SETUP template_lib) + +ROOTTEST_ADD_TEST(templateName + MACRO templateNameTest.C + OUTREF templateNameTest.ref + FIXTURES_REQUIRED template_lib) diff --git a/roottest/root/meta/naming/issue-18363/Objects.h b/roottest/root/meta/naming/issue-18363/Objects.h new file mode 100644 index 0000000000000..ac9896d2f5cd9 --- /dev/null +++ b/roottest/root/meta/naming/issue-18363/Objects.h @@ -0,0 +1,9 @@ +#ifndef Objects_18363_hxx +#define Objects_18363_hxx + +template +struct PFRecHitSoALayout { + struct View {}; +}; + +#endif diff --git a/roottest/root/meta/naming/issue-18363/selection.xml b/roottest/root/meta/naming/issue-18363/selection.xml new file mode 100644 index 0000000000000..00d779217a6b0 --- /dev/null +++ b/roottest/root/meta/naming/issue-18363/selection.xml @@ -0,0 +1,4 @@ + + + + diff --git a/roottest/root/meta/naming/issue-18363/templateNameTest.C b/roottest/root/meta/naming/issue-18363/templateNameTest.C new file mode 100644 index 0000000000000..4d413c537b22f --- /dev/null +++ b/roottest/root/meta/naming/issue-18363/templateNameTest.C @@ -0,0 +1,26 @@ +{ + TFile pcmfile("templateDict_rdict.pcm"); + if (pcmfile.IsZombie()) { + std::cerr << "Error: Failed to open roottest/root pcm file: " << pcmfile.GetName() << '\n'; + return 1; + } + TObjArray *protoArray = pcmfile.Get("__ProtoClasses"); + if (!protoArray) { + std::cerr << "Error: Failed to retrieve __ProtoClasses\n"; + return 2; + } + protoArray->Print(); + + const char *classname = "PFRecHitSoALayout<128>::View"; + auto cl = TClass::GetClass(classname); + if (!cl) { + std::cerr << "Error: Could not get the TClass for " << classname << "\n"; + return 3; + } + if (!cl->IsLoaded()) { + std::cerr << "Error: The TClass is not loaded for " << classname << "\n"; + return 4; + } + + return 0; +} diff --git a/roottest/root/meta/naming/issue-18363/templateNameTest.ref b/roottest/root/meta/naming/issue-18363/templateNameTest.ref new file mode 100644 index 0000000000000..d9733f30a26d7 --- /dev/null +++ b/roottest/root/meta/naming/issue-18363/templateNameTest.ref @@ -0,0 +1,5 @@ + +Processing templateNameTest.C... +Collection name='TObjArray', class='TObjArray', size=16 + OBJ: TProtoClass PFRecHitSoALayout<128> + OBJ: TProtoClass PFRecHitSoALayout<128>::View