[PATCH] D22289: [PATCH 1/2] [Driver] Make Driver::DefaultTargetTriple private (NFCI)

Duncan P. N. Exon Smith via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 12 17:42:32 PDT 2016


If no one is using it, making it private is obvious goodness.  LGTM.

> On 2016-Jul-12, at 16:52, Vedant Kumar <vsk at apple.com> wrote:
> 
> vsk created this revision.
> vsk added a reviewer: dexonsmith.
> vsk added a subscriber: cfe-commits.
> 
> The clang driver knows about two kinds of target triples: default and
> effective. Default triples are needed to get ToolChains. ToolChains can
> then be used to determine more specific effective triples.
> 
> Inconsistent use of two different kinds of target triples leads to
> inconsistent error reporting and wasted computation (n.b that effective
> triples are not cached).
> 
> Ideally, default triples would only be used as a means of getting
> effective triples. Make Driver::DefaultTargetTriple private in the hopes
> of discouraging further use of default triples.
> 
> http://reviews.llvm.org/D22289
> 
> Files:
>  include/clang/Driver/Driver.h
>  lib/Driver/Driver.cpp
> 
> Index: lib/Driver/Driver.cpp
> ===================================================================
> --- lib/Driver/Driver.cpp
> +++ lib/Driver/Driver.cpp
> @@ -55,12 +55,12 @@
>       Mode(GCCMode), SaveTemps(SaveTempsNone), BitcodeEmbed(EmbedNone),
>       LTOMode(LTOK_None), ClangExecutable(ClangExecutable),
>       SysRoot(DEFAULT_SYSROOT), UseStdLib(true),
> -      DefaultTargetTriple(DefaultTargetTriple),
>       DriverTitle("clang LLVM compiler"), CCPrintOptionsFilename(nullptr),
>       CCPrintHeadersFilename(nullptr), CCLogDiagnosticsFilename(nullptr),
>       CCCPrintBindings(false), CCPrintHeaders(false), CCLogDiagnostics(false),
> -      CCGenDiagnostics(false), CCCGenericGCCName(""), CheckInputsExist(true),
> -      CCCUsePCH(true), SuppressMissingInputWarning(false) {
> +      CCGenDiagnostics(false), DefaultTargetTriple(DefaultTargetTriple),
> +      CCCGenericGCCName(""), CheckInputsExist(true), CCCUsePCH(true),
> +      SuppressMissingInputWarning(false) {
> 
>   // Provide a sane fallback if no VFS is specified.
>   if (!this->VFS)
> Index: include/clang/Driver/Driver.h
> ===================================================================
> --- include/clang/Driver/Driver.h
> +++ include/clang/Driver/Driver.h
> @@ -132,9 +132,6 @@
>   /// If the standard library is used
>   bool UseStdLib;
> 
> -  /// Default target triple.
> -  std::string DefaultTargetTriple;
> -
>   /// Driver title to use with help.
>   std::string DriverTitle;
> 
> @@ -183,6 +180,9 @@
>   unsigned CCGenDiagnostics : 1;
> 
> private:
> +  /// Default target triple.
> +  std::string DefaultTargetTriple;
> +
>   /// Name to use when invoking gcc/g++.
>   std::string CCCGenericGCCName;
> 
> 
> 
> <D22289.63756.patch>



More information about the cfe-commits mailing list