Fwd: r202683 - Introduce '-fmodules-user-build-path' which accepts the "canonical" path to a user workspace build.

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 21 12:03:44 PDT 2016


[Resend to new ML]

What is this option for? This seems, in effect, to provide a way to
use a distinct module cache. Why would someone use this rather than
specifying a module cache path?

On Mon, Mar 3, 2014 at 12:12 AM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:
> Author: akirtzidis
> Date: Mon Mar  3 02:12:05 2014
> New Revision: 202683
>
> URL: http://llvm.org/viewvc/llvm-project?rev=202683&view=rev
> Log:
> Introduce '-fmodules-user-build-path' which accepts the "canonical" path to a user workspace build.
>
> This is used to avoid conflicts with user modules with the same name from different workspaces.
>
> rdar://16042513
>
> Modified:
>     cfe/trunk/include/clang/Driver/Options.td
>     cfe/trunk/include/clang/Lex/HeaderSearchOptions.h
>     cfe/trunk/lib/Driver/Tools.cpp
>     cfe/trunk/lib/Frontend/CompilerInvocation.cpp
>     cfe/trunk/lib/Serialization/ASTReader.cpp
>     cfe/trunk/lib/Serialization/ASTWriter.cpp
>
> Modified: cfe/trunk/include/clang/Driver/Options.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=202683&r1=202682&r2=202683&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Driver/Options.td (original)
> +++ cfe/trunk/include/clang/Driver/Options.td Mon Mar  3 02:12:05 2014
> @@ -575,6 +575,9 @@ def fms_memptr_rep_EQ : Joined<["-"], "f
>  def fmodules_cache_path : Joined<["-"], "fmodules-cache-path=">, Group<i_Group>,
>    Flags<[DriverOption, CC1Option]>, MetaVarName<"<directory>">,
>    HelpText<"Specify the module cache path">;
> +def fmodules_user_build_path : Separate<["-"], "fmodules-user-build-path">, Group<i_Group>,
> +  Flags<[DriverOption, CC1Option]>, MetaVarName<"<directory>">,
> +  HelpText<"Specify the module user build path">;
>  def fmodules_prune_interval : Joined<["-"], "fmodules-prune-interval=">, Group<i_Group>,
>    Flags<[CC1Option]>, MetaVarName<"<seconds>">,
>    HelpText<"Specify the interval (in seconds) between attempts to prune the module cache">;
>
> Modified: cfe/trunk/include/clang/Lex/HeaderSearchOptions.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/HeaderSearchOptions.h?rev=202683&r1=202682&r2=202683&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Lex/HeaderSearchOptions.h (original)
> +++ cfe/trunk/include/clang/Lex/HeaderSearchOptions.h Mon Mar  3 02:12:05 2014
> @@ -89,6 +89,9 @@ public:
>    /// \brief The directory used for the module cache.
>    std::string ModuleCachePath;
>
> +  /// \brief The directory used for a user build.
> +  std::string ModuleUserBuildPath;
> +
>    /// \brief Whether we should disable the use of the hash string within the
>    /// module cache.
>    ///
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=202683&r1=202682&r2=202683&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Mon Mar  3 02:12:05 2014
> @@ -3366,6 +3366,13 @@ void Clang::ConstructJob(Compilation &C,
>      CmdArgs.push_back(Args.MakeArgString(DefaultModuleCache));
>    }
>
> +  if (Arg *A = Args.getLastArg(options::OPT_fmodules_user_build_path)) {
> +    A->claim();
> +    if (HaveModules) {
> +      A->render(Args, CmdArgs);
> +    }
> +  }
> +
>    // Pass through all -fmodules-ignore-macro arguments.
>    Args.AddAllArgs(CmdArgs, options::OPT_fmodules_ignore_macro);
>    Args.AddLastArg(CmdArgs, options::OPT_fmodules_prune_interval);
>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=202683&r1=202682&r2=202683&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Mon Mar  3 02:12:05 2014
> @@ -918,6 +918,7 @@ static void ParseHeaderSearchArgs(Header
>      Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
>    Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
>    Opts.ModuleCachePath = Args.getLastArgValue(OPT_fmodules_cache_path);
> +  Opts.ModuleUserBuildPath = Args.getLastArgValue(OPT_fmodules_user_build_path);
>    Opts.DisableModuleHash = Args.hasArg(OPT_fdisable_module_hash);
>    // -fmodules implies -fmodule-maps
>    Opts.ModuleMaps = Args.hasArg(OPT_fmodule_maps) || Args.hasArg(OPT_fmodules);
> @@ -1821,6 +1822,9 @@ std::string CompilerInvocation::getModul
>                        hsOpts.UseStandardCXXIncludes,
>                        hsOpts.UseLibcxx);
>
> +  // Extend the signature with the user build path.
> +  code = hash_combine(code, hsOpts.ModuleUserBuildPath);
> +
>    // Darwin-specific hack: if we have a sysroot, use the contents and
>    // modification time of
>    //   $sysroot/System/Library/CoreServices/SystemVersion.plist
>
> Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=202683&r1=202682&r2=202683&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTReader.cpp Mon Mar  3 02:12:05 2014
> @@ -4297,6 +4297,7 @@ bool ASTReader::ParseHeaderSearchOptions
>
>    HSOpts.ResourceDir = ReadString(Record, Idx);
>    HSOpts.ModuleCachePath = ReadString(Record, Idx);
> +  HSOpts.ModuleUserBuildPath = ReadString(Record, Idx);
>    HSOpts.DisableModuleHash = Record[Idx++];
>    HSOpts.UseBuiltinIncludes = Record[Idx++];
>    HSOpts.UseStandardSystemIncludes = Record[Idx++];
>
> Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=202683&r1=202682&r2=202683&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
> +++ cfe/trunk/lib/Serialization/ASTWriter.cpp Mon Mar  3 02:12:05 2014
> @@ -1161,6 +1161,7 @@ void ASTWriter::WriteControlBlock(Prepro
>
>    AddString(HSOpts.ResourceDir, Record);
>    AddString(HSOpts.ModuleCachePath, Record);
> +  AddString(HSOpts.ModuleUserBuildPath, Record);
>    Record.push_back(HSOpts.DisableModuleHash);
>    Record.push_back(HSOpts.UseBuiltinIncludes);
>    Record.push_back(HSOpts.UseStandardSystemIncludes);
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list