This is an archive of the discontinued LLVM Phabricator instance.

[driver] Refactor getRuntimePaths. NFC
ClosedPublic

Authored by smeenai on Aug 21 2023, 6:55 PM.

Details

Summary

This used to be getRuntimePath till https://reviews.llvm.org/D115049
added a fallback search path for Android. As far as I can tell, the
intent has always been to use the first existing path though instead of
actually supporting multiple runtime paths. We can move the existence
checks into getRuntimePath and have it return std::optional, which also
makes the --print-runtime-dir behavior much cleaner.

The motivation is a follow-up change to Android runtime path searches,
which is much nicer with this in place.

Diff Detail

Event Timeline

smeenai created this revision.Aug 21 2023, 6:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2023, 6:55 PM
smeenai requested review of this revision.Aug 21 2023, 6:55 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2023, 6:55 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
phosek accepted this revision.Aug 24 2023, 7:35 PM

LGTM

This revision is now accepted and ready to land.Aug 24 2023, 7:35 PM
MaskRay accepted this revision.Aug 24 2023, 7:42 PM
This revision was landed with ongoing or failed builds.Aug 28 2023, 5:35 PM
This revision was automatically updated to reflect the committed changes.

This conflicts with D146664

This conflicts with D146664

It sounds like you want the same logic as D158476 to apply to the stdlib search as well as the runtimes search, right? I can make both be consistent.

This conflicts with D146664

It sounds like you want the same logic as D158476 to apply to the stdlib search as well as the runtimes search, right?

Sounds about right.

I can make both be consistent.

That would be much appreciated.

This conflicts with D146664

It sounds like you want the same logic as D158476 to apply to the stdlib search as well as the runtimes search, right?

Sounds about right.

I can make both be consistent.

That would be much appreciated.

I'm halfway through an implementation of this, but I just realized that on Android, Clang never searches for C++ headers installed alongside the driver: https://github.com/llvm/llvm-project/blob/7af0eff5405bb88dc96c0b19892da0fbb44db433/clang/lib/Driver/ToolChains/Gnu.cpp#L3116-L3118. Are you using the C++ headers from the NDK but a library that you built locally, or are you manually specifying the path to your C++ headers?

I'm halfway through an implementation of this, but I just realized that on Android, Clang never searches for C++ headers installed alongside the driver: https://github.com/llvm/llvm-project/blob/7af0eff5405bb88dc96c0b19892da0fbb44db433/clang/lib/Driver/ToolChains/Gnu.cpp#L3116-L3118. Are you using the C++ headers from the NDK but a library that you built locally, or are you manually specifying the path to your C++ headers?

At the moment, we're only really using libunwind from the clang stdlib directory. So we don't really have the problem with headers. It will eventually be a problem when we get to use libc++, which we'll want at some point.

I'm halfway through an implementation of this, but I just realized that on Android, Clang never searches for C++ headers installed alongside the driver: https://github.com/llvm/llvm-project/blob/7af0eff5405bb88dc96c0b19892da0fbb44db433/clang/lib/Driver/ToolChains/Gnu.cpp#L3116-L3118. Are you using the C++ headers from the NDK but a library that you built locally, or are you manually specifying the path to your C++ headers?

At the moment, we're only really using libunwind from the clang stdlib directory. So we don't really have the problem with headers. It will eventually be a problem when we get to use libc++, which we'll want at some point.

I decided to just fix the whole thing properly: D159292 and D159293.