From: Alex Lorenz Date: Mon, 13 Mar 2017 11:17:41 +0000 (+0000) Subject: Add -iframeworkwithsysroot compiler option X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=93d1a846ccd38df7110e85d4c18f80e8fcc72e3b;p=clang Add -iframeworkwithsysroot compiler option This commit adds support for a new -iframeworkwithsysroot compiler option which allows the user to specify a framework path that can be prefixed with the sysroot. This option is similar to the -iwithsysroot option that exists to supplement -isystem. rdar://21316352 Differential Revision: https://reviews.llvm.org/D30183 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@297614 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 9dd80c0918..7952b33fd5 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -1524,6 +1524,11 @@ def idirafter : JoinedOrSeparate<["-"], "idirafter">, Group, Flag HelpText<"Add directory to AFTER include search path">; def iframework : JoinedOrSeparate<["-"], "iframework">, Group, Flags<[CC1Option]>, HelpText<"Add directory to SYSTEM framework search path">; +def iframeworkwithsysroot : JoinedOrSeparate<["-"], "iframeworkwithsysroot">, + Group, + HelpText<"Add directory to SYSTEM framework search path, " + "absolute paths are relative to -isysroot">, + MetaVarName<"">, Flags<[CC1Option]>; def imacros : JoinedOrSeparate<["-", "--"], "imacros">, Group, Flags<[CC1Option]>, HelpText<"Include macros from file before parsing">, MetaVarName<"">; def image__base : Separate<["-"], "image_base">; diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 4d828f5805..598af20864 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -1507,6 +1507,9 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) { !A->getOption().matches(OPT_iwithsysroot)); for (const Arg *A : Args.filtered(OPT_iframework)) Opts.AddPath(A->getValue(), frontend::System, true, true); + for (const Arg *A : Args.filtered(OPT_iframeworkwithsysroot)) + Opts.AddPath(A->getValue(), frontend::System, /*IsFramework=*/true, + /*IgnoreSysRoot=*/false); // Add the paths for the various language specific isystem flags. for (const Arg *A : Args.filtered(OPT_c_isystem)) diff --git a/test/Frontend/iframework.c b/test/Frontend/iframework.c index 6f801f2437..2354553fa0 100644 --- a/test/Frontend/iframework.c +++ b/test/Frontend/iframework.c @@ -1,4 +1,5 @@ // RUN: %clang -fsyntax-only -iframework %S/Inputs %s -Xclang -verify +// RUN: %clang -fsyntax-only -isysroot %S -iframeworkwithsysroot /Inputs %s -Xclang -verify // expected-no-diagnostics #include