[llvm] r301004 - Add empty shell of llvm-cvtres.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 21 10:30:30 PDT 2017
Author: zturner
Date: Fri Apr 21 12:30:29 2017
New Revision: 301004
URL: http://llvm.org/viewvc/llvm-project?rev=301004&view=rev
Log:
Add empty shell of llvm-cvtres.
This marks the beginning of an effort to port remaining
MSVC toolchain miscellaneous utilities to all platforms.
Currently clang-cl shells out to certain additional tools
such as the IDL compiler, resource compiler, and a few
other tools, but as these tools are Windows-only it
limits the ability of clang to target Windows on other
platforms. having a full suite of these tools directly
in LLVM should eliminate this constraint.
The current implementation provides no actual functionality,
it is just an empty skeleton executable for the purposes
of making incremental changes.
Differential Revision: https://reviews.llvm.org/D32095
Patch by Eric Beckmann (ecbeckmann at google.com)
Added:
llvm/trunk/test/tools/llvm-cvtres/
llvm/trunk/test/tools/llvm-cvtres/basic.test
llvm/trunk/tools/llvm-cvtres/
llvm/trunk/tools/llvm-cvtres/CMakeLists.txt
llvm/trunk/tools/llvm-cvtres/LLVMBuild.txt
llvm/trunk/tools/llvm-cvtres/Opts.td
llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
llvm/trunk/tools/llvm-cvtres/llvm-cvtres.h
Added: llvm/trunk/test/tools/llvm-cvtres/basic.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cvtres/basic.test?rev=301004&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-cvtres/basic.test (added)
+++ llvm/trunk/test/tools/llvm-cvtres/basic.test Fri Apr 21 12:30:29 2017
@@ -0,0 +1,4 @@
+; RUN: llvm-cvtres /h > %t
+; RUN: FileCheck -input-file=%t %s -check-prefix=HELP_TEST
+
+; HELP_TEST: OVERVIEW: Resource Converter
Added: llvm/trunk/tools/llvm-cvtres/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cvtres/CMakeLists.txt?rev=301004&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-cvtres/CMakeLists.txt (added)
+++ llvm/trunk/tools/llvm-cvtres/CMakeLists.txt Fri Apr 21 12:30:29 2017
@@ -0,0 +1,13 @@
+set(LLVM_LINK_COMPONENTS
+ Option
+ Support
+ )
+
+set(LLVM_TARGET_DEFINITIONS Opts.td)
+
+tablegen(LLVM Opts.inc -gen-opt-parser-defs)
+add_public_tablegen_target(CvtResTableGen)
+
+add_llvm_tool(llvm-cvtres
+ llvm-cvtres.cpp
+ )
Added: llvm/trunk/tools/llvm-cvtres/LLVMBuild.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cvtres/LLVMBuild.txt?rev=301004&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-cvtres/LLVMBuild.txt (added)
+++ llvm/trunk/tools/llvm-cvtres/LLVMBuild.txt Fri Apr 21 12:30:29 2017
@@ -0,0 +1,22 @@
+;===- ./tools/llvm-cvtres/LLVMBuild.txt ------------------------*- Conf -*--===;
+;
+; The LLVM Compiler Infrastructure
+;
+; This file is distributed under the University of Illinois Open Source
+; License. See LICENSE.TXT for details.
+;
+;===------------------------------------------------------------------------===;
+;
+; This is an LLVMBuild description file for the components in this subdirectory.
+;
+; For more information on the LLVMBuild system, please see:
+;
+; http://llvm.org/docs/LLVMBuild.html
+;
+;===------------------------------------------------------------------------===;
+
+[component_0]
+type = Tool
+name = llvm-cvtres
+parent = Tools
+required_libraries = Option Support
Added: llvm/trunk/tools/llvm-cvtres/Opts.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cvtres/Opts.td?rev=301004&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-cvtres/Opts.td (added)
+++ llvm/trunk/tools/llvm-cvtres/Opts.td Fri Apr 21 12:30:29 2017
@@ -0,0 +1,11 @@
+include "llvm/Option/OptParser.td"
+
+def DEFINE : Joined<["/"], "DEFINE:">, HelpText<"">, MetaVarName<"symbol">;
+def FOLDDUPS : Flag<["/"], "FOLDDUPS:">, HelpText<"">;
+def MACHINE : Joined<["/"], "MACHINE:">, HelpText<"">, MetaVarName<"{ARM|EBC|IA64|X64|X86}">;
+def NOLOGO : Flag<["/"], "NOLOGO">, HelpText<"">;
+def OUT : Joined<["/"], "OUT:">, HelpText<"">, MetaVarName<"filename">;
+def READONLY : Flag<["/"], "READONLY">, HelpText<"">;
+def VERBOSE : Flag<["/"], "VERBOSE">, HelpText<"">;
+def HELP : Flag<["/"], "HELP">;
+def H : Flag<["/"], "H">, Alias<HELP>;
Added: llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp?rev=301004&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp (added)
+++ llvm/trunk/tools/llvm-cvtres/llvm-cvtres.cpp Fri Apr 21 12:30:29 2017
@@ -0,0 +1,86 @@
+//===- llvm-cvtres.cpp - Serialize .res files into .obj ---------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Serialize .res files into .obj files. This is intended to be a
+// platform-independent port of Microsoft's cvtres.exe.
+//
+//===----------------------------------------------------------------------===//
+
+#include "llvm-cvtres.h"
+
+#include "llvm/Option/Arg.h"
+#include "llvm/Option/ArgList.h"
+#include "llvm/Option/Option.h"
+#include "llvm/Support/Error.h"
+#include "llvm/Support/ManagedStatic.h"
+#include "llvm/Support/PrettyStackTrace.h"
+#include "llvm/Support/Process.h"
+#include "llvm/Support/Signals.h"
+#include "llvm/Support/raw_ostream.h"
+
+using namespace llvm;
+
+namespace {
+
+enum ID {
+ OPT_INVALID = 0, // This is not an option ID.
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
+ HELPTEXT, METAVAR) \
+ OPT_##ID,
+#include "Opts.inc"
+#undef OPTION
+};
+
+#define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;
+#include "Opts.inc"
+#undef PREFIX
+
+static const opt::OptTable::Info InfoTable[] = {
+#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
+ HELPTEXT, METAVAR) \
+ { \
+ PREFIX, NAME, HELPTEXT, \
+ METAVAR, OPT_##ID, opt::Option::KIND##Class, \
+ PARAM, FLAGS, OPT_##GROUP, \
+ OPT_##ALIAS, ALIASARGS},
+#include "Opts.inc"
+#undef OPTION
+};
+
+class CvtResOptTable : public opt::OptTable {
+public:
+ CvtResOptTable() : OptTable(InfoTable, true) {}
+};
+
+static ExitOnError ExitOnErr;
+}
+
+int main(int argc_, const char *argv_[]) {
+ sys::PrintStackTraceOnErrorSignal(argv_[0]);
+ PrettyStackTraceProgram X(argc_, argv_);
+
+ ExitOnErr.setBanner("llvm-cvtres: ");
+
+ SmallVector<const char *, 256> argv;
+ SpecificBumpPtrAllocator<char> ArgAllocator;
+ ExitOnErr(errorCodeToError(sys::Process::GetArgumentVector(
+ argv, makeArrayRef(argv_, argc_), ArgAllocator)));
+
+ llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
+
+ CvtResOptTable T;
+ unsigned MAI, MAC;
+ ArrayRef<const char *> ArgsArr = makeArrayRef(argv_, argc_);
+ opt::InputArgList InputArgs = T.ParseArgs(ArgsArr, MAI, MAC);
+
+ if (InputArgs.hasArg(OPT_HELP))
+ T.PrintHelp(outs(), "cvtres", "Resource Converter", false);
+
+ return 0;
+}
Added: llvm/trunk/tools/llvm-cvtres/llvm-cvtres.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cvtres/llvm-cvtres.h?rev=301004&view=auto
==============================================================================
--- llvm/trunk/tools/llvm-cvtres/llvm-cvtres.h (added)
+++ llvm/trunk/tools/llvm-cvtres/llvm-cvtres.h Fri Apr 21 12:30:29 2017
@@ -0,0 +1,13 @@
+//===- llvm-cvtres.h ------------------------------------------ *- C++ --*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVMCVTRES_LLVMCVTRES_H
+#define LLVM_TOOLS_LLVMCVTRES_LLVMCVTRES_H
+
+#endif
More information about the llvm-commits
mailing list