diff tools/llvm-config/llvm-config.cpp @ 148:63bd29f05246

merged
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Wed, 14 Aug 2019 19:46:37 +0900
parents c2174574ed3a
children
line wrap: on
line diff
--- a/tools/llvm-config/llvm-config.cpp	Sun Dec 23 19:23:36 2018 +0900
+++ b/tools/llvm-config/llvm-config.cpp	Wed Aug 14 19:46:37 2019 +0900
@@ -1,9 +1,8 @@
 //===-- llvm-config.cpp - LLVM project configuration utility --------------===//
 //
-//                     The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
 //
 //===----------------------------------------------------------------------===//
 //
@@ -17,15 +16,16 @@
 //
 //===----------------------------------------------------------------------===//
 
+#include "llvm/Config/llvm-config.h"
 #include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Triple.h"
 #include "llvm/ADT/Twine.h"
 #include "llvm/Config/config.h"
-#include "llvm/Config/llvm-config.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
+#include "llvm/Support/WithColor.h"
 #include "llvm/Support/raw_ostream.h"
 #include <cstdlib>
 #include <set>
@@ -62,7 +62,7 @@
   LinkModeStatic = 2,
 };
 
-/// \brief Traverse a single component adding to the topological ordering in
+/// Traverse a single component adding to the topological ordering in
 /// \arg RequiredLibs.
 ///
 /// \param Name - The component to traverse.
@@ -129,7 +129,7 @@
   }
 }
 
-/// \brief Compute the list of required libraries for a given list of
+/// Compute the list of required libraries for a given list of
 /// components, in an order suitable for passing to a linker (that is, libraries
 /// appear prior to their dependencies).
 ///
@@ -223,7 +223,7 @@
   exit(1);
 }
 
-/// \brief Compute the path to the main executable.
+/// Compute the path to the main executable.
 std::string GetExecutablePath(const char *Argv0) {
   // This just needs to be some symbol in the binary; C++ doesn't
   // allow taking the address of ::main however.
@@ -231,7 +231,7 @@
   return llvm::sys::fs::getMainExecutable(Argv0, P);
 }
 
-/// \brief Expand the semi-colon delimited LLVM_DYLIB_COMPONENTS into
+/// Expand the semi-colon delimited LLVM_DYLIB_COMPONENTS into
 /// the full list of components.
 std::vector<std::string> GetAllDyLibComponents(const bool IsInDevelopmentTree,
                                                const bool GetComponentNames,
@@ -522,7 +522,7 @@
             if (DyLibExists && !sys::fs::exists(path)) {
               Components =
                   GetAllDyLibComponents(IsInDevelopmentTree, true, DirSep);
-              std::sort(Components.begin(), Components.end());
+              llvm::sort(Components);
               break;
             }
           }
@@ -579,7 +579,7 @@
     usage();
 
   if (LinkMode == LinkModeShared && !DyLibExists && !BuiltSharedLibs) {
-    errs() << "llvm-config: error: " << DyLibName << " is missing\n";
+    WithColor::error(errs(), "llvm-config") << DyLibName << " is missing\n";
     return 1;
   }
 
@@ -612,19 +612,19 @@
           break;
         // Using component shared libraries.
         for (auto &Lib : MissingLibs)
-          errs() << "llvm-config: error: missing: " << Lib << "\n";
+          WithColor::error(errs(), "llvm-config") << "missing: " << Lib << "\n";
         return 1;
       case LinkModeAuto:
         if (DyLibExists) {
           LinkMode = LinkModeShared;
           break;
         }
-        errs()
-            << "llvm-config: error: component libraries and shared library\n\n";
+        WithColor::error(errs(), "llvm-config")
+            << "component libraries and shared library\n\n";
         LLVM_FALLTHROUGH;
       case LinkModeStatic:
         for (auto &Lib : MissingLibs)
-          errs() << "llvm-config: error: missing: " << Lib << "\n";
+          WithColor::error(errs(), "llvm-config") << "missing: " << Lib << "\n";
         return 1;
       }
     } else if (LinkMode == LinkModeAuto) {
@@ -707,7 +707,8 @@
       OS << (LinkMode == LinkModeStatic ? LLVM_SYSTEM_LIBS : "") << '\n';
     }
   } else if (!Components.empty()) {
-    errs() << "llvm-config: error: components given, but unused\n\n";
+    WithColor::error(errs(), "llvm-config")
+        << "components given, but unused\n\n";
     usage();
   }