diff options
author | Rui Ueyama <ruiu@google.com> | 2018-04-13 20:57:57 +0000 |
---|---|---|
committer | Rui Ueyama <ruiu@google.com> | 2018-04-13 20:57:57 +0000 |
commit | 4595d0c0d70af0c141bad3f78a9091492913ecea (patch) | |
tree | 509929443a14d046037d04ca9b99368c0ef35971 /tools/clang-format | |
parent | b11c48d1760a6323e6513e9494b5b0ca587cf4d4 (diff) | |
download | clang-4595d0c0d70af0c141bad3f78a9091492913ecea.tar.gz |
Use InitLLVM in clang as well.
Differential Revision: https://reviews.llvm.org/D45634
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@330067 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/clang-format')
-rw-r--r-- | tools/clang-format/ClangFormat.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/tools/clang-format/ClangFormat.cpp b/tools/clang-format/ClangFormat.cpp index 2909cddf37..d870db21fa 100644 --- a/tools/clang-format/ClangFormat.cpp +++ b/tools/clang-format/ClangFormat.cpp @@ -22,8 +22,8 @@ #include "clang/Rewrite/Core/Rewriter.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/FileSystem.h" +#include "llvm/Support/InitLLVM.h" #include "llvm/Support/Process.h" -#include "llvm/Support/Signals.h" using namespace llvm; using clang::tooling::Replacements; @@ -338,21 +338,13 @@ static void PrintVersion(raw_ostream &OS) { } int main(int argc, const char **argv) { - llvm::sys::PrintStackTraceOnErrorSignal(argv[0]); - - SmallVector<const char *, 256> Args; - llvm::SpecificBumpPtrAllocator<char> ArgAllocator; - std::error_code EC = llvm::sys::Process::GetArgumentVector( - Args, llvm::makeArrayRef(argv, argc), ArgAllocator); - if (EC) { - llvm::errs() << "error: couldn't get arguments: " << EC.message() << '\n'; - } + llvm::InitLLVM X(argc, argv); cl::HideUnrelatedOptions(ClangFormatCategory); cl::SetVersionPrinter(PrintVersion); cl::ParseCommandLineOptions( - Args.size(), &Args[0], + argc, argv, "A tool to format C/C++/Java/JavaScript/Objective-C/Protobuf code.\n\n" "If no arguments are specified, it formats the code from standard input\n" "and writes the result to the standard output.\n" |