diff options
author | Reid Kleckner <reid@kleckner.net> | 2013-06-14 17:17:23 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2013-06-14 17:17:23 +0000 |
commit | 898229ab4b81ef14429ea79cdd1c4aa3b479ca5a (patch) | |
tree | 6ddef3925e73581ddf64d8139634a006fd75c8fc /clang/tools | |
parent | 3e3e040574b764aacd76828a7df6f9b3ad0eebd2 (diff) | |
download | bcm5719-llvm-898229ab4b81ef14429ea79cdd1c4aa3b479ca5a.tar.gz bcm5719-llvm-898229ab4b81ef14429ea79cdd1c4aa3b479ca5a.zip |
[Driver] Refactor clang driver to use LLVM's Option library
The big changes are:
- Deleting Driver/(Arg|Opt)*
- Rewriting includes to llvm/Option/ and re-sorting
- 'using namespace llvm::opt' in clang::driver
- Fixing the autoconf build by adding option everywhere
As discussed in the review, this change includes using directives in
header files. I'll make follow up changes to remove those in favor of
name specifiers.
Reviewers: espindola
Differential Revision: http://llvm-reviews.chandlerc.com/D975
llvm-svn: 183989
Diffstat (limited to 'clang/tools')
-rw-r--r-- | clang/tools/arcmt-test/Makefile | 2 | ||||
-rw-r--r-- | clang/tools/c-arcmt-test/Makefile | 2 | ||||
-rw-r--r-- | clang/tools/c-index-test/Makefile | 2 | ||||
-rw-r--r-- | clang/tools/clang-check/ClangCheck.cpp | 3 | ||||
-rw-r--r-- | clang/tools/clang-check/Makefile | 2 | ||||
-rw-r--r-- | clang/tools/clang-format/Makefile | 2 | ||||
-rw-r--r-- | clang/tools/diagtool/Makefile | 2 | ||||
-rw-r--r-- | clang/tools/driver/Makefile | 2 | ||||
-rw-r--r-- | clang/tools/driver/cc1_main.cpp | 7 | ||||
-rw-r--r-- | clang/tools/driver/cc1as_main.cpp | 14 | ||||
-rw-r--r-- | clang/tools/driver/driver.cpp | 7 | ||||
-rw-r--r-- | clang/tools/libclang/Makefile | 2 |
12 files changed, 26 insertions, 21 deletions
diff --git a/clang/tools/arcmt-test/Makefile b/clang/tools/arcmt-test/Makefile index 52898ceab7e..4b9b8db0a0b 100644 --- a/clang/tools/arcmt-test/Makefile +++ b/clang/tools/arcmt-test/Makefile @@ -17,7 +17,7 @@ TOOL_NO_EXPORTS = 1 NO_INSTALL = 1 include $(CLANG_LEVEL)/../../Makefile.config -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option USEDLIBS = clangARCMigrate.a clangRewriteCore.a \ clangFrontend.a clangDriver.a clangSerialization.a clangParse.a \ clangSema.a clangEdit.a clangAnalysis.a clangAST.a clangLex.a \ diff --git a/clang/tools/c-arcmt-test/Makefile b/clang/tools/c-arcmt-test/Makefile index 02b8ab7bd68..417d753e505 100644 --- a/clang/tools/c-arcmt-test/Makefile +++ b/clang/tools/c-arcmt-test/Makefile @@ -21,7 +21,7 @@ NO_INSTALL = 1 # LINK_COMPONENTS before including Makefile.rules include $(CLANG_LEVEL)/../../Makefile.config -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option # Note that 'USEDLIBS' must include all of the core clang libraries # when -static is given to linker on cygming. diff --git a/clang/tools/c-index-test/Makefile b/clang/tools/c-index-test/Makefile index 7723115263e..4df90e62abe 100644 --- a/clang/tools/c-index-test/Makefile +++ b/clang/tools/c-index-test/Makefile @@ -22,7 +22,7 @@ TOOL_NO_EXPORTS = 1 # LINK_COMPONENTS before including Makefile.rules include $(CLANG_LEVEL)/../../Makefile.config -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option # Note that 'USEDLIBS' must include all of the core clang libraries # when -static is given to linker on cygming. diff --git a/clang/tools/clang-check/ClangCheck.cpp b/clang/tools/clang-check/ClangCheck.cpp index bc01874bcf6..701db52334c 100644 --- a/clang/tools/clang-check/ClangCheck.cpp +++ b/clang/tools/clang-check/ClangCheck.cpp @@ -17,7 +17,6 @@ //===----------------------------------------------------------------------===// #include "clang/AST/ASTConsumer.h" -#include "clang/Driver/OptTable.h" #include "clang/Driver/Options.h" #include "clang/Frontend/ASTConsumers.h" #include "clang/Frontend/CompilerInstance.h" @@ -29,10 +28,12 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/Path.h" #include "llvm/Support/Signals.h" +#include "llvm/Option/OptTable.h" using namespace clang::driver; using namespace clang::tooling; using namespace llvm; +using namespace llvm::opt; static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage); static cl::extrahelp MoreHelp( diff --git a/clang/tools/clang-check/Makefile b/clang/tools/clang-check/Makefile index a9ed1853a29..cf088d26893 100644 --- a/clang/tools/clang-check/Makefile +++ b/clang/tools/clang-check/Makefile @@ -15,7 +15,7 @@ TOOLNAME = clang-check TOOL_NO_EXPORTS = 1 include $(CLANG_LEVEL)/../../Makefile.config -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option USEDLIBS = clangFrontend.a clangSerialization.a clangDriver.a \ clangTooling.a clangParse.a clangSema.a \ clangStaticAnalyzerFrontend.a clangStaticAnalyzerCheckers.a \ diff --git a/clang/tools/clang-format/Makefile b/clang/tools/clang-format/Makefile index d869267a76f..4902244f865 100644 --- a/clang/tools/clang-format/Makefile +++ b/clang/tools/clang-format/Makefile @@ -15,7 +15,7 @@ TOOLNAME = clang-format TOOL_NO_EXPORTS = 1 include $(CLANG_LEVEL)/../../Makefile.config -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option USEDLIBS = clangFormat.a clangTooling.a clangFrontend.a clangSerialization.a \ clangDriver.a clangParse.a clangSema.a clangAnalysis.a \ clangRewriteFrontend.a clangRewriteCore.a clangEdit.a clangAST.a \ diff --git a/clang/tools/diagtool/Makefile b/clang/tools/diagtool/Makefile index 94f9c7663ad..d49e976e642 100644 --- a/clang/tools/diagtool/Makefile +++ b/clang/tools/diagtool/Makefile @@ -17,7 +17,7 @@ TOOL_NO_EXPORTS := 1 NO_INSTALL = 1 include $(CLANG_LEVEL)/../../Makefile.config -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option USEDLIBS = clangFrontend.a clangDriver.a clangSerialization.a clangParse.a \ clangSema.a clangAnalysis.a clangEdit.a clangAST.a clangLex.a \ clangBasic.a diff --git a/clang/tools/driver/Makefile b/clang/tools/driver/Makefile index cdf3b5248c3..f7a9f8f36e5 100644 --- a/clang/tools/driver/Makefile +++ b/clang/tools/driver/Makefile @@ -30,7 +30,7 @@ TOOL_INFO_PLIST := Info.plist include $(CLANG_LEVEL)/../../Makefile.config LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \ - instrumentation ipo irreader linker selectiondag + instrumentation ipo irreader linker selectiondag option USEDLIBS = clangFrontendTool.a clangFrontend.a clangDriver.a \ clangSerialization.a clangCodeGen.a clangParse.a clangSema.a diff --git a/clang/tools/driver/cc1_main.cpp b/clang/tools/driver/cc1_main.cpp index 35cf5b87351..5b3b5ad6500 100644 --- a/clang/tools/driver/cc1_main.cpp +++ b/clang/tools/driver/cc1_main.cpp @@ -13,10 +13,8 @@ // //===----------------------------------------------------------------------===// -#include "clang/Driver/Arg.h" -#include "clang/Driver/ArgList.h" +#include "llvm/Option/Arg.h" #include "clang/Driver/DriverDiagnostic.h" -#include "clang/Driver/OptTable.h" #include "clang/Driver/Options.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/CompilerInvocation.h" @@ -26,6 +24,8 @@ #include "clang/FrontendTool/Utils.h" #include "llvm/ADT/Statistic.h" #include "llvm/LinkAllPasses.h" +#include "llvm/Option/ArgList.h" +#include "llvm/Option/OptTable.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/ManagedStatic.h" #include "llvm/Support/Signals.h" @@ -34,6 +34,7 @@ #include "llvm/Support/raw_ostream.h" #include <cstdio> using namespace clang; +using namespace llvm::opt; //===----------------------------------------------------------------------===// // Main driver diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp index a8afff0fe20..f189c5cf2ac 100644 --- a/clang/tools/driver/cc1as_main.cpp +++ b/clang/tools/driver/cc1as_main.cpp @@ -14,14 +14,12 @@ #include "clang/Basic/Diagnostic.h" #include "clang/Basic/DiagnosticOptions.h" -#include "clang/Driver/Arg.h" -#include "clang/Driver/ArgList.h" #include "clang/Driver/CC1AsOptions.h" #include "clang/Driver/DriverDiagnostic.h" -#include "clang/Driver/OptTable.h" #include "clang/Driver/Options.h" #include "clang/Frontend/FrontendDiagnostic.h" #include "clang/Frontend/TextDiagnosticPrinter.h" +#include "clang/Frontend/Utils.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/ADT/Triple.h" @@ -37,6 +35,9 @@ #include "llvm/MC/MCStreamer.h" #include "llvm/MC/MCSubtargetInfo.h" #include "llvm/MC/MCTargetAsmParser.h" +#include "llvm/Option/Arg.h" +#include "llvm/Option/ArgList.h" +#include "llvm/Option/OptTable.h" #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FormattedStream.h" @@ -56,6 +57,7 @@ using namespace clang; using namespace clang::driver; using namespace llvm; +using namespace llvm::opt; namespace { @@ -225,8 +227,8 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, Opts.ShowVersion = Args->hasArg(OPT_version); // Transliterate Options - Opts.OutputAsmVariant = Args->getLastArgIntValue(OPT_output_asm_variant, - 0, Diags); + Opts.OutputAsmVariant = + getLastArgIntValue(*Args.get(), OPT_output_asm_variant, 0, Diags); Opts.ShowEncoding = Args->hasArg(OPT_show_encoding); Opts.ShowInst = Args->hasArg(OPT_show_inst); @@ -427,7 +429,7 @@ int cc1as_main(const char **ArgBegin, const char **ArgEnd, // Honor -help. if (Asm.ShowHelp) { - OwningPtr<driver::OptTable> Opts(driver::createCC1AsOptTable()); + OwningPtr<OptTable> Opts(driver::createCC1AsOptTable()); Opts->PrintHelp(llvm::outs(), "clang -cc1as", "Clang Integrated Assembler"); return 0; } diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp index 7397667e089..f5a2dd041df 100644 --- a/clang/tools/driver/driver.cpp +++ b/clang/tools/driver/driver.cpp @@ -14,12 +14,9 @@ #include "clang/Basic/CharInfo.h" #include "clang/Basic/DiagnosticOptions.h" -#include "clang/Driver/ArgList.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/Driver.h" #include "clang/Driver/DriverDiagnostic.h" -#include "clang/Driver/OptTable.h" -#include "clang/Driver/Option.h" #include "clang/Driver/Options.h" #include "clang/Frontend/CompilerInvocation.h" #include "clang/Frontend/TextDiagnosticPrinter.h" @@ -28,6 +25,9 @@ #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/SmallString.h" #include "llvm/ADT/SmallVector.h" +#include "llvm/Option/ArgList.h" +#include "llvm/Option/OptTable.h" +#include "llvm/Option/Option.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Host.h" @@ -45,6 +45,7 @@ #include "llvm/Support/system_error.h" using namespace clang; using namespace clang::driver; +using namespace llvm::opt; llvm::sys::Path GetExecutablePath(const char *Argv0, bool CanonicalPrefixes) { if (!CanonicalPrefixes) diff --git a/clang/tools/libclang/Makefile b/clang/tools/libclang/Makefile index f33f345f94f..0fee2c6cf97 100644 --- a/clang/tools/libclang/Makefile +++ b/clang/tools/libclang/Makefile @@ -16,7 +16,7 @@ LINK_LIBS_IN_SHARED = 1 SHARED_LIBRARY = 1 include $(CLANG_LEVEL)/../../Makefile.config -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option USEDLIBS = clangFrontend.a clangDriver.a \ clangTooling.a \ clangSerialization.a \ |