diff --git a/tools/llvm-cxxfilt/CMakeLists.txt b/tools/llvm-cxxfilt/CMakeLists.txt index 4d0e5b01028..488064d08da 100644 --- a/tools/llvm-cxxfilt/CMakeLists.txt +++ b/tools/llvm-cxxfilt/CMakeLists.txt @@ -1,5 +1,6 @@ set(LLVM_LINK_COMPONENTS Demangle + Support ) add_llvm_tool(llvm-cxxfilt diff --git a/tools/llvm-cxxfilt/llvm-cxxfilt.cpp b/tools/llvm-cxxfilt/llvm-cxxfilt.cpp index d2c1ba37420..07b0e4e54ae 100644 --- a/tools/llvm-cxxfilt/llvm-cxxfilt.cpp +++ b/tools/llvm-cxxfilt/llvm-cxxfilt.cpp @@ -8,8 +8,8 @@ //===----------------------------------------------------------------------===// #include "llvm/Demangle/Demangle.h" +#include "llvm/Support/raw_ostream.h" -#include #include 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;