This is an archive of the discontinued LLVM Phabricator instance.

clang-cl: Don't warn for unused private fields when encountering a late parsed template member
ClosedPublic

Authored by ehsan on Oct 9 2014, 7:37 PM.

Diff Detail

Event Timeline

ehsan updated this revision to Diff 14698.Oct 9 2014, 7:37 PM
ehsan retitled this revision from to clang-cl: Don't warn for unused private fields when encountering a late parsed template member.
ehsan updated this object.
ehsan edited the test plan for this revision. (Show Details)
ehsan added a reviewer: rnk.
ehsan added a subscriber: Unknown Object (MLST).
hans added a subscriber: hans.Oct 10 2014, 12:05 PM
hans added inline comments.
lib/Sema/Sema.cpp
548

Is the issue that the template has been defined, but we haven't parsed and semantically analysed it because it's late-parsed?

This gets called from ActOnEndOfTranslationUnit, so shouldn't the delayed template parsing already have taken place?

ehsan added inline comments.Oct 10 2014, 1:48 PM
lib/Sema/Sema.cpp
548

Yes the template is not defined by we haven't done semantic analysis (and parsing!) on it yet. It looks like by ActOnEndOfTranslationUnit the semantic analysis still wouldn't happen unless if we see a call to that function (or presumably other things such as its address being taken etc.) IOW if the test case includes an instantiation of the template member, the warning doesn't appear.

hans accepted this revision.Oct 10 2014, 5:18 PM
hans added a reviewer: hans.
hans added inline comments.
lib/Sema/Sema.cpp
548

Oh that makes sense. If we don't instantiate it, we don't parse it.

This patch seems correct to me, but please add a comment about this check.

This revision is now accepted and ready to land.Oct 10 2014, 5:18 PM
ehsan closed this revision.Oct 10 2014, 5:34 PM
ehsan updated this revision to Diff 14760.

Closed by commit rL219551 (authored by @ehsan).