[llvm] r282523 - [llvm-cxxfilt] Use llvm::outs(). Simplify.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 27 11:50:30 PDT 2016


Author: davide
Date: Tue Sep 27 13:50:30 2016
New Revision: 282523

URL: http://llvm.org/viewvc/llvm-project?rev=282523&view=rev
Log:
[llvm-cxxfilt] Use llvm::outs(). Simplify.

This adds a dependency on Support/. As llvm-cxxfilt will grow
support for options this will be needed anyway.

Modified:
    llvm/trunk/tools/llvm-cxxfilt/CMakeLists.txt
    llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp

Modified: llvm/trunk/tools/llvm-cxxfilt/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cxxfilt/CMakeLists.txt?rev=282523&r1=282522&r2=282523&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cxxfilt/CMakeLists.txt (original)
+++ llvm/trunk/tools/llvm-cxxfilt/CMakeLists.txt Tue Sep 27 13:50:30 2016
@@ -1,5 +1,6 @@
 set(LLVM_LINK_COMPONENTS
   Demangle
+  Support
   )
 
 add_llvm_tool(llvm-cxxfilt

Modified: llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp?rev=282523&r1=282522&r2=282523&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp (original)
+++ llvm/trunk/tools/llvm-cxxfilt/llvm-cxxfilt.cpp Tue Sep 27 13:50:30 2016
@@ -8,8 +8,8 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Demangle/Demangle.h"
+#include "llvm/Support/raw_ostream.h"
 
-#include <stdio.h>
 #include <stdlib.h>
 
 using namespace llvm;
@@ -19,10 +19,7 @@ int main(int argc, char **argv) {
     const char *Mangled = argv[I];
     int Status;
     char *Demangled = itaniumDemangle(Mangled, nullptr, nullptr, &Status);
-    if (Demangled)
-      printf("%s\n", Demangled);
-    else
-      printf("%s\n", Mangled);
+    llvm::outs() << (Demangled ? Demangled : Mangled) << '\n';
     free(Demangled);
   }
   return 0;




More information about the llvm-commits mailing list