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

Vedant Kumar via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 12 16:52:25 PDT 2016


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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22289.63756.patch
Type: text/x-patch
Size: 1638 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160712/004bec6a/attachment.bin>


More information about the cfe-commits mailing list