This is an archive of the discontinued LLVM Phabricator instance.

Check whether Gentoo-specific configuration directory exists
ClosedPublic

Authored by dmantipov on Sep 4 2020, 7:35 AM.

Details

Summary

Check whether /etc/env.d/gcc exists before trying to read from any
file from there. This saves a few OS calls on a non-Gentoo system.

Diff Detail

Event Timeline

dmantipov created this revision.Sep 4 2020, 7:35 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 4 2020, 7:35 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dmantipov requested review of this revision.Sep 4 2020, 7:35 AM
manojgupta added inline comments.
clang/lib/Driver/ToolChains/Gnu.cpp
2538–2539

I think it should be D.SysRoot + GentooConfigDir. Otherwise, there is no way to test a Gentoo configuration tests on a non-Gentoo machine.

mgorny added inline comments.Sep 4 2020, 10:11 AM
clang/lib/Driver/ToolChains/Gnu.cpp
2538–2539

Probably correct, given that D.SysRoot is used below. However, this code is a bit above my pay grade and I was never sure whether it's doing right what it's supposed to do. I would really prefer if someone higher up reviewed this.

dmantipov updated this revision to Diff 289998.Sep 4 2020, 11:05 AM

Add D.SysRoot as suggested during initial review.

manojgupta accepted this revision.Sep 4 2020, 11:18 AM

Looks ok to me.

This revision is now accepted and ready to land.Sep 4 2020, 11:18 AM
dmantipov accepted this revision.Sep 9 2020, 10:53 PM
dmantipov added a reviewer: aganea.
This revision was landed with ongoing or failed builds.Sep 23 2020, 10:26 AM
This revision was automatically updated to reflect the committed changes.
MaskRay added inline comments.
clang/lib/Driver/ToolChains/Gnu.cpp
2538

Thanks. This should reduce the number of stat syscalls.