-
Notifications
You must be signed in to change notification settings - Fork 8
fix: resolve namespace while instantiating templates in a namespace #151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
fix: resolve namespace while instantiating templates in a namespace #151
Conversation
clingwrapper/src/clingwrapper.cxx
Outdated
@@ -593,6 +593,17 @@ bool Cppyy::AppendTypesSlow(const std::string& name, | |||
if (is_integral(i)) | |||
integral_value = strdup(i.c_str()); | |||
types.emplace_back(type, integral_value); | |||
} else if (parent && (Cpp::IsNamespace(parent) || Cpp::IsClass(parent))) { | |||
std::string qualified_name = Cpp::GetQualifiedCompleteName(parent) + "::" + name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we replace that with a simple lookup without qualification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, the lookup does not work without the qualification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to figure out what api we need to create to avoid string concatenation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is acceptable. We are only concatenating the parent scope with the child. There is nothing else going on here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why GetNamed(name, parent) does not work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetNamed
worked. I initially tried GetScope
and it failed. I have pushed the changes.
2164192
to
7acfe70
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I would wait for Vassil's review to merge
clingwrapper/src/clingwrapper.cxx
Outdated
@@ -607,22 +617,16 @@ Cppyy::TCppType_t Cppyy::GetType(const std::string &name, bool enable_slow_looku | |||
if (auto type = Cpp::GetType(name)) | |||
return type; | |||
|
|||
if (!enable_slow_lookup) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that diagnostic is important to expose interfaces that still do parsing of qualified names.
Enables instantiating templates `f` with type `t` without explicitly specifying the namespace in type `t`, if `f` and `t` belong to the same namespace.
7acfe70
to
fc231c5
Compare
Enables instantiating templates
f
with typet
without explicitly specifying the namespace in typet
, iff
andt
belong to the same namespace.Has a cyclic dependency with compiler-research/CPyCppyy#104