Skip to content

Commit 43e1443

Browse files
committed
[cling] Update policy for GetFullyQualifiedName in cling utils
Just like in CppInterOp, set the `SuppressElaboration` and `FullyQualifiedName` policies when getting the fully qualified name of a QualType. Closes the following JIRA ticket: https://its.cern.ch/jira/browse/ROOT-10150
1 parent 8ad447e commit 43e1443

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

interpreter/cling/lib/Utils/AST.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1762,6 +1762,8 @@ namespace utils {
17621762
PrintingPolicy Policy(Ctx.getPrintingPolicy());
17631763
Policy.SuppressScope = false;
17641764
Policy.AnonymousTagLocations = false;
1765+
Policy.SuppressElaboration = true;
1766+
Policy.FullyQualifiedName = true;
17651767
return FQQT.getAsString(Policy);
17661768
}
17671769

roottest/root/meta/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ ROOTTEST_ADD_TEST(loadernotapp
3838
OUTREF loadernotapp.ref
3939
DEPENDS ${GENERATE_EXECUTABLE_TEST})
4040

41+
ROOTTEST_ADD_TEST(reproduceROOT10150
42+
MACRO reproduceROOT10150.C+
43+
FAILREGEX "error")
44+
4145
ROOTTEST_COMPILE_MACRO(fornamespace.C)
4246

4347
#---Copy from source to binary some of the files
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// reproducer from https://its.cern.ch/jira/browse/ROOT-10150
2+
3+
#include <TInterpreter.h>
4+
#include <functional>
5+
#include <iostream>
6+
7+
namespace Foo {
8+
struct Particle {
9+
float m_pt;
10+
float pt() const { return m_pt; }
11+
};
12+
} // namespace Foo
13+
14+
template <typename FType>
15+
FType get_functor(std::string const &functor_string)
16+
{
17+
auto intern = gInterpreter->MakeInterpreterValue();
18+
gInterpreter->Evaluate(functor_string.c_str(), *intern);
19+
return *static_cast<FType *>(intern->GetAsPointer());
20+
}
21+
22+
void reproduceROOT10150()
23+
{
24+
auto functor = get_functor<std::function<bool(Foo::Particle const &)>>(
25+
"std::function<bool(Foo::Particle const&)>( [](Foo::Particle const& particle){return particle.pt() > 15;} );");
26+
Foo::Particle low_pT_particle{1.f}, high_pT_particle{40.f};
27+
std::cout << functor(high_pT_particle) << " " << functor(low_pT_particle) << std::endl;
28+
}

0 commit comments

Comments
 (0)