This is an archive of the discontinued LLVM Phabricator instance.

[clang] [Driver] Add an option to disable default config filenames
ClosedPublic

Authored by mgorny on Sep 16 2022, 12:10 AM.

Details

Summary

Add a --no-default-config option that disables the search for default
set of config filenames (based on the compiler executable name).

Suggested in https://discourse.llvm.org/t/rfc-adding-a-default-file-location-to-config-file-support/63606.

Diff Detail

Event Timeline

mgorny created this revision.Sep 16 2022, 12:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2022, 12:10 AM
Herald added a subscriber: StephenFan. · View Herald Transcript
mgorny requested review of this revision.Sep 16 2022, 12:10 AM

This makes sense.

clang/lib/Driver/Driver.cpp
1027–1034

&& ?

clang/test/Driver/config-file3.c
53

The convention doesn't use otherwise empty // . The file does not obey the convention but your new lines can drop the empty //

mgorny added inline comments.Sep 16 2022, 12:31 AM
clang/lib/Driver/Driver.cpp
1027–1034

&& would mean dereferencing null pointer ;-).

clang/test/Driver/config-file3.c
53

Do you mean the extra space or the entire empty line?

MaskRay accepted this revision.Sep 16 2022, 12:34 AM

LGTM.

clang/lib/Driver/Driver.cpp
1027–1034

oh, i misread. sorry. the two if can be merged

clang/test/Driver/config-file3.c
53

I mean ^// *$, which typically makes the test harder to browse.

(Think of { } in vim. If every line has //, { } isn't effective at all.)

This revision is now accepted and ready to land.Sep 16 2022, 12:34 AM
mgorny updated this revision to Diff 460665.Sep 16 2022, 12:53 AM

Replace !x || !y logic with !(x && y) that may be easier to comprehend.

Replace // with empty lines on test boundaries.

mgorny added inline comments.Sep 16 2022, 12:55 AM
clang/lib/Driver/Driver.cpp
1027–1034

I've deliberately left it like that to account for possibly more rules being added in the future (e.g. explicit -target, given the discourse discussion).

I've changed !x || !y to !(x && y), perhaps that will be less confusing.

clang/test/Driver/config-file3.c
53

Oh, so you mean to have empty lines between tests to make it easier to navigate between tests? Please let me know if I got this right.

MaskRay accepted this revision.Sep 16 2022, 12:58 AM
MaskRay added inline comments.
clang/test/Driver/config-file3.c
44

Append . after a complete sentence in a comment.

53

Thanks, this looks better. I think the convention is not to even leave ^//$ between RUN and CHECK, but the current form is already good enough.

mgorny marked 6 inline comments as done.Sep 16 2022, 1:19 AM

Thanks! I'm going to give others a few more hours to chime in before merging it.

sepavloff accepted this revision.Sep 16 2022, 2:47 AM

LGTM.

Thanks!

Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2022, 10:38 AM