[cfe-dev] [Patch] Diagnose unused declaration
Chris Lattner
clattner at apple.com
Mon Jan 5 16:11:01 PST 2009
On Jan 5, 2009, at 11:37 AM, Sebastian Redl wrote:
> I think both problems could be solved together by, instead of keeping
> track of declarations that are used, keeping track of those that are
> unused.
> In other words, the UsedDeclarations becomes UnusedDeclarations.
> When a
> new declaration is encountered, it is added to the set if
> 1) it is function-local or TU-local and
> 2) it does not have the unused attribute.
> When a declaration is used, it is removed from the set. When a scope
> is
> left, we check which of the declarations now going out of scope are
> still in the set and warn about those.
I agree, that is a very nice approach.
-Chris
More information about the cfe-dev
mailing list