Closed Bug 510491 Opened 15 years ago Closed 11 years ago

Adding 'instantiated from' support in dehydra?

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

x86
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: dnovillo, Assigned: taras.mozilla)

References

Details

When our analysis discovers an error with template instantiation.  When we see a "bad" instantiation:

foo.h:
enum MyEnum { EnumVal21, EnumVal22 };

template<typename FOO>
class MyTemplateClass {
 public:
  MyTemplateClass(FOO a) { a_ = a; }
  FOO a() { return a_; }
 private:
  FOO a_;
};


foo.cc:
MyTemplateClass<MyEnum> templateclass2(EnumVal21);

where MyEnum is an analysis violation, the error is flagged in
foo.h instead of foo.cc.  We would like to be able to flag it at
foo.cc.  Probably following GCC's "instantiated from here"
messages:

foo.h:3: error: Type MyEnum is wonky.
foo.cc:1: instantiated from here.

However, it does not seem that dehydra collects enough locus
information to provide that.

Would this be hard to add?  Where should I start looking?
I think you are talking about taking .loc information pulled from ASTs and you'd like to be able to be get more info on it. This should be easy as dehydra has a special location type that keeps gcc's underlying location id.

loc.name and .line/col are lazily computed. So you'd add another property for locus stuff.

http://hg.mozilla.org/rewriting-and-analysis/dehydra/file/ab8be6feaf50/dehydra.c#l327

This would be a very useful feature to have, I've been wanting to expose that for a while, but never got around to it.
Blocks: 437502
Dehydra and treehydra are no longer maintained by Mozilla.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
Product: Core → Firefox Build System
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.