r328495 - [clang-format] Wildcard expansion on Windows.
Alexander Kornienko via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 26 06:54:17 PDT 2018
Author: alexfh
Date: Mon Mar 26 06:54:17 2018
New Revision: 328495
URL: http://llvm.org/viewvc/llvm-project?rev=328495&view=rev
Log:
[clang-format] Wildcard expansion on Windows.
Summary:
Add support for wildcard expansion in command line arguments on Windows.
See https://docs.microsoft.com/en-us/cpp/c-language/expanding-wildcard-arguments
Fixes https://bugs.llvm.org/show_bug.cgi?id=17217
Reviewers: klimek, djasper, rnk
Reviewed By: rnk
Subscribers: rnk, smeenai, zturner, alexfh, mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D44778
Modified:
cfe/trunk/tools/clang-format/ClangFormat.cpp
Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=328495&r1=328494&r2=328495&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)
+++ cfe/trunk/tools/clang-format/ClangFormat.cpp Mon Mar 26 06:54:17 2018
@@ -22,6 +22,7 @@
#include "clang/Rewrite/Core/Rewriter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
+#include "llvm/Support/Process.h"
#include "llvm/Support/Signals.h"
using namespace llvm;
@@ -339,11 +340,19 @@ 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';
+ }
+
cl::HideUnrelatedOptions(ClangFormatCategory);
cl::SetVersionPrinter(PrintVersion);
cl::ParseCommandLineOptions(
- argc, argv,
+ Args.size(), &Args[0],
"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"
More information about the cfe-commits
mailing list