This is an archive of the discontinued LLVM Phabricator instance.

[clang] NFC: Robustify test regex
ClosedPublic

Authored by urnathan on Nov 14 2022, 6:01 AM.

Details

Summary

You know what they say about solving a problem with regexs?

These tests are checking for 'sret' markers, and just searching for 'sret' sans deliminters. But that also finds the source file names so then explicitly excludes them. But there are other ways other instances of 'sret' can get there. In my case it was in the version string, because my usual set up is to make a local branch in a 'me/feature-desc' subdirectory, whose upstream is my trunk. And this ends up with the pathname in the version string. And guess what I'm fiddling with :)

ISTM that a better regexp would be making sure the 'sret' is preceded by a space. I also check it terminates with '<maybe-spaces>(', but we could also with something else.

Diff Detail

Event Timeline

urnathan created this revision.Nov 14 2022, 6:01 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 14 2022, 6:01 AM
urnathan requested review of this revision.Nov 14 2022, 6:01 AM
rnk accepted this revision.Nov 14 2022, 12:10 PM

Thanks! These tests must be quite old to still be using grep. For bonus points you could convert these to FileCheck, but this is also good as is.

This revision is now accepted and ready to land.Nov 14 2022, 12:10 PM
urnathan updated this revision to Diff 476903.Nov 21 2022, 7:55 AM

Ah, it didn't occur to me that grep was a sign of old test harness. Here's a FileCheckified version. I took the opportunity to combine the two testcases, as there didn't seem a need to keep them separate any more.

rnk accepted this revision.Nov 21 2022, 8:51 AM

Thanks!

This revision was landed with ongoing or failed builds.Nov 21 2022, 11:20 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 21 2022, 11:20 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript