This is an archive of the discontinued LLVM Phabricator instance.

Emit a warning if -xc/-xc++ is after the last input file
ClosedPublic

Authored by kongyi on Mar 15 2022, 3:54 AM.

Details

Summary

This follows the same warning GCC produces.

Diff Detail

Event Timeline

kongyi created this revision.Mar 15 2022, 3:54 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 3:54 AM
kongyi requested review of this revision.Mar 15 2022, 3:54 AM
srhines accepted this revision.Mar 15 2022, 8:27 AM

Looks great. Thanks for noticing and adding this.

This revision is now accepted and ready to land.Mar 15 2022, 8:27 AM
This revision was landed with ongoing or failed builds.Mar 15 2022, 10:08 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptMar 15 2022, 10:08 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
MaskRay added inline comments.Mar 15 2022, 10:33 AM
clang/include/clang/Basic/DiagnosticDriverKinds.td
369

Use ASCII punctuation marks

clang/test/Driver/x-args.c
2

The first two RUN lines are unneeded

8

No newline at end of file

MaskRay added inline comments.Mar 15 2022, 10:35 AM
clang/lib/Driver/Driver.cpp
2316

https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

Don’t Use Braces on Simple Single-Statement Bodies of if/else/loop Statements

Is it guaranteed that both LastXArg and LastInputArg will be non-null?

MaskRay added inline comments.Mar 15 2022, 10:38 AM
clang/test/Driver/x-args.c
2

Sorry, they are needed because of -Werror.