This is an archive of the discontinued LLVM Phabricator instance.

Refactor the code in clang to find a file in a PATH like environment variable into a helper function
ClosedPublic

Authored by ehsan on Jun 18 2014, 5:16 PM.

Details

Reviewers
hans

Diff Detail

Event Timeline

ehsan updated this revision to Diff 10597.Jun 18 2014, 5:16 PM
ehsan retitled this revision from to Refactor the code in clang to find a file in a PATH like environment variable into a helper function.
ehsan updated this object.
ehsan edited the test plan for this revision. (Show Details)
ehsan added a reviewer: hans.
ehsan added a subscriber: Unknown Object (MLST).
hans edited edge metadata.Jun 19 2014, 9:35 AM

The code itself looks good, but I'm not sure this is the right place.

include/llvm/Support/Program.h
156 ↗(On Diff #10597)

I'm not sure Program.h is the right place. This header seems mostly concerned with running programs.

Perhaps Process.h, next to GetEnv() is a better place? Or maybe FileSystem.h?

I chose Program.h because I found FindProgramByName there... But I'm not sure if that's the best place either. Can you please suggest either Process.h or FileSystem.h? Either would work for me. :-)

hans added a comment.Jun 19 2014, 11:22 AM

I chose Program.h because I found FindProgramByName there... But I'm not sure if that's the best place either. Can you please suggest either Process.h or FileSystem.h? Either would work for me. :-)

I feel this is tightly related to GetEnv, so let's go for Process.

ehsan updated this revision to Diff 10649.Jun 19 2014, 11:34 AM
ehsan edited edge metadata.

Moved the function to Process.h.

hans accepted this revision.Jun 19 2014, 12:41 PM
hans edited edge metadata.

lgtm

lib/Support/Process.cpp
74

Nit: The curly should go on the previous line.

77

I guess we can drop hasValue() here since Optional has its bool operator.

This revision is now accepted and ready to land.Jun 19 2014, 12:41 PM
ehsan closed this revision.Jun 30 2014, 1:06 PM

Landed in r212057.