If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

process_type() not receiving template instantiations

RESOLVED WONTFIX

Status

()

Core
Rewriting and Analysis
RESOLVED WONTFIX
8 years ago
2 years ago

People

(Reporter: Diego Novillo, Assigned: (dormant account))

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

8 years ago
Given

# 1 "test.cc"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "test.cc"


template<typename FOO>
class MyTemplateClass {
  public:
    MyTemplateClass(FOO a) { a_ = a; }
    FOO a() { return a_; }
  private:
    FOO a_;
};
# 20 "test.cc"
template<> class MyTemplateClass<int>;


and the dehydra script:

function process_type(t)
{
  print("Type found: " + t.name + " location: " + t.loc);
}

I would expect to see two types printed, but only the template type is received by 't'.  The specialization is not seen.


Type found: MyTemplateClass<FOO> location: test.cc:4:23

If I add a process_decl() callback, I can access the specialized type via the decl, but I was expecting to see the type in process_type as well.

Bug or feature?

Comment 1

8 years ago
The template hasn't actually been instantiated, has it? Do you get the process_type call if you then use MyTemplateClass<int> in a function?
(Reporter)

Comment 2

8 years ago
Right, there is no instantiation for the template.  It's just the forward declaration for the class specialization.  We'd still need to intercept it to analyze the arguments.  Doing it in process_type() seemed the more natural place.

If I specialize the template declaring a variable, process_type() will see it, of course.

Comment 3

8 years ago
Yeah, I don't think GCC gives us the type callback until it is instantiated... either way is fine with me if there's a way to make GCC behave.
(Assignee)

Comment 4

8 years ago
Yeah, process_type is basically more or less what gcc gives us. I'll accept a patch for this.
Dehydra and treehydra are no longer maintained by Mozilla.
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.