
Previously, some tools such as `clang` or `lld` which require strict order for certain command-line options, such as `clang -cc1` or `lld -flavor`, would not longer work on Windows, when these tools were linked as part of `llvm-driver`. This was caused by `InitLLVM` which was part of the `*_main()` function of these tools, which in turn calls `windows::GetCommandLineArguments`. That function completly replaces argc/argv by new UTF-8 contents, so any ajustements to argc/argv made by `llvm-driver` prior to calling these tools was reset. `InitLLVM` is now called by the `llvm-driver`. Any tool that participates in (or is part of) the `llvm-driver` doesn't call `InitLLVM` anymore.
19 lines
677 B
C++
19 lines
677 B
C++
//===-- driver-template.cpp -----------------------------------------------===//
|
|
//
|
|
// 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
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "llvm/Support/LLVMDriver.h"
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
#include "llvm/Support/InitLLVM.h"
|
|
|
|
int @TOOL_NAME@_main(int argc, char **, const llvm::ToolContext &);
|
|
|
|
int main(int argc, char **argv) {
|
|
llvm::InitLLVM X(argc, argv);
|
|
return @TOOL_NAME@_main(argc, argv, {argv[0], nullptr, false});
|
|
}
|