[PATCH] Don't emit a blank line when running llvm-config --system-libs.

Richard Osborne richard at xmos.com
Fri Feb 28 03:54:39 PST 2014


Previously llvm-config --system-libs would print something like:

$ llvm-config --system-libs

-lz -ltinfo -lrt -ldl -lm

Now we don't emit blank line. Functionality is unchanged otherwise, in
particular llvm-config --libs --system-libs still emits the LLVM libraries
and the system libraries on different lines.

http://llvm-reviews.chandlerc.com/D2901

Files:
  tools/llvm-config/llvm-config.cpp

Index: tools/llvm-config/llvm-config.cpp
===================================================================
--- tools/llvm-config/llvm-config.cpp
+++ tools/llvm-config/llvm-config.cpp
@@ -345,27 +345,29 @@
     ComputeLibsForComponents(Components, RequiredLibs,
                              /*IncludeNonInstalled=*/IsInDevelopmentTree);
 
-    for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) {
-      StringRef Lib = RequiredLibs[i];
-      if (i)
-        OS << ' ';
-
-      if (PrintLibNames) {
-        OS << Lib;
-      } else if (PrintLibFiles) {
-        OS << ActiveLibDir << '/' << Lib;
-      } else if (PrintLibs) {
-        // If this is a typical library name, include it using -l.
-        if (Lib.startswith("lib") && Lib.endswith(".a")) {
-          OS << "-l" << Lib.slice(3, Lib.size()-2);
-          continue;
-        }
+    if (PrintLibs || PrintLibNames || PrintLibFiles) {
+      for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) {
+        StringRef Lib = RequiredLibs[i];
+        if (i)
+          OS << ' ';
 
-        // Otherwise, print the full path.
-        OS << ActiveLibDir << '/' << Lib;
+        if (PrintLibNames) {
+          OS << Lib;
+        } else if (PrintLibFiles) {
+          OS << ActiveLibDir << '/' << Lib;
+        } else if (PrintLibs) {
+          // If this is a typical library name, include it using -l.
+          if (Lib.startswith("lib") && Lib.endswith(".a")) {
+            OS << "-l" << Lib.slice(3, Lib.size()-2);
+            continue;
+          }
+
+          // Otherwise, print the full path.
+          OS << ActiveLibDir << '/' << Lib;
+        }
       }
+      OS << '\n';
     }
-    OS << '\n';
 
     // Print SYSTEM_LIBS after --libs.
     // FIXME: Each LLVM component may have its dependent system libs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2901.1.patch
Type: text/x-patch
Size: 1805 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140228/35b132de/attachment.bin>


More information about the llvm-commits mailing list