So, a few thoughts: - bool[const(char)*] will be indexed by the pointer address by default, not the value of the string. bool[const(char)[]] should work. - toChars is not great for this. Using the mangled name would be better - Not every symbol that is used will have an identifier search done for it. Sometimes they will be cached as members of some ast class and referenced directly. Doing a walk of the post-semantic AST to build the referenced list might be better. See what the json emission does for an example of a post-semantic walk, although that doesn't walk expressions (which you'd need to do).
On Wed, Mar 30, 2016 at 8:11 AM, cy via dmd-internals <[email protected]> wrote: > Well, Module in dmodule.d has a list called "members" returned from parsing > the code, each item a symbol that's supposedly a member of that module. But, > the list also includes template specializations and package names, which are > apparantly never searched for? > > In dmd, I made a bool[const(char)*] searched array in the Module class, and > added to that a symbol's "toChars" representation every time it was searched > for in that module. Then, in the third pass (was that a mistake?) I compared > every item in Module.members to see if its toChars representation was in > that array. If not, it warns about an unused identifier. > > So, it searched for like 5 symbols, and there were 2000 symbols give or take > in the members array, resulting in a wall of text of unused identifiers, > that are actually used I'm sure, but I have no idea how to determine that, > if they're never looked up. > _______________________________________________ > dmd-internals mailing list > [email protected] > http://lists.puremagic.com/mailman/listinfo/dmd-internals _______________________________________________ dmd-internals mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/dmd-internals
