[PATCH] D25661: [Driver] Support obtaining active toolchain from gcc-config on Gentoo

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 17 10:06:26 PDT 2016


ABataev added inline comments.


================
Comment at: lib/Driver/ToolChains.cpp:1446-1463
+          // CURRENT=triple-version
+          if (Line.startswith("CURRENT=")) {
+            const std::pair<StringRef, StringRef> ActiveVersion =
+              Line.substr(8).rsplit('-');
+            // Note: Strictly speaking, we should be reading
+            // /etc/env.d/gcc/${CURRENT} now. However, the file doesn't
+            // contain anything new or especially useful to us.
----------------
mgorny wrote:
> ABataev wrote:
> > mgorny wrote:
> > > ABataev wrote:
> > > > mgorny wrote:
> > > > > ABataev wrote:
> > > > > > I think it is better to use `llvm::Triple` class here for parsing `ARCHITECTURE-VENDOR-OPERATING_SYSTEM-ENVIRONMENT` string rather than `StringRef::split()`
> > > > > This is not parsing the triple but detaching the version appended to it.
> > > > But still it is better to use some standard infrastructure rather than inventing a new one (with possible bugs, incompatibilities etc.) 
> > > I still don't understand what you want me to do. `llvm::Triple` does not support triple + version thingy that is the case here. I don't need to parse the triple, just split the version out of it.
> > Can you use Triple::getEnvironmentVersion()?
> No. This is not embedded in environment field but used as a separate component following it. Triple class doesn't cover it at all.
Ok


https://reviews.llvm.org/D25661





More information about the cfe-commits mailing list