[clang] Add support for sysroot-relative system header search paths (PR #82084)
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 17 09:17:33 PST 2024
================
@@ -3218,6 +3218,21 @@ static bool ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
bool IsIndexHeaderMap = false;
bool IsSysrootSpecified =
Args.hasArg(OPT__sysroot_EQ) || Args.hasArg(OPT_isysroot);
+
+ // Expand a leading `=` to the sysroot if one was passed (and it's not a
+ // framework flag).
+ auto ConvertHeaderPath = [IsSysrootSpecified,
+ &Opts](const llvm::opt::Arg *A,
+ bool IsFramework = false) -> std::string {
+ if (IsSysrootSpecified && !IsFramework && A->getValue()[0] == '=') {
----------------
compnerd wrote:
Might be nice to take `const llvm::opt::Arg &` instead. It also feels unsafe as we do not know if the argument has a value before you get it - you should do a `A->hasValue()` or assert it perhaps?
https://github.com/llvm/llvm-project/pull/82084
More information about the cfe-commits
mailing list