[PATCH] D31996: Make Gentoo GNU GCC Config override whitespace tolerant
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 12 16:15:00 PDT 2017
erichkeane created this revision.
The config-*triple* file handling isn't tolerant of leading/trailing whitespace, making it not terribly obvious when a single extraneous tab/space/etc will cause the override to be ignored. This patch simply trims the lines to ensure that it is tolerant of whitespace.
https://reviews.llvm.org/D31996
Files:
lib/Driver/ToolChains/Gnu.cpp
Index: lib/Driver/ToolChains/Gnu.cpp
===================================================================
--- lib/Driver/ToolChains/Gnu.cpp
+++ lib/Driver/ToolChains/Gnu.cpp
@@ -2173,10 +2173,11 @@
SmallVector<StringRef, 2> Lines;
File.get()->getBuffer().split(Lines, "\n");
for (StringRef Line : Lines) {
+ StringRef TrimLine = Line.trim();
// CURRENT=triple-version
- if (Line.consume_front("CURRENT=")) {
+ if (TrimLine.consume_front("CURRENT=")) {
const std::pair<StringRef, StringRef> ActiveVersion =
- Line.rsplit('-');
+ TrimLine.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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31996.95048.patch
Type: text/x-patch
Size: 801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170412/ef8d63ad/attachment.bin>
More information about the cfe-commits
mailing list