This is an archive of the discontinued LLVM Phabricator instance.

[Driver] Allow warning for unclaimed TargetSpecific options
ClosedPublic

Authored by MaskRay on Jun 13 2023, 2:20 PM.

Details

Summary

For unclaimed target-agnostic options, we can apply clang_ignored_gcc_optimization_f_Group
to accept but warn about them.

% clang -c -fexpensive-optimizations a.c
clang: warning: optimization flag '-fexpensive-optimizations' is not supported [-Wignored-optimization-argument]

For an unclaimed target-specific option, one target may want to accept but warn
about it. Add llvm::opt::Arg::IgnoredTargetSpecific to support this warning
need.

Close https://github.com/llvm/llvm-project/issues/63282

Diff Detail

Event Timeline

MaskRay created this revision.Jun 13 2023, 2:20 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 13 2023, 2:20 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
MaskRay requested review of this revision.Jun 13 2023, 2:20 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptJun 13 2023, 2:20 PM
mstorsjo accepted this revision.Jun 14 2023, 5:39 AM

Looks great to me, thanks! (Didn't test it myself yet though.) Just one small nit.

llvm/include/llvm/Option/Arg.h
53

Technically, as this is a llvm level API, talking about clang specific behaviours here is a bit at the wrong level.

This revision is now accepted and ready to land.Jun 14 2023, 5:39 AM
MaskRay added inline comments.Jun 14 2023, 1:02 PM
llvm/include/llvm/Option/Arg.h
53

Yes. LLVMOption was originally part of Clang and was moved to llvm/.

The "argument unused" string is also quite Clang-specific. There are other stuff talking about Clang behaviors, e.g. suggestValueCompletions, Alias (-finput-charset=utf-8). I wish that this is not too bad.

mstorsjo added inline comments.Jun 14 2023, 1:11 PM
llvm/include/llvm/Option/Arg.h
53

Ok, fair enough - consider this remark withdrawn then. Even if mislayered, detailed comments explaining the reason for the field is better than no explanations.

MaskRay updated this revision to Diff 532167.Jun 16 2023, 8:30 AM

avoid mutable

This revision was landed with ongoing or failed builds.Jun 16 2023, 8:32 AM
This revision was automatically updated to reflect the committed changes.