summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMikhail Glushenkov <foldr@codedgers.com>2009-01-16 07:02:28 +0000
committerMikhail Glushenkov <foldr@codedgers.com>2009-01-16 07:02:28 +0000
commit2388a588bdf32610e18a66c0c6ef248087fd1cdc (patch)
treefcba18b7e9983bc8ec7e0fa707cb32e6d1f88aed /include
parent0b9d9970f0c2ffa7faec8f999eba0e0867d74ef5 (diff)
downloadllvm-2388a588bdf32610e18a66c0c6ef248087fd1cdc.tar.gz
llvm-2388a588bdf32610e18a66c0c6ef248087fd1cdc.tar.bz2
llvm-2388a588bdf32610e18a66c0c6ef248087fd1cdc.tar.xz
Registry.h should not depend on CommandLine.h.
Split Support/Registry.h into two files so that we have less to recompile every time CommandLine.h is changed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62312 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Support/Registry.h30
-rw-r--r--include/llvm/Support/RegistryParser.h55
-rw-r--r--include/llvm/Target/TargetMachineRegistry.h1
3 files changed, 57 insertions, 29 deletions
diff --git a/include/llvm/Support/Registry.h b/include/llvm/Support/Registry.h
index 5a7d7fa65e..454679bda8 100644
--- a/include/llvm/Support/Registry.h
+++ b/include/llvm/Support/Registry.h
@@ -14,8 +14,6 @@
#ifndef LLVM_SUPPORT_REGISTRY_H
#define LLVM_SUPPORT_REGISTRY_H
-#include "llvm/Support/CommandLine.h"
-
namespace llvm {
/// A simple registry entry which provides only a name, description, and
/// no-argument constructor.
@@ -204,33 +202,7 @@ namespace llvm {
: Entry(Name, Desc, CtorFn), Node(Entry) {}
};
-
- /// A command-line parser for a registry. Use like such:
- ///
- /// static cl::opt<Registry<Collector>::entry, false,
- /// Registry<Collector>::Parser>
- /// GCOpt("gc", cl::desc("Garbage collector to use."),
- /// cl::value_desc());
- ///
- /// To make use of the value:
- ///
- /// Collector *TheCollector = GCOpt->instantiate();
- ///
- class Parser : public cl::parser<const typename U::entry*>, public listener{
- typedef U traits;
- typedef typename U::entry entry;
-
- protected:
- void registered(const entry &E) {
- addLiteralOption(traits::nameof(E), &E, traits::descof(E));
- }
-
- public:
- void initialize(cl::Option &O) {
- listener::init();
- cl::parser<const typename U::entry*>::initialize(O);
- }
- };
+ /// Registry::Parser now lives in llvm/Support/RegistryParser.h.
};
diff --git a/include/llvm/Support/RegistryParser.h b/include/llvm/Support/RegistryParser.h
new file mode 100644
index 0000000000..2cc578370f
--- /dev/null
+++ b/include/llvm/Support/RegistryParser.h
@@ -0,0 +1,55 @@
+//=== RegistryParser.h - Linker-supported plugin registries -----*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Defines a command-line parser for a registry.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_REGISTRY_PARSER_H
+#define LLVM_SUPPORT_REGISTRY_PARSER_H
+
+#include "llvm/Support/CommandLine.h"
+#include "llvm/Support/Registry.h"
+
+namespace llvm {
+
+ /// A command-line parser for a registry. Use like such:
+ ///
+ /// static cl::opt<Registry<Collector>::entry, false,
+ /// RegistryParser<Collector> >
+ /// GCOpt("gc", cl::desc("Garbage collector to use."),
+ /// cl::value_desc());
+ ///
+ /// To make use of the value:
+ ///
+ /// Collector *TheCollector = GCOpt->instantiate();
+ ///
+ template <typename T, typename U = RegistryTraits<T> >
+ class RegistryParser :
+ public cl::parser<const typename U::entry*>,
+ public Registry<T, U>::listener {
+ typedef U traits;
+ typedef typename U::entry entry;
+ typedef typename Registry<T, U>::listener listener;
+
+ protected:
+ void registered(const entry &E) {
+ addLiteralOption(traits::nameof(E), &E, traits::descof(E));
+ }
+
+ public:
+ void initialize(cl::Option &O) {
+ listener::init();
+ cl::parser<const typename U::entry*>::initialize(O);
+ }
+ };
+
+}
+
+#endif // LLVM_SUPPORT_REGISTRY_PARSER_H
diff --git a/include/llvm/Target/TargetMachineRegistry.h b/include/llvm/Target/TargetMachineRegistry.h
index d14308547e..b7ea448b20 100644
--- a/include/llvm/Target/TargetMachineRegistry.h
+++ b/include/llvm/Target/TargetMachineRegistry.h
@@ -17,6 +17,7 @@
#ifndef LLVM_TARGET_TARGETMACHINEREGISTRY_H
#define LLVM_TARGET_TARGETMACHINEREGISTRY_H
+#include "llvm/Module.h"
#include "llvm/Support/Registry.h"
namespace llvm {