This is an archive of the discontinued LLVM Phabricator instance.

[clang][tooling] NFC: Refactor command-line diagnostic tests
ClosedPublic

Authored by jansvoboda11 on Sep 21 2021, 5:27 AM.

Details

Summary

This patch uses a different command-line arguments to test clang::tooling::ToolInvocation that are not specific to Darwin.

Diff Detail

Event Timeline

jansvoboda11 requested review of this revision.Sep 21 2021, 5:27 AM
jansvoboda11 created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptSep 21 2021, 5:27 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dexonsmith added inline comments.Sep 21 2021, 8:58 AM
clang/unittests/Tooling/ToolingTest.cpp
238–244

I'm worried this is going to behave differently when the unit test isn't run on Darwin, since I think -isysroot is only valid for Darwin targets and there's no -arch or -target option. Can you confirm whether this should reproduce properly when run on other hosts as well?

Stepping back, maybe it'd be better to use a more generic option that is unlikely to have special behaviour in any target (or downstream).

Best one I could find is triggering err_drv_unknown_language with -x this-is-an-unknown-language. WDYT?

clang/unittests/Tooling/ToolingTest.cpp
277–280

Can this just be empty and use -E? But if you switch to another error maybe you don't need to modify this anyway?

Use flags not specific to Darwin

jansvoboda11 edited the summary of this revision. (Show Details)Sep 22 2021, 3:18 PM

I think we need a warning option to be able to suppress it (or conditionally promote to an error).

clang/unittests/Tooling/ToolingTest.cpp
238–244

Good point, I switched to a platform-agnostic flags.

277–280

Yes, that would be a nice simplification.

Use empty files and -E

This revision is now accepted and ready to land.Sep 22 2021, 4:01 PM
This revision was landed with ongoing or failed builds.Sep 23 2021, 12:32 AM
This revision was automatically updated to reflect the committed changes.