[cfe-commits] r89330 - in /cfe/trunk: include/clang/Driver/CC1Options.h include/clang/Driver/CC1Options.td include/clang/Driver/CMakeLists.txt include/clang/Driver/Makefile lib/Driver/CC1Options.cpp lib/Driver/CMakeLists.txt
Daniel Dunbar
daniel at zuster.org
Wed Nov 18 23:19:04 PST 2009
Author: ddunbar
Date: Thu Nov 19 01:19:04 2009
New Revision: 89330
URL: http://llvm.org/viewvc/llvm-project?rev=89330&view=rev
Log:
Sketch .td file and build system goop for OptTable based clang-cc options.
Added:
cfe/trunk/include/clang/Driver/CC1Options.h
cfe/trunk/include/clang/Driver/CC1Options.td
cfe/trunk/lib/Driver/CC1Options.cpp
Modified:
cfe/trunk/include/clang/Driver/CMakeLists.txt
cfe/trunk/include/clang/Driver/Makefile
cfe/trunk/lib/Driver/CMakeLists.txt
Added: cfe/trunk/include/clang/Driver/CC1Options.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.h?rev=89330&view=auto
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.h (added)
+++ cfe/trunk/include/clang/Driver/CC1Options.h Thu Nov 19 01:19:04 2009
@@ -0,0 +1,34 @@
+//===--- CC1Options.h - Clang CC1 Options Table -----------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef CLANG_DRIVER_CC1OPTIONS_H
+#define CLANG_DRIVER_CC1OPTIONS_H
+
+namespace clang {
+namespace driver {
+ class OptTable;
+
+namespace cc1options {
+ enum ID {
+ OPT_INVALID = 0, // This is not an option ID.
+ OPT_INPUT, // Reserved ID for input option.
+ OPT_UNKNOWN, // Reserved ID for unknown option.
+#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
+ HELPTEXT, METAVAR) OPT_##ID,
+#include "clang/Driver/CC1Options.inc"
+ LastOption
+#undef OPTION
+ };
+}
+
+ OptTable *createCC1OptTable();
+}
+}
+
+#endif
Added: cfe/trunk/include/clang/Driver/CC1Options.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=89330&view=auto
==============================================================================
--- cfe/trunk/include/clang/Driver/CC1Options.td (added)
+++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Nov 19 01:19:04 2009
@@ -0,0 +1,26 @@
+//===--- CC1Options.td - Options for clang -cc1 ---------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the options accepted by clang -cc1.
+//
+//===----------------------------------------------------------------------===//
+
+// Include the common option parsing interfaces.
+include "OptParser.td"
+
+// Target Options
+
+def target_abi : Separate<"-target-abi">,
+ HelpText<"Target a particular ABI type">;
+def target_cpu : Separate<"-mcpu">,
+ HelpText<"Target a specific cpu type (-mcpu=help for details)">;
+def target_features : Separate<"-target-feature">,
+ HelpText<"Target specific attributes">;
+def target_triple : Separate<"-triple">,
+ HelpText<"Specify target triple (e.g. i686-apple-darwin9)">;
Modified: cfe/trunk/include/clang/Driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CMakeLists.txt?rev=89330&r1=89329&r2=89330&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/CMakeLists.txt (original)
+++ cfe/trunk/include/clang/Driver/CMakeLists.txt Thu Nov 19 01:19:04 2009
@@ -3,3 +3,9 @@
-gen-opt-parser-defs)
add_custom_target(ClangDriverOptions
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Options.inc)
+
+set(LLVM_TARGET_DEFINITIONS CC1Options.td)
+tablegen(CC1Options.inc
+ -gen-opt-parser-defs)
+add_custom_target(ClangCC1Options
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/CC1Options.inc)
Modified: cfe/trunk/include/clang/Driver/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Makefile?rev=89330&r1=89329&r2=89330&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Makefile (original)
+++ cfe/trunk/include/clang/Driver/Makefile Thu Nov 19 01:19:04 2009
@@ -1,5 +1,5 @@
LEVEL = ../../../../..
-BUILT_SOURCES = Options.inc
+BUILT_SOURCES = Options.inc CC1Options.inc
TABLEGEN_INC_FILES_COMMON = 1
@@ -9,4 +9,8 @@
$(Echo) "Building Clang Driver Option tables with tblgen"
$(Verb) $(TableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<
+$(ObjDir)/CC1Options.inc.tmp : CC1Options.td OptParser.td $(ObjDir)/.dir
+ $(Echo) "Building Clang CC1 Option tables with tblgen"
+ $(Verb) $(TableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<
+
Added: cfe/trunk/lib/Driver/CC1Options.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CC1Options.cpp?rev=89330&view=auto
==============================================================================
--- cfe/trunk/lib/Driver/CC1Options.cpp (added)
+++ cfe/trunk/lib/Driver/CC1Options.cpp Thu Nov 19 01:19:04 2009
@@ -0,0 +1,43 @@
+//===--- CC1Options.cpp - Clang CC1 Options Table -----------------------*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Driver/CC1Options.h"
+#include "clang/Driver/OptTable.h"
+#include "clang/Driver/Option.h"
+
+using namespace clang::driver;
+using namespace clang::driver::options;
+using namespace clang::driver::cc1options;
+
+static OptTable::Info CC1InfoTable[] = {
+ // The InputOption info
+ { "<input>", 0, 0, Option::InputClass, DriverOption, 0, OPT_INVALID, OPT_INVALID },
+ // The UnknownOption info
+ { "<unknown>", 0, 0, Option::UnknownClass, 0, 0, OPT_INVALID, OPT_INVALID },
+
+#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
+ HELPTEXT, METAVAR) \
+ { NAME, HELPTEXT, METAVAR, Option::KIND##Class, FLAGS, PARAM, \
+ OPT_##GROUP, OPT_##ALIAS },
+#include "clang/Driver/CC1Options.inc"
+};
+
+namespace {
+
+class CC1OptTable : public OptTable {
+public:
+ CC1OptTable()
+ : OptTable(CC1InfoTable, sizeof(CC1InfoTable) / sizeof(CC1InfoTable[0])) {}
+};
+
+}
+
+OptTable *clang::driver::createCC1OptTable() {
+ return new CC1OptTable();
+}
Modified: cfe/trunk/lib/Driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=89330&r1=89329&r2=89330&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/CMakeLists.txt (original)
+++ cfe/trunk/lib/Driver/CMakeLists.txt Thu Nov 19 01:19:04 2009
@@ -4,6 +4,7 @@
Action.cpp
Arg.cpp
ArgList.cpp
+ CC1Options.cpp
Compilation.cpp
Driver.cpp
DriverOptions.cpp
More information about the cfe-commits
mailing list