]> granicus.if.org Git - clang/commit
Consider hidden decls for isUsed checks.
authorRafael Espindola <rafael.espindola@gmail.com>
Tue, 22 Oct 2013 21:56:29 +0000 (21:56 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Tue, 22 Oct 2013 21:56:29 +0000 (21:56 +0000)
commit65f958dca64ef64d43bf85e871ec64e638ff2602
treedc7e154189e4ebadea9c470d5299f519822e3caf
parentb1c0e204046b72828e513bad369ab03252b2c42e
Consider hidden decls for isUsed checks.

This fixes pr17624.

A FIXME from Richard Smith:

It seems to me that the root cause is that a per-Decl 'used' flag doesn't
really make much sense in the way we use it now. I think we should either track
whether that particular declaration is used (with isUsed scanning the entire
redecl chain), or we should only have one flag for the entire redeclaration
chain (perhaps by always looking at the flag on either the most recent decl or
the canonical decl). Modeling it as "is this declaration or any previous
declaration used" is weird, and requires contortions like the loop at the end
of Sema::MarkFunctionReferenced.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@193202 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Sema/SemaDecl.cpp
test/Sema/warn-variable-not-needed.c [new file with mode: 0644]
test/SemaCXX/warn-func-not-needed.cpp