This is an archive of the discontinued LLVM Phabricator instance.

[analyzer][tests] Add normalize_plist to replace diff_plist
ClosedPublic

Authored by hubert.reinterpretcast on Jun 6 2019, 6:59 AM.

Details

Summary

The %diff_plist lit substitution invokes diff with a non-portable -I option. The intended effect can be achieved by normalizing the inputs to diff beforehand. Such normalization can be done with grep -Ev, which is also used by other tests.

This patch applies the change (adjusted for review comments) described in http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html to the specific case shown in the list message. Mechanical changes to the other affected files will follow in later patches.

Diff Detail

Repository
rL LLVM

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptJun 6 2019, 6:59 AM
NoQ added a comment.EditedJun 6 2019, 9:13 PM

Thanks!

I think we should:

  • Pre-normalize our expected outputs so that we didn't have to normalize them in every run-line.
  • Treat the lack of newline in plist output as a bug and try to fix it.
In D62949#1533574, @NoQ wrote:

I think we should:

  • Pre-normalize our expected outputs so that we didn't have to normalize them in every run-line.

Okay; I think this might be possible to do in a separate patch that does not depend on this set.

  • Treat the lack of newline in plist output as a bug and try to fix it.

A quick look at this seems to point at clang/lib/ARCMigrate/PlistReporter.cpp and clang/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp.

NoQ accepted this revision.Jun 6 2019, 9:55 PM

Ok! I'll be happy to have this addressed incrementally.

This revision is now accepted and ready to land.Jun 6 2019, 9:55 PM
In D62949#1533605, @NoQ wrote:

Ok! I'll be happy to have this addressed incrementally.

I think it should be safe to at least commit the pre-normalization directly first. I'll take a look, and update the patch if the pre-normalization lands.

I've tested the pre-normalization and it looks like I can commit it tomorrow. I noticed that the following three files appear to be unreferenced:

clang/test/Analysis/Inputs/expected-plists/cstring-plist.c.plist
clang/test/Analysis/Inputs/expected-plists/plist-stats-output.c.plist
clang/test/Analysis/Inputs/expected-plists/yaccignore.c.plist

I'll commit the deletion of these tomorrow as well.

Modifying the tools to produce a newline at the end of the output also seems to work okay with the tests. I've posted the change for that in D63041.

Update based on review comments, building from rL362877 and D63041

@NoQ, I've updated the patches based on the changes you suggested. This patch, D62950, and D62951 now looks much cleaner. These are now dependent on the approval of D63041.

This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 10 2019, 3:31 PM