Skip to content

Commit 7bc65d0

Browse files
author
Richard Osborne
committed
Don't emit a blank line when running llvm-config --system-libs.
Summary: 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. Reviewers: chapuni Reviewed By: chapuni CC: llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D2901 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@202719 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent fc210ac commit 7bc65d0

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

tools/llvm-config/llvm-config.cpp

+20-18
Original file line numberDiff line numberDiff line change
@@ -345,27 +345,29 @@ int main(int argc, char **argv) {
345345
ComputeLibsForComponents(Components, RequiredLibs,
346346
/*IncludeNonInstalled=*/IsInDevelopmentTree);
347347

348-
for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) {
349-
StringRef Lib = RequiredLibs[i];
350-
if (i)
351-
OS << ' ';
352-
353-
if (PrintLibNames) {
354-
OS << Lib;
355-
} else if (PrintLibFiles) {
356-
OS << ActiveLibDir << '/' << Lib;
357-
} else if (PrintLibs) {
358-
// If this is a typical library name, include it using -l.
359-
if (Lib.startswith("lib") && Lib.endswith(".a")) {
360-
OS << "-l" << Lib.slice(3, Lib.size()-2);
361-
continue;
362-
}
348+
if (PrintLibs || PrintLibNames || PrintLibFiles) {
349+
for (unsigned i = 0, e = RequiredLibs.size(); i != e; ++i) {
350+
StringRef Lib = RequiredLibs[i];
351+
if (i)
352+
OS << ' ';
363353

364-
// Otherwise, print the full path.
365-
OS << ActiveLibDir << '/' << Lib;
354+
if (PrintLibNames) {
355+
OS << Lib;
356+
} else if (PrintLibFiles) {
357+
OS << ActiveLibDir << '/' << Lib;
358+
} else if (PrintLibs) {
359+
// If this is a typical library name, include it using -l.
360+
if (Lib.startswith("lib") && Lib.endswith(".a")) {
361+
OS << "-l" << Lib.slice(3, Lib.size()-2);
362+
continue;
363+
}
364+
365+
// Otherwise, print the full path.
366+
OS << ActiveLibDir << '/' << Lib;
367+
}
366368
}
369+
OS << '\n';
367370
}
368-
OS << '\n';
369371

370372
// Print SYSTEM_LIBS after --libs.
371373
// FIXME: Each LLVM component may have its dependent system libs.

0 commit comments

Comments
 (0)