r201205 - Add Multilib selection machinery

Gao, Yunzhong yunzhong_gao at playstation.sony.com
Tue Feb 18 19:52:37 PST 2014


Hi Jon,

Thanks for your quick response! I updated the patch below:

Index: lib/Driver/ToolChains.cpp
===================================================================
--- lib/Driver/ToolChains.cpp	(revision 201628)
+++ lib/Driver/ToolChains.cpp	(working copy)
@@ -1263,12 +1263,16 @@
        I != E; ++I)
     OS << "Found candidate GCC installation: " << *I << "\n";
 
-  OS << "Selected GCC installation: " << GCCInstallPath << "\n";
+  if (!GCCInstallPath.empty())
+    OS << "Selected GCC installation: " << GCCInstallPath << "\n";
+
   for (MultilibSet::const_iterator I = Multilibs.begin(), E = Multilibs.end();
        I != E; ++I) {
     OS << "Candidate multiilb: " << *I << "\n";
   }
-  OS << "Selected multilib: " << SelectedMultilib << "\n";
+
+  if (Multilibs.size() != 0 || !SelectedMultilib.isDefault())
+    OS << "Selected multilib: " << SelectedMultilib << "\n";
 }
 
 bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
Index: include/clang/Driver/Multilib.h
===================================================================
--- include/clang/Driver/Multilib.h	(revision 201628)
+++ include/clang/Driver/Multilib.h	(working copy)
@@ -82,6 +82,10 @@
   /// Check whether any of the 'against' flags contradict the 'for' flags.
   bool isValid() const;
 
+  /// Check whether the default is selected
+  bool isDefault() const
+  { return GCCSuffix.empty() && OSSuffix.empty() && IncludeSuffix.empty(); }
+
   bool operator==(const Multilib &Other) const;
 };
 


________________________________________
From: Jonathan Roelofs [jonathan at codesourcery.com]
Sent: Tuesday, February 18, 2014 6:10 PM
To: Gao, Yunzhong; cfe-commits at cs.uiuc.edu
Subject: Re: r201205 - Add Multilib selection machinery

Hi Yunzhong,

Sounds good to me, although I think we ought to still print out "Selected
multilib: .;" when the default is selected but isn't the only one found.

Jon

On 2/18/14, 1:36 PM, Gao, Yunzhong wrote:
> Hi Jonathan,
>
> I wonder whether it makes more sense to only print the selected multilib when something is actually found on the host.
> I propose the following patch.
>
> Index: include/clang/Driver/Multilib.h
> ===================================================================
> --- include/clang/Driver/Multilib.h   (revision 201600)
> +++ include/clang/Driver/Multilib.h   (working copy)
> @@ -82,6 +82,8 @@
>     /// Check whether any of the 'against' flags contradict the 'for' flags.
>     bool isValid() const;
>
> +  bool empty() const { return GCCSuffix.empty() && Flags.size() == 0; }
Perhaps this would better capture what you mean by 'empty()'?
bool isDefault() const { return GCCSuffix.empty() && OSSuffix.empty() &&
IncludeSuffix.empty(); }
> +
>     bool operator==(const Multilib &Other) const;
>   };
>
> Index: lib/Driver/ToolChains.cpp
> ===================================================================
> --- lib/Driver/ToolChains.cpp (revision 201600)
> +++ lib/Driver/ToolChains.cpp (working copy)
> @@ -1263,12 +1263,16 @@
>          I != E; ++I)
>       OS << "Found candidate GCC installation: " << *I << "\n";
>
> -  OS << "Selected GCC installation: " << GCCInstallPath << "\n";
> +  if (!GCCInstallPath.empty())
> +    OS << "Selected GCC installation: " << GCCInstallPath << "\n";
> +
>     for (MultilibSet::const_iterator I = Multilibs.begin(), E = Multilibs.end();
>          I != E; ++I) {
>       OS << "Candidate multiilb: " << *I << "\n";
>     }
> -  OS << "Selected multilib: " << SelectedMultilib << "\n";
> +
> +  if (!SelectedMultilib.empty())
> +    OS << "Selected multilib: " << SelectedMultilib << "\n";
>   }
>
>   bool Generic_GCC::GCCInstallationDetector::getBiarchSibling(Multilib &M) const {
>

--
Jon Roelofs
jonathan at codesourcery.com
CodeSourcery / Mentor Embedded






More information about the cfe-commits mailing list