<div dir="ltr">Fixed in r<span style="font-family:arial,sans-serif;font-size:13px">184308.</span></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jun 17, 2013 at 10:50 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This seems to have broken mingw.<br>
<br>
Before:<br>
<br>
$ clang foo.cc -### -target i686-mingw32<br>
[...]<br>
"/usr/bin/gcc" "-c" "-m32" "-o" "/tmp/y-DrQNy1.o" "-x" "assembler"<br>
"/tmp/y-pbNytB.s"<br>
"/usr/bin/gcc" "-m32" "-o" "a.out" "/tmp/y-DrQNy1.o"<br>
<br>
After:<br>
<br>
$ clang foo.cc -### -target i686-mingw32<br>
[...]<br>
"/usr/bin/gcc" "foo.cc" "-c" "-m32" "-o" "/tmp/y-34Ryif.o" "-x"<br>
"assembler" "/tmp/y-ADLfb7.s"<br>
"/usr/bin/gcc" "foo.cc" "-m32" "-o" "a.out" "/tmp/y-34Ryif.o"<br>
<br>
(Note that we're now passing the original source file on to the<br>
assembler and linker.)<br>
<br>
On Fri, Jun 14, 2013 at 10:17 AM, Reid Kleckner <<a href="mailto:reid@kleckner.net">reid@kleckner.net</a>> wrote:<br>
> Author: rnk<br>
> Date: Fri Jun 14 12:17:23 2013<br>
> New Revision: 183989<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=183989&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=183989&view=rev</a><br>
> Log:<br>
> [Driver] Refactor clang driver to use LLVM's Option library<br>
><br>
> The big changes are:<br>
> - Deleting Driver/(Arg|Opt)*<br>
> - Rewriting includes to llvm/Option/ and re-sorting<br>
> - 'using namespace llvm::opt' in clang::driver<br>
> - Fixing the autoconf build by adding option everywhere<br>
><br>
> As discussed in the review, this change includes using directives in<br>
> header files. I'll make follow up changes to remove those in favor of<br>
> name specifiers.<br>
><br>
> Reviewers: espindola<br>
><br>
> Differential Revision: <a href="http://llvm-reviews.chandlerc.com/D975" target="_blank">http://llvm-reviews.chandlerc.com/D975</a><br>
><br>
> Removed:<br>
> cfe/trunk/include/clang/Driver/Arg.h<br>
> cfe/trunk/include/clang/Driver/ArgList.h<br>
> cfe/trunk/include/clang/Driver/OptParser.td<br>
> cfe/trunk/include/clang/Driver/OptSpecifier.h<br>
> cfe/trunk/include/clang/Driver/OptTable.h<br>
> cfe/trunk/include/clang/Driver/Option.h<br>
> cfe/trunk/lib/Driver/Arg.cpp<br>
> cfe/trunk/lib/Driver/ArgList.cpp<br>
> cfe/trunk/lib/Driver/OptTable.cpp<br>
> cfe/trunk/lib/Driver/Option.cpp<br>
> Modified:<br>
> cfe/trunk/examples/clang-interpreter/Makefile<br>
> cfe/trunk/include/clang/Driver/Action.h<br>
> cfe/trunk/include/clang/Driver/CC1AsOptions.h<br>
> cfe/trunk/include/clang/Driver/CC1AsOptions.td<br>
> cfe/trunk/include/clang/Driver/CMakeLists.txt<br>
> cfe/trunk/include/clang/Driver/Compilation.h<br>
> cfe/trunk/include/clang/Driver/Driver.h<br>
> cfe/trunk/include/clang/Driver/Job.h<br>
> cfe/trunk/include/clang/Driver/Makefile<br>
> cfe/trunk/include/clang/Driver/Options.h<br>
> cfe/trunk/include/clang/Driver/Options.td<br>
> cfe/trunk/include/clang/Driver/Tool.h<br>
> cfe/trunk/include/clang/Driver/ToolChain.h<br>
> cfe/trunk/include/clang/Driver/Util.h<br>
> cfe/trunk/include/clang/Frontend/CompilerInvocation.h<br>
> cfe/trunk/include/clang/Frontend/Utils.h<br>
> cfe/trunk/lib/Driver/Action.cpp<br>
> cfe/trunk/lib/Driver/CC1AsOptions.cpp<br>
> cfe/trunk/lib/Driver/CMakeLists.txt<br>
> cfe/trunk/lib/Driver/Compilation.cpp<br>
> cfe/trunk/lib/Driver/Driver.cpp<br>
> cfe/trunk/lib/Driver/DriverOptions.cpp<br>
> cfe/trunk/lib/Driver/InputInfo.h<br>
> cfe/trunk/lib/Driver/Job.cpp<br>
> cfe/trunk/lib/Driver/SanitizerArgs.h<br>
> cfe/trunk/lib/Driver/ToolChain.cpp<br>
> cfe/trunk/lib/Driver/ToolChains.cpp<br>
> cfe/trunk/lib/Driver/Tools.cpp<br>
> cfe/trunk/lib/Driver/Tools.h<br>
> cfe/trunk/lib/Driver/WindowsToolChain.cpp<br>
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
> cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp<br>
> cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp<br>
> cfe/trunk/lib/Tooling/Tooling.cpp<br>
> cfe/trunk/tools/arcmt-test/Makefile<br>
> cfe/trunk/tools/c-arcmt-test/Makefile<br>
> cfe/trunk/tools/c-index-test/Makefile<br>
> cfe/trunk/tools/clang-check/ClangCheck.cpp<br>
> cfe/trunk/tools/clang-check/Makefile<br>
> cfe/trunk/tools/clang-format/Makefile<br>
> cfe/trunk/tools/diagtool/Makefile<br>
> cfe/trunk/tools/driver/Makefile<br>
> cfe/trunk/tools/driver/cc1_main.cpp<br>
> cfe/trunk/tools/driver/cc1as_main.cpp<br>
> cfe/trunk/tools/driver/driver.cpp<br>
> cfe/trunk/tools/libclang/Makefile<br>
> cfe/trunk/unittests/AST/Makefile<br>
> cfe/trunk/unittests/ASTMatchers/Dynamic/Makefile<br>
> cfe/trunk/unittests/ASTMatchers/Makefile<br>
> cfe/trunk/unittests/Format/Makefile<br>
> cfe/trunk/unittests/Frontend/Makefile<br>
> cfe/trunk/unittests/Tooling/Makefile<br>
><br>
> Modified: cfe/trunk/examples/clang-interpreter/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/examples/clang-interpreter/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/examples/clang-interpreter/Makefile (original)<br>
> +++ cfe/trunk/examples/clang-interpreter/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -16,7 +16,7 @@ NO_INSTALL = 1<br>
> TOOL_NO_EXPORTS = 1<br>
><br>
> LINK_COMPONENTS := jit interpreter nativecodegen bitreader bitwriter ipo \<br>
> - linker selectiondag asmparser instrumentation<br>
> + linker selectiondag asmparser instrumentation option<br>
> USEDLIBS = clangFrontend.a clangSerialization.a clangDriver.a clangCodeGen.a \<br>
> clangParse.a clangSema.a clangStaticAnalyzerFrontend.a \<br>
> clangStaticAnalyzerCheckers.a clangStaticAnalyzerCore.a \<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/Action.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Action.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Action.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/Action.h Fri Jun 14 12:17:23 2013<br>
> @@ -14,9 +14,17 @@<br>
> #include "clang/Driver/Util.h"<br>
> #include "llvm/ADT/SmallVector.h"<br>
><br>
> +namespace llvm {<br>
> +namespace opt {<br>
> + class Arg;<br>
> +}<br>
> +}<br>
> +<br>
> namespace clang {<br>
> namespace driver {<br>
> - class Arg;<br>
> + // FIXME: Remove this using directive and qualify class usage below.<br>
> + using namespace llvm::opt;<br>
> +<br>
><br>
> /// Action - Represent an abstract compilation step to perform.<br>
> ///<br>
><br>
> Removed: cfe/trunk/include/clang/Driver/Arg.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Arg.h?rev=183988&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Arg.h?rev=183988&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Arg.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/Arg.h (removed)<br>
> @@ -1,133 +0,0 @@<br>
> -//===--- Arg.h - Parsed Argument Classes ------------------------*- C++ -*-===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -///<br>
> -/// \file<br>
> -/// \brief Defines the clang::driver::Arg class for parsed arguments.<br>
> -///<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef CLANG_DRIVER_ARG_H_<br>
> -#define CLANG_DRIVER_ARG_H_<br>
> -<br>
> -#include "Util.h"<br>
> -#include "clang/Driver/Option.h"<br>
> -#include "llvm/ADT/SmallVector.h"<br>
> -#include "llvm/ADT/StringRef.h"<br>
> -#include <string><br>
> -<br>
> -namespace clang {<br>
> -namespace driver {<br>
> - class ArgList;<br>
> -<br>
> - /// \brief A concrete instance of a particular driver option.<br>
> - ///<br>
> - /// The Arg class encodes just enough information to be able to<br>
> - /// derive the argument values efficiently. In addition, Arg<br>
> - /// instances have an intrusive double linked list which is used by<br>
> - /// ArgList to provide efficient iteration over all instances of a<br>
> - /// particular option.<br>
> - class Arg {<br>
> - Arg(const Arg &) LLVM_DELETED_FUNCTION;<br>
> - void operator=(const Arg &) LLVM_DELETED_FUNCTION;<br>
> -<br>
> - private:<br>
> - /// \brief The option this argument is an instance of.<br>
> - const Option Opt;<br>
> -<br>
> - /// \brief The argument this argument was derived from (during tool chain<br>
> - /// argument translation), if any.<br>
> - const Arg *BaseArg;<br>
> -<br>
> - /// \brief How this instance of the option was spelled.<br>
> - StringRef Spelling;<br>
> -<br>
> - /// \brief The index at which this argument appears in the containing<br>
> - /// ArgList.<br>
> - unsigned Index;<br>
> -<br>
> - /// \brief Was this argument used to affect compilation?<br>
> - ///<br>
> - /// This is used for generating "argument unused" diagnostics.<br>
> - mutable unsigned Claimed : 1;<br>
> -<br>
> - /// \brief Does this argument own its values?<br>
> - mutable unsigned OwnsValues : 1;<br>
> -<br>
> - /// \brief The argument values, as C strings.<br>
> - SmallVector<const char *, 2> Values;<br>
> -<br>
> - public:<br>
> - Arg(const Option Opt, StringRef Spelling, unsigned Index,<br>
> - const Arg *BaseArg = 0);<br>
> - Arg(const Option Opt, StringRef Spelling, unsigned Index,<br>
> - const char *Value0, const Arg *BaseArg = 0);<br>
> - Arg(const Option Opt, StringRef Spelling, unsigned Index,<br>
> - const char *Value0, const char *Value1, const Arg *BaseArg = 0);<br>
> - ~Arg();<br>
> -<br>
> - Option getOption() const { return Opt; }<br>
> - StringRef getSpelling() const { return Spelling; }<br>
> - unsigned getIndex() const { return Index; }<br>
> -<br>
> - /// \brief Return the base argument which generated this arg.<br>
> - ///<br>
> - /// This is either the argument itself or the argument it was<br>
> - /// derived from during tool chain specific argument translation.<br>
> - const Arg &getBaseArg() const {<br>
> - return BaseArg ? *BaseArg : *this;<br>
> - }<br>
> - void setBaseArg(const Arg *_BaseArg) {<br>
> - BaseArg = _BaseArg;<br>
> - }<br>
> -<br>
> - bool getOwnsValues() const { return OwnsValues; }<br>
> - void setOwnsValues(bool Value) const { OwnsValues = Value; }<br>
> -<br>
> - bool isClaimed() const { return getBaseArg().Claimed; }<br>
> -<br>
> - /// \brief Set the Arg claimed bit.<br>
> - void claim() const { getBaseArg().Claimed = true; }<br>
> -<br>
> - unsigned getNumValues() const { return Values.size(); }<br>
> - const char *getValue(unsigned N = 0) const {<br>
> - return Values[N];<br>
> - }<br>
> -<br>
> - SmallVectorImpl<const char*> &getValues() {<br>
> - return Values;<br>
> - }<br>
> -<br>
> - bool containsValue(StringRef Value) const {<br>
> - for (unsigned i = 0, e = getNumValues(); i != e; ++i)<br>
> - if (Values[i] == Value)<br>
> - return true;<br>
> - return false;<br>
> - }<br>
> -<br>
> - /// \brief Append the argument onto the given array as strings.<br>
> - void render(const ArgList &Args, ArgStringList &Output) const;<br>
> -<br>
> - /// \brief Append the argument, render as an input, onto the given<br>
> - /// array as strings.<br>
> - ///<br>
> - /// The distinction is that some options only render their values<br>
> - /// when rendered as a input (e.g., Xlinker).<br>
> - void renderAsInput(const ArgList &Args, ArgStringList &Output) const;<br>
> -<br>
> - void dump() const;<br>
> -<br>
> - /// \brief Return a formatted version of the argument and<br>
> - /// its values, for debugging and diagnostics.<br>
> - std::string getAsString(const ArgList &Args) const;<br>
> - };<br>
> -<br>
> -} // end namespace driver<br>
> -} // end namespace clang<br>
> -<br>
> -#endif<br>
><br>
> Removed: cfe/trunk/include/clang/Driver/ArgList.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ArgList.h?rev=183988&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ArgList.h?rev=183988&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/ArgList.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/ArgList.h (removed)<br>
> @@ -1,442 +0,0 @@<br>
> -//===--- ArgList.h - Argument List Management ----------*- C++ -*-===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef CLANG_DRIVER_ARGLIST_H_<br>
> -#define CLANG_DRIVER_ARGLIST_H_<br>
> -<br>
> -#include "clang/Basic/LLVM.h"<br>
> -#include "clang/Driver/OptSpecifier.h"<br>
> -#include "clang/Driver/Option.h"<br>
> -#include "clang/Driver/Util.h"<br>
> -#include "llvm/ADT/SmallVector.h"<br>
> -#include "llvm/ADT/StringRef.h"<br>
> -#include <list><br>
> -#include <string><br>
> -#include <vector><br>
> -<br>
> -namespace clang {<br>
> - class DiagnosticsEngine;<br>
> -<br>
> -namespace driver {<br>
> - class Arg;<br>
> - class ArgList;<br>
> - class Option;<br>
> -<br>
> - /// arg_iterator - Iterates through arguments stored inside an ArgList.<br>
> - class arg_iterator {<br>
> - /// The current argument.<br>
> - SmallVectorImpl<Arg*>::const_iterator Current;<br>
> -<br>
> - /// The argument list we are iterating over.<br>
> - const ArgList &Args;<br>
> -<br>
> - /// Optional filters on the arguments which will be match. Most clients<br>
> - /// should never want to iterate over arguments without filters, so we won't<br>
> - /// bother to factor this into two separate iterator implementations.<br>
> - //<br>
> - // FIXME: Make efficient; the idea is to provide efficient iteration over<br>
> - // all arguments which match a particular id and then just provide an<br>
> - // iterator combinator which takes multiple iterators which can be<br>
> - // efficiently compared and returns them in order.<br>
> - OptSpecifier Id0, Id1, Id2;<br>
> -<br>
> - void SkipToNextArg();<br>
> -<br>
> - public:<br>
> - typedef Arg * const * value_type;<br>
> - typedef Arg * const & reference;<br>
> - typedef Arg * const * pointer;<br>
> - typedef std::forward_iterator_tag iterator_category;<br>
> - typedef std::ptrdiff_t difference_type;<br>
> -<br>
> - arg_iterator(SmallVectorImpl<Arg*>::const_iterator it,<br>
> - const ArgList &_Args, OptSpecifier _Id0 = 0U,<br>
> - OptSpecifier _Id1 = 0U, OptSpecifier _Id2 = 0U)<br>
> - : Current(it), Args(_Args), Id0(_Id0), Id1(_Id1), Id2(_Id2) {<br>
> - SkipToNextArg();<br>
> - }<br>
> -<br>
> - operator const Arg*() { return *Current; }<br>
> - reference operator*() const { return *Current; }<br>
> - pointer operator->() const { return Current; }<br>
> -<br>
> - arg_iterator &operator++() {<br>
> - ++Current;<br>
> - SkipToNextArg();<br>
> - return *this;<br>
> - }<br>
> -<br>
> - arg_iterator operator++(int) {<br>
> - arg_iterator tmp(*this);<br>
> - ++(*this);<br>
> - return tmp;<br>
> - }<br>
> -<br>
> - friend bool operator==(arg_iterator LHS, arg_iterator RHS) {<br>
> - return LHS.Current == RHS.Current;<br>
> - }<br>
> - friend bool operator!=(arg_iterator LHS, arg_iterator RHS) {<br>
> - return !(LHS == RHS);<br>
> - }<br>
> - };<br>
> -<br>
> - /// ArgList - Ordered collection of driver arguments.<br>
> - ///<br>
> - /// The ArgList class manages a list of Arg instances as well as<br>
> - /// auxiliary data and convenience methods to allow Tools to quickly<br>
> - /// check for the presence of Arg instances for a particular Option<br>
> - /// and to iterate over groups of arguments.<br>
> - class ArgList {<br>
> - private:<br>
> - ArgList(const ArgList &) LLVM_DELETED_FUNCTION;<br>
> - void operator=(const ArgList &) LLVM_DELETED_FUNCTION;<br>
> -<br>
> - public:<br>
> - typedef SmallVector<Arg*, 16> arglist_type;<br>
> - typedef arglist_type::iterator iterator;<br>
> - typedef arglist_type::const_iterator const_iterator;<br>
> - typedef arglist_type::reverse_iterator reverse_iterator;<br>
> - typedef arglist_type::const_reverse_iterator const_reverse_iterator;<br>
> -<br>
> - private:<br>
> - /// The internal list of arguments.<br>
> - arglist_type Args;<br>
> -<br>
> - protected:<br>
> - ArgList();<br>
> -<br>
> - public:<br>
> - virtual ~ArgList();<br>
> -<br>
> - /// @name Arg Access<br>
> - /// @{<br>
> -<br>
> - /// append - Append \p A to the arg list.<br>
> - void append(Arg *A);<br>
> -<br>
> - arglist_type &getArgs() { return Args; }<br>
> - const arglist_type &getArgs() const { return Args; }<br>
> -<br>
> - unsigned size() const { return Args.size(); }<br>
> -<br>
> - /// @}<br>
> - /// @name Arg Iteration<br>
> - /// @{<br>
> -<br>
> - iterator begin() { return Args.begin(); }<br>
> - iterator end() { return Args.end(); }<br>
> -<br>
> - reverse_iterator rbegin() { return Args.rbegin(); }<br>
> - reverse_iterator rend() { return Args.rend(); }<br>
> -<br>
> - const_iterator begin() const { return Args.begin(); }<br>
> - const_iterator end() const { return Args.end(); }<br>
> -<br>
> - const_reverse_iterator rbegin() const { return Args.rbegin(); }<br>
> - const_reverse_iterator rend() const { return Args.rend(); }<br>
> -<br>
> - arg_iterator filtered_begin(OptSpecifier Id0 = 0U, OptSpecifier Id1 = 0U,<br>
> - OptSpecifier Id2 = 0U) const {<br>
> - return arg_iterator(Args.begin(), *this, Id0, Id1, Id2);<br>
> - }<br>
> - arg_iterator filtered_end() const {<br>
> - return arg_iterator(Args.end(), *this);<br>
> - }<br>
> -<br>
> - /// @}<br>
> - /// @name Arg Removal<br>
> - /// @{<br>
> -<br>
> - /// eraseArg - Remove any option matching \p Id.<br>
> - void eraseArg(OptSpecifier Id);<br>
> -<br>
> - /// @}<br>
> - /// @name Arg Access<br>
> - /// @{<br>
> -<br>
> - /// hasArg - Does the arg list contain any option matching \p Id.<br>
> - ///<br>
> - /// \p Claim Whether the argument should be claimed, if it exists.<br>
> - bool hasArgNoClaim(OptSpecifier Id) const {<br>
> - return getLastArgNoClaim(Id) != 0;<br>
> - }<br>
> - bool hasArg(OptSpecifier Id) const {<br>
> - return getLastArg(Id) != 0;<br>
> - }<br>
> - bool hasArg(OptSpecifier Id0, OptSpecifier Id1) const {<br>
> - return getLastArg(Id0, Id1) != 0;<br>
> - }<br>
> - bool hasArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const {<br>
> - return getLastArg(Id0, Id1, Id2) != 0;<br>
> - }<br>
> -<br>
> - /// getLastArg - Return the last argument matching \p Id, or null.<br>
> - ///<br>
> - /// \p Claim Whether the argument should be claimed, if it exists.<br>
> - Arg *getLastArgNoClaim(OptSpecifier Id) const;<br>
> - Arg *getLastArg(OptSpecifier Id) const;<br>
> - Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1) const;<br>
> - Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2) const;<br>
> - Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2,<br>
> - OptSpecifier Id3) const;<br>
> - Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2,<br>
> - OptSpecifier Id3, OptSpecifier Id4) const;<br>
> - Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2,<br>
> - OptSpecifier Id3, OptSpecifier Id4, OptSpecifier Id5) const;<br>
> - Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2,<br>
> - OptSpecifier Id3, OptSpecifier Id4, OptSpecifier Id5,<br>
> - OptSpecifier Id6) const;<br>
> - Arg *getLastArg(OptSpecifier Id0, OptSpecifier Id1, OptSpecifier Id2,<br>
> - OptSpecifier Id3, OptSpecifier Id4, OptSpecifier Id5,<br>
> - OptSpecifier Id6, OptSpecifier Id7) const;<br>
> -<br>
> - /// getArgString - Return the input argument string at \p Index.<br>
> - virtual const char *getArgString(unsigned Index) const = 0;<br>
> -<br>
> - /// getNumInputArgStrings - Return the number of original argument strings,<br>
> - /// which are guaranteed to be the first strings in the argument string<br>
> - /// list.<br>
> - virtual unsigned getNumInputArgStrings() const = 0;<br>
> -<br>
> - /// @}<br>
> - /// @name Argument Lookup Utilities<br>
> - /// @{<br>
> -<br>
> - /// getLastArgValue - Return the value of the last argument, or a default.<br>
> - StringRef getLastArgValue(OptSpecifier Id,<br>
> - StringRef Default = "") const;<br>
> -<br>
> - /// getLastArgValue - Return the value of the last argument as an integer,<br>
> - /// or a default. If Diags is non-null, emits an error if the argument<br>
> - /// is given, but non-integral.<br>
> - int getLastArgIntValue(OptSpecifier Id, int Default,<br>
> - DiagnosticsEngine *Diags = 0) const;<br>
> -<br>
> - /// getLastArgValue - Return the value of the last argument as an integer,<br>
> - /// or a default. Emits an error if the argument is given, but non-integral.<br>
> - int getLastArgIntValue(OptSpecifier Id, int Default,<br>
> - DiagnosticsEngine &Diags) const {<br>
> - return getLastArgIntValue(Id, Default, &Diags);<br>
> - }<br>
> -<br>
> - /// getAllArgValues - Get the values of all instances of the given argument<br>
> - /// as strings.<br>
> - std::vector<std::string> getAllArgValues(OptSpecifier Id) const;<br>
> -<br>
> - /// @}<br>
> - /// @name Translation Utilities<br>
> - /// @{<br>
> -<br>
> - /// hasFlag - Given an option \p Pos and its negative form \p Neg, return<br>
> - /// true if the option is present, false if the negation is present, and<br>
> - /// \p Default if neither option is given. If both the option and its<br>
> - /// negation are present, the last one wins.<br>
> - bool hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default = true) const;<br>
> -<br>
> - /// hasFlag - Given an option \p Pos, an alias \p PosAlias and its negative<br>
> - /// form \p Neg, return true if the option or its alias is present, false if<br>
> - /// the negation is present, and \p Default if none of the options are<br>
> - /// given. If multiple options are present, the last one wins.<br>
> - bool hasFlag(OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg,<br>
> - bool Default = true) const;<br>
> -<br>
> - /// AddLastArg - Render only the last argument match \p Id0, if present.<br>
> - void AddLastArg(ArgStringList &Output, OptSpecifier Id0) const;<br>
> - void AddLastArg(ArgStringList &Output, OptSpecifier Id0,<br>
> - OptSpecifier Id1) const;<br>
> -<br>
> - /// AddAllArgs - Render all arguments matching the given ids.<br>
> - void AddAllArgs(ArgStringList &Output, OptSpecifier Id0,<br>
> - OptSpecifier Id1 = 0U, OptSpecifier Id2 = 0U) const;<br>
> -<br>
> - /// AddAllArgValues - Render the argument values of all arguments<br>
> - /// matching the given ids.<br>
> - void AddAllArgValues(ArgStringList &Output, OptSpecifier Id0,<br>
> - OptSpecifier Id1 = 0U, OptSpecifier Id2 = 0U) const;<br>
> -<br>
> - /// AddAllArgsTranslated - Render all the arguments matching the<br>
> - /// given ids, but forced to separate args and using the provided<br>
> - /// name instead of the first option value.<br>
> - ///<br>
> - /// \param Joined - If true, render the argument as joined with<br>
> - /// the option specifier.<br>
> - void AddAllArgsTranslated(ArgStringList &Output, OptSpecifier Id0,<br>
> - const char *Translation,<br>
> - bool Joined = false) const;<br>
> -<br>
> - /// ClaimAllArgs - Claim all arguments which match the given<br>
> - /// option id.<br>
> - void ClaimAllArgs(OptSpecifier Id0) const;<br>
> -<br>
> - /// ClaimAllArgs - Claim all arguments.<br>
> - ///<br>
> - void ClaimAllArgs() const;<br>
> -<br>
> - /// @}<br>
> - /// @name Arg Synthesis<br>
> - /// @{<br>
> -<br>
> - /// MakeArgString - Construct a constant string pointer whose<br>
> - /// lifetime will match that of the ArgList.<br>
> - virtual const char *MakeArgString(StringRef Str) const = 0;<br>
> - const char *MakeArgString(const char *Str) const {<br>
> - return MakeArgString(StringRef(Str));<br>
> - }<br>
> - const char *MakeArgString(std::string Str) const {<br>
> - return MakeArgString(StringRef(Str));<br>
> - }<br>
> - const char *MakeArgString(const Twine &Str) const;<br>
> -<br>
> - /// \brief Create an arg string for (\p LHS + \p RHS), reusing the<br>
> - /// string at \p Index if possible.<br>
> - const char *GetOrMakeJoinedArgString(unsigned Index, StringRef LHS,<br>
> - StringRef RHS) const;<br>
> -<br>
> - /// @}<br>
> -<br>
> - void dump() const;<br>
> - };<br>
> -<br>
> - class InputArgList : public ArgList {<br>
> - private:<br>
> - /// List of argument strings used by the contained Args.<br>
> - ///<br>
> - /// This is mutable since we treat the ArgList as being the list<br>
> - /// of Args, and allow routines to add new strings (to have a<br>
> - /// convenient place to store the memory) via MakeIndex.<br>
> - mutable ArgStringList ArgStrings;<br>
> -<br>
> - /// Strings for synthesized arguments.<br>
> - ///<br>
> - /// This is mutable since we treat the ArgList as being the list<br>
> - /// of Args, and allow routines to add new strings (to have a<br>
> - /// convenient place to store the memory) via MakeIndex.<br>
> - mutable std::list<std::string> SynthesizedStrings;<br>
> -<br>
> - /// The number of original input argument strings.<br>
> - unsigned NumInputArgStrings;<br>
> -<br>
> - public:<br>
> - InputArgList(const char* const *ArgBegin, const char* const *ArgEnd);<br>
> - ~InputArgList();<br>
> -<br>
> - virtual const char *getArgString(unsigned Index) const {<br>
> - return ArgStrings[Index];<br>
> - }<br>
> -<br>
> - virtual unsigned getNumInputArgStrings() const {<br>
> - return NumInputArgStrings;<br>
> - }<br>
> -<br>
> - /// @name Arg Synthesis<br>
> - /// @{<br>
> -<br>
> - public:<br>
> - /// MakeIndex - Get an index for the given string(s).<br>
> - unsigned MakeIndex(StringRef String0) const;<br>
> - unsigned MakeIndex(StringRef String0, StringRef String1) const;<br>
> -<br>
> - virtual const char *MakeArgString(StringRef Str) const;<br>
> -<br>
> - /// @}<br>
> - };<br>
> -<br>
> - /// DerivedArgList - An ordered collection of driver arguments,<br>
> - /// whose storage may be in another argument list.<br>
> - class DerivedArgList : public ArgList {<br>
> - const InputArgList &BaseArgs;<br>
> -<br>
> - /// The list of arguments we synthesized.<br>
> - mutable arglist_type SynthesizedArgs;<br>
> -<br>
> - public:<br>
> - /// Construct a new derived arg list from \p BaseArgs.<br>
> - DerivedArgList(const InputArgList &BaseArgs);<br>
> - ~DerivedArgList();<br>
> -<br>
> - virtual const char *getArgString(unsigned Index) const {<br>
> - return BaseArgs.getArgString(Index);<br>
> - }<br>
> -<br>
> - virtual unsigned getNumInputArgStrings() const {<br>
> - return BaseArgs.getNumInputArgStrings();<br>
> - }<br>
> -<br>
> - const InputArgList &getBaseArgs() const {<br>
> - return BaseArgs;<br>
> - }<br>
> -<br>
> - /// @name Arg Synthesis<br>
> - /// @{<br>
> -<br>
> - /// AddSynthesizedArg - Add a argument to the list of synthesized arguments<br>
> - /// (to be freed).<br>
> - void AddSynthesizedArg(Arg *A) {<br>
> - SynthesizedArgs.push_back(A);<br>
> - }<br>
> -<br>
> - virtual const char *MakeArgString(StringRef Str) const;<br>
> -<br>
> - /// AddFlagArg - Construct a new FlagArg for the given option \p Id and<br>
> - /// append it to the argument list.<br>
> - void AddFlagArg(const Arg *BaseArg, const Option Opt) {<br>
> - append(MakeFlagArg(BaseArg, Opt));<br>
> - }<br>
> -<br>
> - /// AddPositionalArg - Construct a new Positional arg for the given option<br>
> - /// \p Id, with the provided \p Value and append it to the argument<br>
> - /// list.<br>
> - void AddPositionalArg(const Arg *BaseArg, const Option Opt,<br>
> - StringRef Value) {<br>
> - append(MakePositionalArg(BaseArg, Opt, Value));<br>
> - }<br>
> -<br>
> -<br>
> - /// AddSeparateArg - Construct a new Positional arg for the given option<br>
> - /// \p Id, with the provided \p Value and append it to the argument<br>
> - /// list.<br>
> - void AddSeparateArg(const Arg *BaseArg, const Option Opt,<br>
> - StringRef Value) {<br>
> - append(MakeSeparateArg(BaseArg, Opt, Value));<br>
> - }<br>
> -<br>
> -<br>
> - /// AddJoinedArg - Construct a new Positional arg for the given option<br>
> - /// \p Id, with the provided \p Value and append it to the argument list.<br>
> - void AddJoinedArg(const Arg *BaseArg, const Option Opt,<br>
> - StringRef Value) {<br>
> - append(MakeJoinedArg(BaseArg, Opt, Value));<br>
> - }<br>
> -<br>
> -<br>
> - /// MakeFlagArg - Construct a new FlagArg for the given option \p Id.<br>
> - Arg *MakeFlagArg(const Arg *BaseArg, const Option Opt) const;<br>
> -<br>
> - /// MakePositionalArg - Construct a new Positional arg for the<br>
> - /// given option \p Id, with the provided \p Value.<br>
> - Arg *MakePositionalArg(const Arg *BaseArg, const Option Opt,<br>
> - StringRef Value) const;<br>
> -<br>
> - /// MakeSeparateArg - Construct a new Positional arg for the<br>
> - /// given option \p Id, with the provided \p Value.<br>
> - Arg *MakeSeparateArg(const Arg *BaseArg, const Option Opt,<br>
> - StringRef Value) const;<br>
> -<br>
> - /// MakeJoinedArg - Construct a new Positional arg for the<br>
> - /// given option \p Id, with the provided \p Value.<br>
> - Arg *MakeJoinedArg(const Arg *BaseArg, const Option Opt,<br>
> - StringRef Value) const;<br>
> -<br>
> - /// @}<br>
> - };<br>
> -<br>
> -} // end namespace driver<br>
> -} // end namespace clang<br>
> -<br>
> -#endif<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/CC1AsOptions.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1AsOptions.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1AsOptions.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/CC1AsOptions.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/CC1AsOptions.h Fri Jun 14 12:17:23 2013<br>
> @@ -10,9 +10,17 @@<br>
> #ifndef CLANG_DRIVER_CC1ASOPTIONS_H<br>
> #define CLANG_DRIVER_CC1ASOPTIONS_H<br>
><br>
> +namespace llvm {<br>
> +namespace opt {<br>
> + class OptTable;<br>
> +}<br>
> +}<br>
> +<br>
> namespace clang {<br>
> namespace driver {<br>
> - class OptTable;<br>
> + // FIXME: Remove this using directive and qualify class usage below.<br>
> + using namespace llvm::opt;<br>
> +<br>
><br>
> namespace cc1asoptions {<br>
> enum ID {<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/CC1AsOptions.td<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1AsOptions.td?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1AsOptions.td?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/CC1AsOptions.td (original)<br>
> +++ cfe/trunk/include/clang/Driver/CC1AsOptions.td Fri Jun 14 12:17:23 2013<br>
> @@ -12,7 +12,7 @@<br>
> //===----------------------------------------------------------------------===//<br>
><br>
> // Include the common option parsing interfaces.<br>
> -include "OptParser.td"<br>
> +include "llvm/Option/OptParser.td"<br>
><br>
> //===----------------------------------------------------------------------===//<br>
> // Target Options<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/CMakeLists.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CMakeLists.txt?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CMakeLists.txt?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/CMakeLists.txt (original)<br>
> +++ cfe/trunk/include/clang/Driver/CMakeLists.txt Fri Jun 14 12:17:23 2013<br>
> @@ -1,7 +1,7 @@<br>
> -clang_tablegen(Options.inc -gen-opt-parser-defs<br>
> - SOURCE Options.td<br>
> - TARGET ClangDriverOptions)<br>
> +set(LLVM_TARGET_DEFINITIONS Options.td)<br>
> +tablegen(CLANG Options.inc -gen-opt-parser-defs)<br>
> +add_public_tablegen_target(ClangDriverOptions)<br>
><br>
> -clang_tablegen(CC1AsOptions.inc -gen-opt-parser-defs<br>
> - SOURCE CC1AsOptions.td<br>
> - TARGET ClangCC1AsOptions)<br>
> +set(LLVM_TARGET_DEFINITIONS CC1AsOptions.td)<br>
> +tablegen(CLANG CC1AsOptions.inc -gen-opt-parser-defs)<br>
> +add_public_tablegen_target(ClangCC1AsOptions)<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/Compilation.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Compilation.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/Compilation.h Fri Jun 14 12:17:23 2013<br>
> @@ -16,11 +16,19 @@<br>
> #include "llvm/Support/Path.h"<br>
> #include "llvm/Support/PathV1.h"<br>
><br>
> +namespace llvm {<br>
> +namespace opt {<br>
> + class DerivedArgList;<br>
> + class InputArgList;<br>
> +}<br>
> +}<br>
> +<br>
> namespace clang {<br>
> namespace driver {<br>
> - class DerivedArgList;<br>
> + // FIXME: Remove this using directive and qualify class usage below.<br>
> + using namespace llvm::opt;<br>
> +<br>
> class Driver;<br>
> - class InputArgList;<br>
> class JobAction;<br>
> class JobList;<br>
> class ToolChain;<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/Driver.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Driver.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/Driver.h Fri Jun 14 12:17:23 2013<br>
> @@ -24,18 +24,26 @@<br>
> #include <set><br>
> #include <string><br>
><br>
> +namespace llvm {<br>
> +namespace opt {<br>
> + class Arg;<br>
> + class ArgList;<br>
> + class DerivedArgList;<br>
> + class InputArgList;<br>
> + class OptTable;<br>
> +}<br>
> +}<br>
> +<br>
> namespace clang {<br>
> namespace driver {<br>
> + // FIXME: Remove this using directive and qualify class usage below.<br>
> + using namespace llvm::opt;<br>
> +<br>
> class Action;<br>
> - class Arg;<br>
> - class ArgList;<br>
> class Command;<br>
> class Compilation;<br>
> - class DerivedArgList;<br>
> - class InputArgList;<br>
> class InputInfo;<br>
> class JobAction;<br>
> - class OptTable;<br>
> class ToolChain;<br>
><br>
> /// Driver - Encapsulate logic for constructing compilation processes<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/Job.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Job.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/Job.h Fri Jun 14 12:17:23 2013<br>
> @@ -11,14 +11,17 @@<br>
> #define CLANG_DRIVER_JOB_H_<br>
><br>
> #include "clang/Basic/LLVM.h"<br>
> -#include "clang/Driver/Util.h"<br>
> #include "llvm/ADT/SmallVector.h"<br>
> +#include "llvm/Option/Option.h"<br>
><br>
> namespace clang {<br>
> namespace driver {<br>
> +class Action;<br>
> class Command;<br>
> class Tool;<br>
><br>
> +using llvm::opt::ArgStringList;<br>
> +<br>
> class Job {<br>
> public:<br>
> enum JobClass {<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Makefile (original)<br>
> +++ cfe/trunk/include/clang/Driver/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -5,10 +5,10 @@ TABLEGEN_INC_FILES_COMMON = 1<br>
><br>
> include $(CLANG_LEVEL)/Makefile<br>
><br>
> -$(ObjDir)/Options.inc.tmp : Options.td CC1Options.td OptParser.td $(CLANG_TBLGEN) $(ObjDir)/.dir<br>
> +$(ObjDir)/Options.inc.tmp : Options.td CC1Options.td $(LLVM_TBLGEN) $(ObjDir)/.dir<br>
> $(Echo) "Building Clang Driver Option tables with tblgen"<br>
> - $(Verb) $(ClangTableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<<br>
> + $(Verb) $(LLVMTableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<<br>
><br>
> -$(ObjDir)/CC1AsOptions.inc.tmp : CC1AsOptions.td OptParser.td $(CLANG_TBLGEN) $(ObjDir)/.dir<br>
> +$(ObjDir)/CC1AsOptions.inc.tmp : CC1AsOptions.td $(LLVM_TBLGEN) $(ObjDir)/.dir<br>
> $(Echo) "Building Clang CC1 Assembler Option tables with tblgen"<br>
> - $(Verb) $(ClangTableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<<br>
> + $(Verb) $(LLVMTableGen) -gen-opt-parser-defs -o $(call SYSPATH, $@) $<<br>
><br>
> Removed: cfe/trunk/include/clang/Driver/OptParser.td<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/OptParser.td?rev=183988&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/OptParser.td?rev=183988&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/OptParser.td (original)<br>
> +++ cfe/trunk/include/clang/Driver/OptParser.td (removed)<br>
> @@ -1,152 +0,0 @@<br>
> -//===--- OptParser.td - Common Option Parsing Interfaces ------------------===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -//<br>
> -// This file defines the common interfaces used by the option parsing TableGen<br>
> -// backend.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -// Define the kinds of options.<br>
> -<br>
> -class OptionKind<string name, int predecence = 0, bit sentinel = 0> {<br>
> - string Name = name;<br>
> - // The kind precedence, kinds with lower precedence are matched first.<br>
> - int Precedence = predecence;<br>
> - // Indicate a sentinel option.<br>
> - bit Sentinel = sentinel;<br>
> -}<br>
> -<br>
> -// An option group.<br>
> -def KIND_GROUP : OptionKind<"Group">;<br>
> -// The input option kind.<br>
> -def KIND_INPUT : OptionKind<"Input", 1, 1>;<br>
> -// The unknown option kind.<br>
> -def KIND_UNKNOWN : OptionKind<"Unknown", 2, 1>;<br>
> -// A flag with no values.<br>
> -def KIND_FLAG : OptionKind<"Flag">;<br>
> -// An option which prefixes its (single) value.<br>
> -def KIND_JOINED : OptionKind<"Joined", 1>;<br>
> -// An option which is followed by its value.<br>
> -def KIND_SEPARATE : OptionKind<"Separate">;<br>
> -// An option followed by its values, which are separated by commas.<br>
> -def KIND_COMMAJOINED : OptionKind<"CommaJoined">;<br>
> -// An option which is which takes multiple (separate) arguments.<br>
> -def KIND_MULTIARG : OptionKind<"MultiArg">;<br>
> -// An option which is either joined to its (non-empty) value, or followed by its<br>
> -// value.<br>
> -def KIND_JOINED_OR_SEPARATE : OptionKind<"JoinedOrSeparate">;<br>
> -// An option which is both joined to its (first) value, and followed by its<br>
> -// (second) value.<br>
> -def KIND_JOINED_AND_SEPARATE : OptionKind<"JoinedAndSeparate">;<br>
> -<br>
> -// Define the option flags.<br>
> -<br>
> -class OptionFlag {}<br>
> -<br>
> -// DriverOption - The option is a "driver" option, and should not be forwarded<br>
> -// to gcc.<br>
> -def DriverOption : OptionFlag;<br>
> -<br>
> -// LinkerInput - The option is a linker input.<br>
> -def LinkerInput : OptionFlag;<br>
> -<br>
> -// NoArgumentUnused - Don't report argument unused warnings for this option; this<br>
> -// is useful for options like -static or -dynamic which a user may always end up<br>
> -// passing, even if the platform defaults to (or only supports) that option.<br>
> -def NoArgumentUnused : OptionFlag;<br>
> -<br>
> -// RenderAsInput - The option should not render the name when rendered as an<br>
> -// input (i.e., the option is rendered as values).<br>
> -def RenderAsInput : OptionFlag;<br>
> -<br>
> -// RenderJoined - The option should be rendered joined, even if separate (only<br>
> -// sensible on single value separate options).<br>
> -def RenderJoined : OptionFlag;<br>
> -<br>
> -// RenderSeparate - The option should be rendered separately, even if joined<br>
> -// (only sensible on joined options).<br>
> -def RenderSeparate : OptionFlag;<br>
> -<br>
> -// Unsupported - The option is unsupported, and the driver will reject command<br>
> -// lines that use it.<br>
> -def Unsupported : OptionFlag;<br>
> -<br>
> -// HelpHidden - The option should not be displayed in --help, even if it has<br>
> -// help text. Clients *can* use this in conjunction with the OptTable::PrintHelp<br>
> -// arguments to implement hidden help groups.<br>
> -def HelpHidden : OptionFlag;<br>
> -<br>
> -// NoForward - The option should not be implicitly forwarded to other tools.<br>
> -def NoForward : OptionFlag;<br>
> -<br>
> -// CC1Option - This option should be accepted by clang -cc1.<br>
> -def CC1Option : OptionFlag;<br>
> -<br>
> -// NoDriverOption - This option should not be accepted by the driver.<br>
> -def NoDriverOption : OptionFlag;<br>
> -<br>
> -// Define the option group class.<br>
> -<br>
> -class OptionGroup<string name> {<br>
> - string EnumName = ?; // Uses the def name if undefined.<br>
> - string Name = name;<br>
> - string HelpText = ?;<br>
> - OptionGroup Group = ?;<br>
> -}<br>
> -<br>
> -// Define the option class.<br>
> -<br>
> -class Option<list<string> prefixes, string name, OptionKind kind> {<br>
> - string EnumName = ?; // Uses the def name if undefined.<br>
> - list<string> Prefixes = prefixes;<br>
> - string Name = name;<br>
> - OptionKind Kind = kind;<br>
> - // Used by MultiArg option kind.<br>
> - int NumArgs = 0;<br>
> - string HelpText = ?;<br>
> - string MetaVarName = ?;<br>
> - list<OptionFlag> Flags = [];<br>
> - OptionGroup Group = ?;<br>
> - Option Alias = ?;<br>
> -}<br>
> -<br>
> -// Helpers for defining options.<br>
> -<br>
> -class Flag<list<string> prefixes, string name><br>
> - : Option<prefixes, name, KIND_FLAG>;<br>
> -class Joined<list<string> prefixes, string name><br>
> - : Option<prefixes, name, KIND_JOINED>;<br>
> -class Separate<list<string> prefixes, string name><br>
> - : Option<prefixes, name, KIND_SEPARATE>;<br>
> -class CommaJoined<list<string> prefixes, string name><br>
> - : Option<prefixes, name, KIND_COMMAJOINED>;<br>
> -class MultiArg<list<string> prefixes, string name, int numargs><br>
> - : Option<prefixes, name, KIND_MULTIARG> {<br>
> - int NumArgs = numargs;<br>
> -}<br>
> -class JoinedOrSeparate<list<string> prefixes, string name><br>
> - : Option<prefixes, name, KIND_JOINED_OR_SEPARATE>;<br>
> -class JoinedAndSeparate<list<string> prefixes, string name><br>
> - : Option<prefixes, name, KIND_JOINED_AND_SEPARATE>;<br>
> -<br>
> -// Mix-ins for adding optional attributes.<br>
> -<br>
> -class Alias<Option alias> { Option Alias = alias; }<br>
> -class EnumName<string name> { string EnumName = name; }<br>
> -class Flags<list<OptionFlag> flags> { list<OptionFlag> Flags = flags; }<br>
> -class Group<OptionGroup group> { OptionGroup Group = group; }<br>
> -class HelpText<string text> { string HelpText = text; }<br>
> -class MetaVarName<string name> { string MetaVarName = name; }<br>
> -<br>
> -// Predefined options.<br>
> -<br>
> -// FIXME: Have generator validate that these appear in correct position (and<br>
> -// aren't duplicated).<br>
> -def INPUT : Option<[], "<input>", KIND_INPUT>, Flags<[DriverOption,CC1Option]>;<br>
> -def UNKNOWN : Option<[], "<unknown>", KIND_UNKNOWN>;<br>
><br>
> Removed: cfe/trunk/include/clang/Driver/OptSpecifier.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/OptSpecifier.h?rev=183988&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/OptSpecifier.h?rev=183988&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/OptSpecifier.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/OptSpecifier.h (removed)<br>
> @@ -1,41 +0,0 @@<br>
> -//===--- OptSpecifier.h - Option Specifiers ---------------------*- C++ -*-===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef CLANG_DRIVER_OPTSPECIFIER_H<br>
> -#define CLANG_DRIVER_OPTSPECIFIER_H<br>
> -<br>
> -#include "llvm/Support/Compiler.h"<br>
> -<br>
> -namespace clang {<br>
> -namespace driver {<br>
> - class Option;<br>
> -<br>
> - /// OptSpecifier - Wrapper class for abstracting references to option IDs.<br>
> - class OptSpecifier {<br>
> - unsigned ID;<br>
> -<br>
> - private:<br>
> - explicit OptSpecifier(bool) LLVM_DELETED_FUNCTION;<br>
> -<br>
> - public:<br>
> - OptSpecifier() : ID(0) {}<br>
> - /*implicit*/ OptSpecifier(unsigned _ID) : ID(_ID) {}<br>
> - /*implicit*/ OptSpecifier(const Option *Opt);<br>
> -<br>
> - bool isValid() const { return ID != 0; }<br>
> -<br>
> - unsigned getID() const { return ID; }<br>
> -<br>
> - bool operator==(OptSpecifier Opt) const { return ID == Opt.getID(); }<br>
> - bool operator!=(OptSpecifier Opt) const { return !(*this == Opt); }<br>
> - };<br>
> -}<br>
> -}<br>
> -<br>
> -#endif<br>
><br>
> Removed: cfe/trunk/include/clang/Driver/OptTable.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/OptTable.h?rev=183988&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/OptTable.h?rev=183988&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/OptTable.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/OptTable.h (removed)<br>
> @@ -1,161 +0,0 @@<br>
> -//===--- OptTable.h - Option Table ------------------------------*- C++ -*-===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef CLANG_DRIVER_OPTTABLE_H<br>
> -#define CLANG_DRIVER_OPTTABLE_H<br>
> -<br>
> -#include "clang/Basic/LLVM.h"<br>
> -#include "clang/Driver/OptSpecifier.h"<br>
> -#include "llvm/ADT/StringSet.h"<br>
> -<br>
> -namespace clang {<br>
> -namespace driver {<br>
> - class Arg;<br>
> - class ArgList;<br>
> - class InputArgList;<br>
> - class Option;<br>
> -<br>
> - /// \brief Provide access to the Option info table.<br>
> - ///<br>
> - /// The OptTable class provides a layer of indirection which allows Option<br>
> - /// instance to be created lazily. In the common case, only a few options will<br>
> - /// be needed at runtime; the OptTable class maintains enough information to<br>
> - /// parse command lines without instantiating Options, while letting other<br>
> - /// parts of the driver still use Option instances where convenient.<br>
> - class OptTable {<br>
> - public:<br>
> - /// \brief Entry for a single option instance in the option data table.<br>
> - struct Info {<br>
> - /// A null terminated array of prefix strings to apply to name while<br>
> - /// matching.<br>
> - const char *const *Prefixes;<br>
> - const char *Name;<br>
> - const char *HelpText;<br>
> - const char *MetaVar;<br>
> - unsigned ID;<br>
> - unsigned char Kind;<br>
> - unsigned char Param;<br>
> - unsigned short Flags;<br>
> - unsigned short GroupID;<br>
> - unsigned short AliasID;<br>
> - };<br>
> -<br>
> - private:<br>
> - /// \brief The static option information table.<br>
> - const Info *OptionInfos;<br>
> - unsigned NumOptionInfos;<br>
> -<br>
> - unsigned TheInputOptionID;<br>
> - unsigned TheUnknownOptionID;<br>
> -<br>
> - /// The index of the first option which can be parsed (i.e., is not a<br>
> - /// special option like 'input' or 'unknown', and is not an option group).<br>
> - unsigned FirstSearchableIndex;<br>
> -<br>
> - /// The union of all option prefixes. If an argument does not begin with<br>
> - /// one of these, it is an input.<br>
> - llvm::StringSet<> PrefixesUnion;<br>
> - std::string PrefixChars;<br>
> -<br>
> - private:<br>
> - const Info &getInfo(OptSpecifier Opt) const {<br>
> - unsigned id = Opt.getID();<br>
> - assert(id > 0 && id - 1 < getNumOptions() && "Invalid Option ID.");<br>
> - return OptionInfos[id - 1];<br>
> - }<br>
> -<br>
> - protected:<br>
> - OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos);<br>
> - public:<br>
> - ~OptTable();<br>
> -<br>
> - /// \brief Return the total number of option classes.<br>
> - unsigned getNumOptions() const { return NumOptionInfos; }<br>
> -<br>
> - /// \brief Get the given Opt's Option instance, lazily creating it<br>
> - /// if necessary.<br>
> - ///<br>
> - /// \return The option, or null for the INVALID option id.<br>
> - const Option getOption(OptSpecifier Opt) const;<br>
> -<br>
> - /// \brief Lookup the name of the given option.<br>
> - const char *getOptionName(OptSpecifier id) const {<br>
> - return getInfo(id).Name;<br>
> - }<br>
> -<br>
> - /// \brief Get the kind of the given option.<br>
> - unsigned getOptionKind(OptSpecifier id) const {<br>
> - return getInfo(id).Kind;<br>
> - }<br>
> -<br>
> - /// \brief Get the group id for the given option.<br>
> - unsigned getOptionGroupID(OptSpecifier id) const {<br>
> - return getInfo(id).GroupID;<br>
> - }<br>
> -<br>
> - /// \brief Get the help text to use to describe this option.<br>
> - const char *getOptionHelpText(OptSpecifier id) const {<br>
> - return getInfo(id).HelpText;<br>
> - }<br>
> -<br>
> - /// \brief Get the meta-variable name to use when describing<br>
> - /// this options values in the help text.<br>
> - const char *getOptionMetaVar(OptSpecifier id) const {<br>
> - return getInfo(id).MetaVar;<br>
> - }<br>
> -<br>
> - /// \brief Parse a single argument; returning the new argument and<br>
> - /// updating Index.<br>
> - ///<br>
> - /// \param [in,out] Index - The current parsing position in the argument<br>
> - /// string list; on return this will be the index of the next argument<br>
> - /// string to parse.<br>
> - ///<br>
> - /// \return The parsed argument, or 0 if the argument is missing values<br>
> - /// (in which case Index still points at the conceptual next argument string<br>
> - /// to parse).<br>
> - Arg *ParseOneArg(const ArgList &Args, unsigned &Index) const;<br>
> -<br>
> - /// \brief Parse an list of arguments into an InputArgList.<br>
> - ///<br>
> - /// The resulting InputArgList will reference the strings in [\p ArgBegin,<br>
> - /// \p ArgEnd), and their lifetime should extend past that of the returned<br>
> - /// InputArgList.<br>
> - ///<br>
> - /// The only error that can occur in this routine is if an argument is<br>
> - /// missing values; in this case \p MissingArgCount will be non-zero.<br>
> - ///<br>
> - /// \param ArgBegin - The beginning of the argument vector.<br>
> - /// \param ArgEnd - The end of the argument vector.<br>
> - /// \param MissingArgIndex - On error, the index of the option which could<br>
> - /// not be parsed.<br>
> - /// \param MissingArgCount - On error, the number of missing options.<br>
> - /// \return An InputArgList; on error this will contain all the options<br>
> - /// which could be parsed.<br>
> - InputArgList *ParseArgs(const char* const *ArgBegin,<br>
> - const char* const *ArgEnd,<br>
> - unsigned &MissingArgIndex,<br>
> - unsigned &MissingArgCount) const;<br>
> -<br>
> - /// \brief Render the help text for an option table.<br>
> - ///<br>
> - /// \param OS - The stream to write the help text to.<br>
> - /// \param Name - The name to use in the usage line.<br>
> - /// \param Title - The title to use in the usage line.<br>
> - /// \param FlagsToInclude - If non-zero, only include options with any<br>
> - /// of these flags set.<br>
> - /// \param FlagsToExclude - Exclude options with any of these flags set.<br>
> - void PrintHelp(raw_ostream &OS, const char *Name,<br>
> - const char *Title, unsigned short FlagsToInclude = 0,<br>
> - unsigned short FlagsToExclude = 0) const;<br>
> - };<br>
> -}<br>
> -}<br>
> -<br>
> -#endif<br>
><br>
> Removed: cfe/trunk/include/clang/Driver/Option.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Option.h?rev=183988&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Option.h?rev=183988&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Option.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/Option.h (removed)<br>
> @@ -1,204 +0,0 @@<br>
> -//===--- Option.h - Abstract Driver Options ---------------------*- C++ -*-===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#ifndef CLANG_DRIVER_OPTION_H_<br>
> -#define CLANG_DRIVER_OPTION_H_<br>
> -<br>
> -#include "clang/Basic/LLVM.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> -#include "llvm/ADT/StringRef.h"<br>
> -#include "llvm/Support/ErrorHandling.h"<br>
> -<br>
> -namespace clang {<br>
> -namespace driver {<br>
> - class Arg;<br>
> - class ArgList;<br>
> -<br>
> -namespace options {<br>
> - /// Base flags for all options. Custom flags may be added after.<br>
> - enum DriverFlag {<br>
> - HelpHidden = (1 << 0),<br>
> - RenderAsInput = (1 << 1),<br>
> - RenderJoined = (1 << 2),<br>
> - RenderSeparate = (1 << 3)<br>
> - };<br>
> -<br>
> - /// Flags specifically for clang options.<br>
> - enum ClangFlags {<br>
> - DriverOption = (1 << 4),<br>
> - LinkerInput = (1 << 5),<br>
> - NoArgumentUnused = (1 << 6),<br>
> - NoForward = (1 << 7),<br>
> - Unsupported = (1 << 8),<br>
> - CC1Option = (1 << 9),<br>
> - NoDriverOption = (1 << 10)<br>
> - };<br>
> -}<br>
> -<br>
> - /// Option - Abstract representation for a single form of driver<br>
> - /// argument.<br>
> - ///<br>
> - /// An Option class represents a form of option that the driver<br>
> - /// takes, for example how many arguments the option has and how<br>
> - /// they can be provided. Individual option instances store<br>
> - /// additional information about what group the option is a member<br>
> - /// of (if any), if the option is an alias, and a number of<br>
> - /// flags. At runtime the driver parses the command line into<br>
> - /// concrete Arg instances, each of which corresponds to a<br>
> - /// particular Option instance.<br>
> - class Option {<br>
> - public:<br>
> - enum OptionClass {<br>
> - GroupClass = 0,<br>
> - InputClass,<br>
> - UnknownClass,<br>
> - FlagClass,<br>
> - JoinedClass,<br>
> - SeparateClass,<br>
> - CommaJoinedClass,<br>
> - MultiArgClass,<br>
> - JoinedOrSeparateClass,<br>
> - JoinedAndSeparateClass<br>
> - };<br>
> -<br>
> - enum RenderStyleKind {<br>
> - RenderCommaJoinedStyle,<br>
> - RenderJoinedStyle,<br>
> - RenderSeparateStyle,<br>
> - RenderValuesStyle<br>
> - };<br>
> -<br>
> - protected:<br>
> - const OptTable::Info *Info;<br>
> - const OptTable *Owner;<br>
> -<br>
> - public:<br>
> - Option(const OptTable::Info *Info, const OptTable *Owner);<br>
> - ~Option();<br>
> -<br>
> - bool isValid() const {<br>
> - return Info != 0;<br>
> - }<br>
> -<br>
> - unsigned getID() const {<br>
> - assert(Info && "Must have a valid info!");<br>
> - return Info->ID;<br>
> - }<br>
> -<br>
> - OptionClass getKind() const {<br>
> - assert(Info && "Must have a valid info!");<br>
> - return OptionClass(Info->Kind);<br>
> - }<br>
> -<br>
> - /// \brief Get the name of this option without any prefix.<br>
> - StringRef getName() const {<br>
> - assert(Info && "Must have a valid info!");<br>
> - return Info->Name;<br>
> - }<br>
> -<br>
> - const Option getGroup() const {<br>
> - assert(Info && "Must have a valid info!");<br>
> - assert(Owner && "Must have a valid owner!");<br>
> - return Owner->getOption(Info->GroupID);<br>
> - }<br>
> -<br>
> - const Option getAlias() const {<br>
> - assert(Info && "Must have a valid info!");<br>
> - assert(Owner && "Must have a valid owner!");<br>
> - return Owner->getOption(Info->AliasID);<br>
> - }<br>
> -<br>
> - /// \brief Get the default prefix for this option.<br>
> - StringRef getPrefix() const {<br>
> - const char *Prefix = *Info->Prefixes;<br>
> - return Prefix ? Prefix : StringRef();<br>
> - }<br>
> -<br>
> - /// \brief Get the name of this option with the default prefix.<br>
> - std::string getPrefixedName() const {<br>
> - std::string Ret = getPrefix();<br>
> - Ret += getName();<br>
> - return Ret;<br>
> - }<br>
> -<br>
> - unsigned getNumArgs() const { return Info->Param; }<br>
> -<br>
> - bool hasNoOptAsInput() const { return Info->Flags & options::RenderAsInput;}<br>
> -<br>
> - RenderStyleKind getRenderStyle() const {<br>
> - if (Info->Flags & options::RenderJoined)<br>
> - return RenderJoinedStyle;<br>
> - if (Info->Flags & options::RenderSeparate)<br>
> - return RenderSeparateStyle;<br>
> - switch (getKind()) {<br>
> - case GroupClass:<br>
> - case InputClass:<br>
> - case UnknownClass:<br>
> - return RenderValuesStyle;<br>
> - case JoinedClass:<br>
> - case JoinedAndSeparateClass:<br>
> - return RenderJoinedStyle;<br>
> - case CommaJoinedClass:<br>
> - return RenderCommaJoinedStyle;<br>
> - case FlagClass:<br>
> - case SeparateClass:<br>
> - case MultiArgClass:<br>
> - case JoinedOrSeparateClass:<br>
> - return RenderSeparateStyle;<br>
> - }<br>
> - llvm_unreachable("Unexpected kind!");<br>
> - }<br>
> -<br>
> - /// Test if this option has the flag \a Val.<br>
> - bool hasFlag(unsigned Val) const {<br>
> - return Info->Flags & Val;<br>
> - }<br>
> -<br>
> - /// getUnaliasedOption - Return the final option this option<br>
> - /// aliases (itself, if the option has no alias).<br>
> - const Option getUnaliasedOption() const {<br>
> - const Option Alias = getAlias();<br>
> - if (Alias.isValid()) return Alias.getUnaliasedOption();<br>
> - return *this;<br>
> - }<br>
> -<br>
> - /// getRenderName - Return the name to use when rendering this<br>
> - /// option.<br>
> - StringRef getRenderName() const {<br>
> - return getUnaliasedOption().getName();<br>
> - }<br>
> -<br>
> - /// matches - Predicate for whether this option is part of the<br>
> - /// given option (which may be a group).<br>
> - ///<br>
> - /// Note that matches against options which are an alias should never be<br>
> - /// done -- aliases do not participate in matching and so such a query will<br>
> - /// always be false.<br>
> - bool matches(OptSpecifier ID) const;<br>
> -<br>
> - /// accept - Potentially accept the current argument, returning a<br>
> - /// new Arg instance, or 0 if the option does not accept this<br>
> - /// argument (or the argument is missing values).<br>
> - ///<br>
> - /// If the option accepts the current argument, accept() sets<br>
> - /// Index to the position where argument parsing should resume<br>
> - /// (even if the argument is missing values).<br>
> - ///<br>
> - /// \param ArgSize The number of bytes taken up by the matched Option prefix<br>
> - /// and name. This is used to determine where joined values<br>
> - /// start.<br>
> - Arg *accept(const ArgList &Args, unsigned &Index, unsigned ArgSize) const;<br>
> -<br>
> - void dump() const;<br>
> - };<br>
> -<br>
> -} // end namespace driver<br>
> -} // end namespace clang<br>
> -<br>
> -#endif<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/Options.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Options.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/Options.h Fri Jun 14 12:17:23 2013<br>
> @@ -10,12 +10,29 @@<br>
> #ifndef CLANG_DRIVER_OPTIONS_H<br>
> #define CLANG_DRIVER_OPTIONS_H<br>
><br>
> +namespace llvm {<br>
> +namespace opt {<br>
> +class OptTable;<br>
> +}<br>
> +}<br>
> +<br>
> namespace clang {<br>
> namespace driver {<br>
> - class OptTable;<br>
><br>
> namespace options {<br>
> - enum ID {<br>
> +/// Flags specifically for clang options. Must not overlap with<br>
> +/// llvm::opt::DriverFlag.<br>
> +enum ClangFlags {<br>
> + DriverOption = (1 << 4),<br>
> + LinkerInput = (1 << 5),<br>
> + NoArgumentUnused = (1 << 6),<br>
> + NoForward = (1 << 7),<br>
> + Unsupported = (1 << 8),<br>
> + CC1Option = (1 << 9),<br>
> + NoDriverOption = (1 << 10)<br>
> +};<br>
> +<br>
> +enum ID {<br>
> OPT_INVALID = 0, // This is not an option ID.<br>
> #define PREFIX(NAME, VALUE)<br>
> #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \<br>
> @@ -27,7 +44,7 @@ namespace options {<br>
> };<br>
> }<br>
><br>
> - OptTable *createDriverOptTable();<br>
> +llvm::opt::OptTable *createDriverOptTable();<br>
> }<br>
> }<br>
><br>
><br>
> Modified: cfe/trunk/include/clang/Driver/Options.td<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Options.td (original)<br>
> +++ cfe/trunk/include/clang/Driver/Options.td Fri Jun 14 12:17:23 2013<br>
> @@ -12,7 +12,35 @@<br>
> //===----------------------------------------------------------------------===//<br>
><br>
> // Include the common option parsing interfaces.<br>
> -include "OptParser.td"<br>
> +include "llvm/Option/OptParser.td"<br>
> +<br>
> +/////////<br>
> +// Flags<br>
> +<br>
> +// DriverOption - The option is a "driver" option, and should not be forwarded<br>
> +// to gcc.<br>
> +def DriverOption : OptionFlag;<br>
> +<br>
> +// LinkerInput - The option is a linker input.<br>
> +def LinkerInput : OptionFlag;<br>
> +<br>
> +// NoArgumentUnused - Don't report argument unused warnings for this option; this<br>
> +// is useful for options like -static or -dynamic which a user may always end up<br>
> +// passing, even if the platform defaults to (or only supports) that option.<br>
> +def NoArgumentUnused : OptionFlag;<br>
> +<br>
> +// Unsupported - The option is unsupported, and the driver will reject command<br>
> +// lines that use it.<br>
> +def Unsupported : OptionFlag;<br>
> +<br>
> +// NoForward - The option should not be implicitly forwarded to other tools.<br>
> +def NoForward : OptionFlag;<br>
> +<br>
> +// CC1Option - This option should be accepted by clang -cc1.<br>
> +def CC1Option : OptionFlag;<br>
> +<br>
> +// NoDriverOption - This option should not be accepted by the driver.<br>
> +def NoDriverOption : OptionFlag;<br>
><br>
> /////////<br>
> // Groups<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/Tool.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Tool.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Tool.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Tool.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/Tool.h Fri Jun 14 12:17:23 2013<br>
> @@ -12,9 +12,17 @@<br>
><br>
> #include "clang/Basic/LLVM.h"<br>
><br>
> +namespace llvm {<br>
> +namespace opt {<br>
> + class ArgList;<br>
> +}<br>
> +}<br>
> +<br>
> namespace clang {<br>
> namespace driver {<br>
> - class ArgList;<br>
> + // FIXME: Remove this using directive and qualify class usage below.<br>
> + using namespace llvm::opt;<br>
> +<br>
> class Compilation;<br>
> class InputInfo;<br>
> class Job;<br>
><br>
> Modified: cfe/trunk/include/clang/Driver/ToolChain.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/ToolChain.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Jun 14 12:17:23 2013<br>
> @@ -19,15 +19,23 @@<br>
> #include "llvm/Support/Path.h"<br>
> #include <string><br>
><br>
> +namespace llvm {<br>
> +namespace opt {<br>
> + class ArgList;<br>
> + class DerivedArgList;<br>
> + class InputArgList;<br>
> +}<br>
> +}<br>
> +<br>
> namespace clang {<br>
> class ObjCRuntime;<br>
><br>
> namespace driver {<br>
> - class ArgList;<br>
> + // FIXME: Remove this using directive and qualify class usage below.<br>
> + using namespace llvm::opt;<br>
> +<br>
> class Compilation;<br>
> - class DerivedArgList;<br>
> class Driver;<br>
> - class InputArgList;<br>
> class JobAction;<br>
> class Tool;<br>
><br>
><br>
> Modified: cfe/trunk/include/clang/Driver/Util.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Util.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Util.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Driver/Util.h (original)<br>
> +++ cfe/trunk/include/clang/Driver/Util.h Fri Jun 14 12:17:23 2013<br>
> @@ -14,13 +14,12 @@<br>
> #include "llvm/ADT/DenseMap.h"<br>
><br>
> namespace clang {<br>
> +class DiagnosticsEngine;<br>
> +<br>
> namespace driver {<br>
> class Action;<br>
> class JobAction;<br>
><br>
> - /// ArgStringList - Type used for constructing argv lists for subprocesses.<br>
> - typedef SmallVector<const char*, 16> ArgStringList;<br>
> -<br>
> /// ArgStringMap - Type used to map a JobAction to its result file.<br>
> typedef llvm::DenseMap<const JobAction*, const char*> ArgStringMap;<br>
><br>
><br>
> Modified: cfe/trunk/include/clang/Frontend/CompilerInvocation.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/CompilerInvocation.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Frontend/CompilerInvocation.h (original)<br>
> +++ cfe/trunk/include/clang/Frontend/CompilerInvocation.h Fri Jun 14 12:17:23 2013<br>
> @@ -29,13 +29,20 @@<br>
> #include <string><br>
> #include <vector><br>
><br>
> +namespace llvm {<br>
> +namespace opt {<br>
> +class ArgList;<br>
> +}<br>
> +}<br>
> +<br>
> namespace clang {<br>
><br>
> class CompilerInvocation;<br>
> class DiagnosticsEngine;<br>
><br>
> namespace driver {<br>
> -class ArgList;<br>
> + // FIXME: Remove this using directive and qualify class usage below.<br>
> + using namespace llvm::opt;<br>
> }<br>
><br>
> /// \brief Fill out Opts based on the options given in Args.<br>
><br>
> Modified: cfe/trunk/include/clang/Frontend/Utils.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/Utils.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/Utils.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/include/clang/Frontend/Utils.h (original)<br>
> +++ cfe/trunk/include/clang/Frontend/Utils.h Fri Jun 14 12:17:23 2013<br>
> @@ -17,10 +17,15 @@<br>
> #include "clang/Basic/Diagnostic.h"<br>
> #include "llvm/ADT/IntrusiveRefCntPtr.h"<br>
> #include "llvm/ADT/StringRef.h"<br>
> +#include "llvm/Option/OptSpecifier.h"<br>
><br>
> namespace llvm {<br>
> class raw_fd_ostream;<br>
> class Triple;<br>
> +<br>
> +namespace opt {<br>
> +class ArgList;<br>
> +}<br>
> }<br>
><br>
> namespace clang {<br>
> @@ -104,6 +109,18 @@ createInvocationFromCommandLine(ArrayRef<br>
> IntrusiveRefCntPtr<DiagnosticsEngine> Diags =<br>
> IntrusiveRefCntPtr<DiagnosticsEngine>());<br>
><br>
> -} // end namespace clang<br>
> +/// Return the value of the last argument as an integer, or a default. If Diags<br>
> +/// is non-null, emits an error if the argument is given, but non-integral.<br>
> +int getLastArgIntValue(const llvm::opt::ArgList &Args,<br>
> + llvm::opt::OptSpecifier Id, int Default,<br>
> + DiagnosticsEngine *Diags = 0);<br>
> +<br>
> +inline int getLastArgIntValue(const llvm::opt::ArgList &Args,<br>
> + llvm::opt::OptSpecifier Id, int Default,<br>
> + DiagnosticsEngine &Diags) {<br>
> + return getLastArgIntValue(Args, Id, Default, &Diags);<br>
> +}<br>
> +<br>
> +} // end namespace clang<br>
><br>
> #endif<br>
><br>
> Modified: cfe/trunk/lib/Driver/Action.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Action.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/Action.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/Action.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -11,6 +11,7 @@<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> #include <cassert><br>
> using namespace clang::driver;<br>
> +using namespace llvm::opt;<br>
><br>
> Action::~Action() {<br>
> if (OwnsInputs) {<br>
><br>
> Removed: cfe/trunk/lib/Driver/Arg.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Arg.cpp?rev=183988&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Arg.cpp?rev=183988&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/Arg.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/Arg.cpp (removed)<br>
> @@ -1,123 +0,0 @@<br>
> -//===--- Arg.cpp - Argument Implementations -------------------------------===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Basic/LLVM.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> -#include "clang/Driver/Option.h"<br>
> -#include "llvm/ADT/SmallString.h"<br>
> -#include "llvm/ADT/Twine.h"<br>
> -#include "llvm/Support/raw_ostream.h"<br>
> -<br>
> -using namespace clang::driver;<br>
> -using clang::StringRef;<br>
> -<br>
> -Arg::Arg(const Option _Opt, StringRef S, unsigned _Index, const Arg *_BaseArg)<br>
> - : Opt(_Opt), BaseArg(_BaseArg), Spelling(S), Index(_Index),<br>
> - Claimed(false), OwnsValues(false) {<br>
> -}<br>
> -<br>
> -Arg::Arg(const Option _Opt, StringRef S, unsigned _Index,<br>
> - const char *Value0, const Arg *_BaseArg)<br>
> - : Opt(_Opt), BaseArg(_BaseArg), Spelling(S), Index(_Index),<br>
> - Claimed(false), OwnsValues(false) {<br>
> - Values.push_back(Value0);<br>
> -}<br>
> -<br>
> -Arg::Arg(const Option _Opt, StringRef S, unsigned _Index,<br>
> - const char *Value0, const char *Value1, const Arg *_BaseArg)<br>
> - : Opt(_Opt), BaseArg(_BaseArg), Spelling(S), Index(_Index),<br>
> - Claimed(false), OwnsValues(false) {<br>
> - Values.push_back(Value0);<br>
> - Values.push_back(Value1);<br>
> -}<br>
> -<br>
> -Arg::~Arg() {<br>
> - if (OwnsValues) {<br>
> - for (unsigned i = 0, e = Values.size(); i != e; ++i)<br>
> - delete[] Values[i];<br>
> - }<br>
> -}<br>
> -<br>
> -void Arg::dump() const {<br>
> - llvm::errs() << "<";<br>
> -<br>
> - llvm::errs() << " Opt:";<br>
> - Opt.dump();<br>
> -<br>
> - llvm::errs() << " Index:" << Index;<br>
> -<br>
> - llvm::errs() << " Values: [";<br>
> - for (unsigned i = 0, e = Values.size(); i != e; ++i) {<br>
> - if (i) llvm::errs() << ", ";<br>
> - llvm::errs() << "'" << Values[i] << "'";<br>
> - }<br>
> -<br>
> - llvm::errs() << "]>\n";<br>
> -}<br>
> -<br>
> -std::string Arg::getAsString(const ArgList &Args) const {<br>
> - SmallString<256> Res;<br>
> - llvm::raw_svector_ostream OS(Res);<br>
> -<br>
> - ArgStringList ASL;<br>
> - render(Args, ASL);<br>
> - for (ArgStringList::iterator<br>
> - it = ASL.begin(), ie = ASL.end(); it != ie; ++it) {<br>
> - if (it != ASL.begin())<br>
> - OS << ' ';<br>
> - OS << *it;<br>
> - }<br>
> -<br>
> - return OS.str();<br>
> -}<br>
> -<br>
> -void Arg::renderAsInput(const ArgList &Args, ArgStringList &Output) const {<br>
> - if (!getOption().hasNoOptAsInput()) {<br>
> - render(Args, Output);<br>
> - return;<br>
> - }<br>
> -<br>
> - for (unsigned i = 0, e = getNumValues(); i != e; ++i)<br>
> - Output.push_back(getValue(i));<br>
> -}<br>
> -<br>
> -void Arg::render(const ArgList &Args, ArgStringList &Output) const {<br>
> - switch (getOption().getRenderStyle()) {<br>
> - case Option::RenderValuesStyle:<br>
> - for (unsigned i = 0, e = getNumValues(); i != e; ++i)<br>
> - Output.push_back(getValue(i));<br>
> - break;<br>
> -<br>
> - case Option::RenderCommaJoinedStyle: {<br>
> - SmallString<256> Res;<br>
> - llvm::raw_svector_ostream OS(Res);<br>
> - OS << getSpelling();<br>
> - for (unsigned i = 0, e = getNumValues(); i != e; ++i) {<br>
> - if (i) OS << ',';<br>
> - OS << getValue(i);<br>
> - }<br>
> - Output.push_back(Args.MakeArgString(OS.str()));<br>
> - break;<br>
> - }<br>
> -<br>
> - case Option::RenderJoinedStyle:<br>
> - Output.push_back(Args.GetOrMakeJoinedArgString(<br>
> - getIndex(), getSpelling(), getValue(0)));<br>
> - for (unsigned i = 1, e = getNumValues(); i != e; ++i)<br>
> - Output.push_back(getValue(i));<br>
> - break;<br>
> -<br>
> - case Option::RenderSeparateStyle:<br>
> - Output.push_back(Args.MakeArgString(getSpelling()));<br>
> - for (unsigned i = 0, e = getNumValues(); i != e; ++i)<br>
> - Output.push_back(getValue(i));<br>
> - break;<br>
> - }<br>
> -}<br>
><br>
> Removed: cfe/trunk/lib/Driver/ArgList.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=183988&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=183988&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/ArgList.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/ArgList.cpp (removed)<br>
> @@ -1,422 +0,0 @@<br>
> -//===--- ArgList.cpp - Argument List Management ---------------------------===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#include "clang/Driver/ArgList.h"<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/DriverDiagnostic.h"<br>
> -#include "clang/Driver/Option.h"<br>
> -#include "llvm/ADT/SmallString.h"<br>
> -#include "llvm/ADT/Twine.h"<br>
> -#include "llvm/Support/raw_ostream.h"<br>
> -<br>
> -using namespace clang;<br>
> -using namespace clang::driver;<br>
> -<br>
> -void arg_iterator::SkipToNextArg() {<br>
> - for (; Current != Args.end(); ++Current) {<br>
> - // Done if there are no filters.<br>
> - if (!Id0.isValid())<br>
> - break;<br>
> -<br>
> - // Otherwise require a match.<br>
> - const Option &O = (*Current)->getOption();<br>
> - if (O.matches(Id0) ||<br>
> - (Id1.isValid() && O.matches(Id1)) ||<br>
> - (Id2.isValid() && O.matches(Id2)))<br>
> - break;<br>
> - }<br>
> -}<br>
> -<br>
> -//<br>
> -<br>
> -ArgList::ArgList() {<br>
> -}<br>
> -<br>
> -ArgList::~ArgList() {<br>
> -}<br>
> -<br>
> -void ArgList::append(Arg *A) {<br>
> - Args.push_back(A);<br>
> -}<br>
> -<br>
> -void ArgList::eraseArg(OptSpecifier Id) {<br>
> - for (iterator it = begin(), ie = end(); it != ie; ) {<br>
> - if ((*it)->getOption().matches(Id)) {<br>
> - it = Args.erase(it);<br>
> - ie = end();<br>
> - } else {<br>
> - ++it;<br>
> - }<br>
> - }<br>
> -}<br>
> -<br>
> -Arg *ArgList::getLastArgNoClaim(OptSpecifier Id) const {<br>
> - // FIXME: Make search efficient?<br>
> - for (const_reverse_iterator it = rbegin(), ie = rend(); it != ie; ++it)<br>
> - if ((*it)->getOption().matches(Id))<br>
> - return *it;<br>
> - return 0;<br>
> -}<br>
> -<br>
> -Arg *ArgList::getLastArg(OptSpecifier Id) const {<br>
> - Arg *Res = 0;<br>
> - for (const_iterator it = begin(), ie = end(); it != ie; ++it) {<br>
> - if ((*it)->getOption().matches(Id)) {<br>
> - Res = *it;<br>
> - Res->claim();<br>
> - }<br>
> - }<br>
> -<br>
> - return Res;<br>
> -}<br>
> -<br>
> -Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1) const {<br>
> - Arg *Res = 0;<br>
> - for (const_iterator it = begin(), ie = end(); it != ie; ++it) {<br>
> - if ((*it)->getOption().matches(Id0) ||<br>
> - (*it)->getOption().matches(Id1)) {<br>
> - Res = *it;<br>
> - Res->claim();<br>
> - }<br>
> - }<br>
> -<br>
> - return Res;<br>
> -}<br>
> -<br>
> -Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,<br>
> - OptSpecifier Id2) const {<br>
> - Arg *Res = 0;<br>
> - for (const_iterator it = begin(), ie = end(); it != ie; ++it) {<br>
> - if ((*it)->getOption().matches(Id0) ||<br>
> - (*it)->getOption().matches(Id1) ||<br>
> - (*it)->getOption().matches(Id2)) {<br>
> - Res = *it;<br>
> - Res->claim();<br>
> - }<br>
> - }<br>
> -<br>
> - return Res;<br>
> -}<br>
> -<br>
> -Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,<br>
> - OptSpecifier Id2, OptSpecifier Id3) const {<br>
> - Arg *Res = 0;<br>
> - for (const_iterator it = begin(), ie = end(); it != ie; ++it) {<br>
> - if ((*it)->getOption().matches(Id0) ||<br>
> - (*it)->getOption().matches(Id1) ||<br>
> - (*it)->getOption().matches(Id2) ||<br>
> - (*it)->getOption().matches(Id3)) {<br>
> - Res = *it;<br>
> - Res->claim();<br>
> - }<br>
> - }<br>
> -<br>
> - return Res;<br>
> -}<br>
> -<br>
> -Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,<br>
> - OptSpecifier Id2, OptSpecifier Id3,<br>
> - OptSpecifier Id4) const {<br>
> - Arg *Res = 0;<br>
> - for (const_iterator it = begin(), ie = end(); it != ie; ++it) {<br>
> - if ((*it)->getOption().matches(Id0) ||<br>
> - (*it)->getOption().matches(Id1) ||<br>
> - (*it)->getOption().matches(Id2) ||<br>
> - (*it)->getOption().matches(Id3) ||<br>
> - (*it)->getOption().matches(Id4)) {<br>
> - Res = *it;<br>
> - Res->claim();<br>
> - }<br>
> - }<br>
> -<br>
> - return Res;<br>
> -}<br>
> -<br>
> -Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,<br>
> - OptSpecifier Id2, OptSpecifier Id3,<br>
> - OptSpecifier Id4, OptSpecifier Id5) const {<br>
> - Arg *Res = 0;<br>
> - for (const_iterator it = begin(), ie = end(); it != ie; ++it) {<br>
> - if ((*it)->getOption().matches(Id0) ||<br>
> - (*it)->getOption().matches(Id1) ||<br>
> - (*it)->getOption().matches(Id2) ||<br>
> - (*it)->getOption().matches(Id3) ||<br>
> - (*it)->getOption().matches(Id4) ||<br>
> - (*it)->getOption().matches(Id5)) {<br>
> - Res = *it;<br>
> - Res->claim();<br>
> - }<br>
> - }<br>
> -<br>
> - return Res;<br>
> -}<br>
> -<br>
> -Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,<br>
> - OptSpecifier Id2, OptSpecifier Id3,<br>
> - OptSpecifier Id4, OptSpecifier Id5,<br>
> - OptSpecifier Id6) const {<br>
> - Arg *Res = 0;<br>
> - for (const_iterator it = begin(), ie = end(); it != ie; ++it) {<br>
> - if ((*it)->getOption().matches(Id0) ||<br>
> - (*it)->getOption().matches(Id1) ||<br>
> - (*it)->getOption().matches(Id2) ||<br>
> - (*it)->getOption().matches(Id3) ||<br>
> - (*it)->getOption().matches(Id4) ||<br>
> - (*it)->getOption().matches(Id5) ||<br>
> - (*it)->getOption().matches(Id6)) {<br>
> - Res = *it;<br>
> - Res->claim();<br>
> - }<br>
> - }<br>
> -<br>
> - return Res;<br>
> -}<br>
> -<br>
> -Arg *ArgList::getLastArg(OptSpecifier Id0, OptSpecifier Id1,<br>
> - OptSpecifier Id2, OptSpecifier Id3,<br>
> - OptSpecifier Id4, OptSpecifier Id5,<br>
> - OptSpecifier Id6, OptSpecifier Id7) const {<br>
> - Arg *Res = 0;<br>
> - for (const_iterator it = begin(), ie = end(); it != ie; ++it) {<br>
> - if ((*it)->getOption().matches(Id0) ||<br>
> - (*it)->getOption().matches(Id1) ||<br>
> - (*it)->getOption().matches(Id2) ||<br>
> - (*it)->getOption().matches(Id3) ||<br>
> - (*it)->getOption().matches(Id4) ||<br>
> - (*it)->getOption().matches(Id5) ||<br>
> - (*it)->getOption().matches(Id6) ||<br>
> - (*it)->getOption().matches(Id7)) {<br>
> - Res = *it;<br>
> - Res->claim();<br>
> - }<br>
> - }<br>
> -<br>
> - return Res;<br>
> -}<br>
> -<br>
> -bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default) const {<br>
> - if (Arg *A = getLastArg(Pos, Neg))<br>
> - return A->getOption().matches(Pos);<br>
> - return Default;<br>
> -}<br>
> -<br>
> -bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier PosAlias, OptSpecifier Neg,<br>
> - bool Default) const {<br>
> - if (Arg *A = getLastArg(Pos, PosAlias, Neg))<br>
> - return A->getOption().matches(Pos) || A->getOption().matches(PosAlias);<br>
> - return Default;<br>
> -}<br>
> -<br>
> -StringRef ArgList::getLastArgValue(OptSpecifier Id,<br>
> - StringRef Default) const {<br>
> - if (Arg *A = getLastArg(Id))<br>
> - return A->getValue();<br>
> - return Default;<br>
> -}<br>
> -<br>
> -int ArgList::getLastArgIntValue(OptSpecifier Id, int Default,<br>
> - clang::DiagnosticsEngine *Diags) const {<br>
> - int Res = Default;<br>
> -<br>
> - if (Arg *A = getLastArg(Id)) {<br>
> - if (StringRef(A->getValue()).getAsInteger(10, Res)) {<br>
> - if (Diags)<br>
> - Diags->Report(diag::err_drv_invalid_int_value)<br>
> - << A->getAsString(*this) << A->getValue();<br>
> - }<br>
> - }<br>
> -<br>
> - return Res;<br>
> -}<br>
> -<br>
> -std::vector<std::string> ArgList::getAllArgValues(OptSpecifier Id) const {<br>
> - SmallVector<const char *, 16> Values;<br>
> - AddAllArgValues(Values, Id);<br>
> - return std::vector<std::string>(Values.begin(), Values.end());<br>
> -}<br>
> -<br>
> -void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id) const {<br>
> - if (Arg *A = getLastArg(Id)) {<br>
> - A->claim();<br>
> - A->render(*this, Output);<br>
> - }<br>
> -}<br>
> -<br>
> -void ArgList::AddLastArg(ArgStringList &Output, OptSpecifier Id0,<br>
> - OptSpecifier Id1) const {<br>
> - if (Arg *A = getLastArg(Id0, Id1)) {<br>
> - A->claim();<br>
> - A->render(*this, Output);<br>
> - }<br>
> -}<br>
> -<br>
> -void ArgList::AddAllArgs(ArgStringList &Output, OptSpecifier Id0,<br>
> - OptSpecifier Id1, OptSpecifier Id2) const {<br>
> - for (arg_iterator it = filtered_begin(Id0, Id1, Id2),<br>
> - ie = filtered_end(); it != ie; ++it) {<br>
> - (*it)->claim();<br>
> - (*it)->render(*this, Output);<br>
> - }<br>
> -}<br>
> -<br>
> -void ArgList::AddAllArgValues(ArgStringList &Output, OptSpecifier Id0,<br>
> - OptSpecifier Id1, OptSpecifier Id2) const {<br>
> - for (arg_iterator it = filtered_begin(Id0, Id1, Id2),<br>
> - ie = filtered_end(); it != ie; ++it) {<br>
> - (*it)->claim();<br>
> - for (unsigned i = 0, e = (*it)->getNumValues(); i != e; ++i)<br>
> - Output.push_back((*it)->getValue(i));<br>
> - }<br>
> -}<br>
> -<br>
> -void ArgList::AddAllArgsTranslated(ArgStringList &Output, OptSpecifier Id0,<br>
> - const char *Translation,<br>
> - bool Joined) const {<br>
> - for (arg_iterator it = filtered_begin(Id0),<br>
> - ie = filtered_end(); it != ie; ++it) {<br>
> - (*it)->claim();<br>
> -<br>
> - if (Joined) {<br>
> - Output.push_back(MakeArgString(StringRef(Translation) +<br>
> - (*it)->getValue(0)));<br>
> - } else {<br>
> - Output.push_back(Translation);<br>
> - Output.push_back((*it)->getValue(0));<br>
> - }<br>
> - }<br>
> -}<br>
> -<br>
> -void ArgList::ClaimAllArgs(OptSpecifier Id0) const {<br>
> - for (arg_iterator it = filtered_begin(Id0),<br>
> - ie = filtered_end(); it != ie; ++it)<br>
> - (*it)->claim();<br>
> -}<br>
> -<br>
> -void ArgList::ClaimAllArgs() const {<br>
> - for (const_iterator it = begin(), ie = end(); it != ie; ++it)<br>
> - if (!(*it)->isClaimed())<br>
> - (*it)->claim();<br>
> -}<br>
> -<br>
> -const char *ArgList::MakeArgString(const Twine &T) const {<br>
> - SmallString<256> Str;<br>
> - T.toVector(Str);<br>
> - return MakeArgString(Str.str());<br>
> -}<br>
> -<br>
> -const char *ArgList::GetOrMakeJoinedArgString(unsigned Index,<br>
> - StringRef LHS,<br>
> - StringRef RHS) const {<br>
> - StringRef Cur = getArgString(Index);<br>
> - if (Cur.size() == LHS.size() + RHS.size() &&<br>
> - Cur.startswith(LHS) && Cur.endswith(RHS))<br>
> - return Cur.data();<br>
> -<br>
> - return MakeArgString(LHS + RHS);<br>
> -}<br>
> -<br>
> -void ArgList::dump() const {<br>
> - llvm::errs() << "ArgList:";<br>
> - for (const_iterator it = begin(), ie = end(); it != ie; ++it)<br>
> - llvm::errs() << " " << (*it)->getSpelling();<br>
> - llvm::errs() << "\n";<br>
> -}<br>
> -<br>
> -//<br>
> -<br>
> -InputArgList::InputArgList(const char* const *ArgBegin,<br>
> - const char* const *ArgEnd)<br>
> - : NumInputArgStrings(ArgEnd - ArgBegin) {<br>
> - ArgStrings.append(ArgBegin, ArgEnd);<br>
> -}<br>
> -<br>
> -InputArgList::~InputArgList() {<br>
> - // An InputArgList always owns its arguments.<br>
> - for (iterator it = begin(), ie = end(); it != ie; ++it)<br>
> - delete *it;<br>
> -}<br>
> -<br>
> -unsigned InputArgList::MakeIndex(StringRef String0) const {<br>
> - unsigned Index = ArgStrings.size();<br>
> -<br>
> - // Tuck away so we have a reliable const char *.<br>
> - SynthesizedStrings.push_back(String0);<br>
> - ArgStrings.push_back(SynthesizedStrings.back().c_str());<br>
> -<br>
> - return Index;<br>
> -}<br>
> -<br>
> -unsigned InputArgList::MakeIndex(StringRef String0,<br>
> - StringRef String1) const {<br>
> - unsigned Index0 = MakeIndex(String0);<br>
> - unsigned Index1 = MakeIndex(String1);<br>
> - assert(Index0 + 1 == Index1 && "Unexpected non-consecutive indices!");<br>
> - (void) Index1;<br>
> - return Index0;<br>
> -}<br>
> -<br>
> -const char *InputArgList::MakeArgString(StringRef Str) const {<br>
> - return getArgString(MakeIndex(Str));<br>
> -}<br>
> -<br>
> -//<br>
> -<br>
> -DerivedArgList::DerivedArgList(const InputArgList &_BaseArgs)<br>
> - : BaseArgs(_BaseArgs) {<br>
> -}<br>
> -<br>
> -DerivedArgList::~DerivedArgList() {<br>
> - // We only own the arguments we explicitly synthesized.<br>
> - for (iterator it = SynthesizedArgs.begin(), ie = SynthesizedArgs.end();<br>
> - it != ie; ++it)<br>
> - delete *it;<br>
> -}<br>
> -<br>
> -const char *DerivedArgList::MakeArgString(StringRef Str) const {<br>
> - return BaseArgs.MakeArgString(Str);<br>
> -}<br>
> -<br>
> -Arg *DerivedArgList::MakeFlagArg(const Arg *BaseArg, const Option Opt) const {<br>
> - Arg *A = new Arg(Opt, ArgList::MakeArgString(Twine(Opt.getPrefix()) +<br>
> - Twine(Opt.getName())),<br>
> - BaseArgs.MakeIndex(Opt.getName()), BaseArg);<br>
> - SynthesizedArgs.push_back(A);<br>
> - return A;<br>
> -}<br>
> -<br>
> -Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option Opt,<br>
> - StringRef Value) const {<br>
> - unsigned Index = BaseArgs.MakeIndex(Value);<br>
> - Arg *A = new Arg(Opt, ArgList::MakeArgString(Twine(Opt.getPrefix()) +<br>
> - Twine(Opt.getName())),<br>
> - Index, BaseArgs.getArgString(Index), BaseArg);<br>
> - SynthesizedArgs.push_back(A);<br>
> - return A;<br>
> -}<br>
> -<br>
> -Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option Opt,<br>
> - StringRef Value) const {<br>
> - unsigned Index = BaseArgs.MakeIndex(Opt.getName(), Value);<br>
> - Arg *A = new Arg(Opt, ArgList::MakeArgString(Twine(Opt.getPrefix()) +<br>
> - Twine(Opt.getName())),<br>
> - Index, BaseArgs.getArgString(Index + 1), BaseArg);<br>
> - SynthesizedArgs.push_back(A);<br>
> - return A;<br>
> -}<br>
> -<br>
> -Arg *DerivedArgList::MakeJoinedArg(const Arg *BaseArg, const Option Opt,<br>
> - StringRef Value) const {<br>
> - unsigned Index = BaseArgs.MakeIndex(Opt.getName().str() + Value.str());<br>
> - Arg *A = new Arg(Opt, ArgList::MakeArgString(Twine(Opt.getPrefix()) +<br>
> - Twine(Opt.getName())), Index,<br>
> - BaseArgs.getArgString(Index) + Opt.getName().size(),<br>
> - BaseArg);<br>
> - SynthesizedArgs.push_back(A);<br>
> - return A;<br>
> -}<br>
><br>
> Modified: cfe/trunk/lib/Driver/CC1AsOptions.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CC1AsOptions.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CC1AsOptions.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/CC1AsOptions.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/CC1AsOptions.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -8,11 +8,11 @@<br>
> //===----------------------------------------------------------------------===//<br>
><br>
> #include "clang/Driver/CC1AsOptions.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> -#include "clang/Driver/Option.h"<br>
> +#include "llvm/Option/OptTable.h"<br>
> +#include "llvm/Option/Option.h"<br>
> using namespace clang;<br>
> using namespace clang::driver;<br>
> -using namespace clang::driver::options;<br>
> +using namespace llvm::opt;<br>
> using namespace clang::driver::cc1asoptions;<br>
><br>
> #define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;<br>
><br>
> Modified: cfe/trunk/lib/Driver/CMakeLists.txt<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/CMakeLists.txt?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/CMakeLists.txt (original)<br>
> +++ cfe/trunk/lib/Driver/CMakeLists.txt Fri Jun 14 12:17:23 2013<br>
> @@ -1,14 +1,10 @@<br>
> add_clang_library(clangDriver<br>
> Action.cpp<br>
> - Arg.cpp<br>
> - ArgList.cpp<br>
> CC1AsOptions.cpp<br>
> Compilation.cpp<br>
> Driver.cpp<br>
> DriverOptions.cpp<br>
> Job.cpp<br>
> - Option.cpp<br>
> - OptTable.cpp<br>
> Phases.cpp<br>
> Tool.cpp<br>
> ToolChain.cpp<br>
> @@ -28,4 +24,5 @@ add_dependencies(clangDriver<br>
><br>
> target_link_libraries(clangDriver<br>
> clangBasic<br>
> + LLVMOption<br>
> )<br>
><br>
> Modified: cfe/trunk/lib/Driver/Compilation.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/Compilation.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/Compilation.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -9,13 +9,13 @@<br>
><br>
> #include "clang/Driver/Compilation.h"<br>
> #include "clang/Driver/Action.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/Driver.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "clang/Driver/ToolChain.h"<br>
> #include "llvm/ADT/STLExtras.h"<br>
> #include "llvm/ADT/StringSwitch.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> #include "llvm/Support/Program.h"<br>
> #include "llvm/Support/raw_ostream.h"<br>
> #include <errno.h><br>
> @@ -23,6 +23,7 @@<br>
><br>
> using namespace clang::driver;<br>
> using namespace clang;<br>
> +using namespace llvm::opt;<br>
><br>
> Compilation::Compilation(const Driver &D, const ToolChain &_DefaultToolChain,<br>
> InputArgList *_Args, DerivedArgList *_TranslatedArgs)<br>
><br>
> Modified: cfe/trunk/lib/Driver/Driver.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/Driver.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/Driver.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -12,19 +12,20 @@<br>
> #include "ToolChains.h"<br>
> #include "clang/Basic/Version.h"<br>
> #include "clang/Driver/Action.h"<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/Compilation.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> #include "clang/Driver/Job.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> -#include "clang/Driver/Option.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "clang/Driver/Tool.h"<br>
> #include "clang/Driver/ToolChain.h"<br>
> #include "llvm/ADT/ArrayRef.h"<br>
> #include "llvm/ADT/OwningPtr.h"<br>
> #include "llvm/ADT/StringSet.h"<br>
> +#include "llvm/Option/Arg.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> +#include "llvm/Option/OptTable.h"<br>
> +#include "llvm/Option/Option.h"<br>
> +#include "llvm/Option/OptSpecifier.h"<br>
> #include "llvm/Support/Debug.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> #include "llvm/Support/FileSystem.h"<br>
> @@ -40,6 +41,7 @@<br>
><br>
> using namespace clang::driver;<br>
> using namespace clang;<br>
> +using namespace llvm::opt;<br>
><br>
> Driver::Driver(StringRef ClangExecutable,<br>
> StringRef DefaultTargetTriple,<br>
> @@ -579,10 +581,9 @@ void Driver::PrintOptions(const ArgList<br>
> }<br>
><br>
> void Driver::PrintHelp(bool ShowHidden) const {<br>
> - getOpts().PrintHelp(llvm::outs(), Name.c_str(), DriverTitle.c_str(),<br>
> - /*Include*/0,<br>
> - /*Exclude*/options::NoDriverOption |<br>
> - (ShowHidden ? 0 : options::HelpHidden));<br>
> + getOpts().PrintHelp(<br>
> + llvm::outs(), Name.c_str(), DriverTitle.c_str(), /*Include*/ 0,<br>
> + /*Exclude*/ options::NoDriverOption | (ShowHidden ? 0 : HelpHidden));<br>
> }<br>
><br>
> void Driver::PrintVersion(const Compilation &C, raw_ostream &OS) const {<br>
><br>
> Modified: cfe/trunk/lib/Driver/DriverOptions.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/DriverOptions.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/DriverOptions.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/DriverOptions.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/DriverOptions.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -8,11 +8,12 @@<br>
> //===----------------------------------------------------------------------===//<br>
><br>
> #include "clang/Driver/Options.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> -#include "clang/Driver/Option.h"<br>
> +#include "llvm/Option/OptTable.h"<br>
> +#include "llvm/Option/Option.h"<br>
><br>
> using namespace clang::driver;<br>
> using namespace clang::driver::options;<br>
> +using namespace llvm::opt;<br>
><br>
> #define PREFIX(NAME, VALUE) const char *const NAME[] = VALUE;<br>
> #define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \<br>
><br>
> Modified: cfe/trunk/lib/Driver/InputInfo.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/InputInfo.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/InputInfo.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/InputInfo.h (original)<br>
> +++ cfe/trunk/lib/Driver/InputInfo.h Fri Jun 14 12:17:23 2013<br>
> @@ -10,8 +10,8 @@<br>
> #ifndef CLANG_LIB_DRIVER_INPUTINFO_H_<br>
> #define CLANG_LIB_DRIVER_INPUTINFO_H_<br>
><br>
> -#include "clang/Driver/Arg.h"<br>
> #include "clang/Driver/Types.h"<br>
> +#include "llvm/Option/Arg.h"<br>
> #include <cassert><br>
> #include <string><br>
><br>
><br>
> Modified: cfe/trunk/lib/Driver/Job.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Job.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/Job.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/Job.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -17,11 +17,10 @@ Job::~Job() {}<br>
> void Command::anchor() {}<br>
><br>
> Command::Command(const Action &_Source, const Tool &_Creator,<br>
> - const char *_Executable, const ArgStringList &_Arguments)<br>
> - : Job(CommandClass), Source(_Source), Creator(_Creator),<br>
> - Executable(_Executable), Arguments(_Arguments)<br>
> -{<br>
> -}<br>
> + const char *_Executable,<br>
> + const llvm::opt::ArgStringList &_Arguments)<br>
> + : Job(CommandClass), Source(_Source), Creator(_Creator),<br>
> + Executable(_Executable), Arguments(_Arguments) {}<br>
><br>
> JobList::JobList() : Job(JobListClass) {}<br>
><br>
><br>
> Removed: cfe/trunk/lib/Driver/OptTable.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/OptTable.cpp?rev=183988&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/OptTable.cpp?rev=183988&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/OptTable.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/OptTable.cpp (removed)<br>
> @@ -1,388 +0,0 @@<br>
> -//===--- OptTable.cpp - Option Table Implementation -----------------------===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#include "clang/Driver/OptTable.h"<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> -#include "clang/Driver/Option.h"<br>
> -#include "clang/Driver/Options.h"<br>
> -#include "llvm/Support/ErrorHandling.h"<br>
> -#include "llvm/Support/raw_ostream.h"<br>
> -#include <algorithm><br>
> -#include <map><br>
> -using namespace clang::driver;<br>
> -using namespace clang::driver::options;<br>
> -using namespace clang;<br>
> -<br>
> -// Ordering on Info. The ordering is *almost* lexicographic, with two<br>
> -// exceptions. First, '\0' comes at the end of the alphabet instead of<br>
> -// the beginning (thus options precede any other options which prefix<br>
> -// them). Second, for options with the same name, the less permissive<br>
> -// version should come first; a Flag option should precede a Joined<br>
> -// option, for example.<br>
> -<br>
> -static int StrCmpOptionName(const char *A, const char *B) {<br>
> - char a = *A, b = *B;<br>
> - while (a == b) {<br>
> - if (a == '\0')<br>
> - return 0;<br>
> -<br>
> - a = *++A;<br>
> - b = *++B;<br>
> - }<br>
> -<br>
> - if (a == '\0') // A is a prefix of B.<br>
> - return 1;<br>
> - if (b == '\0') // B is a prefix of A.<br>
> - return -1;<br>
> -<br>
> - // Otherwise lexicographic.<br>
> - return (a < b) ? -1 : 1;<br>
> -}<br>
> -<br>
> -namespace clang {<br>
> -namespace driver {<br>
> -static inline bool operator<(const OptTable::Info &A, const OptTable::Info &B) {<br>
> - if (&A == &B)<br>
> - return false;<br>
> -<br>
> - if (int N = StrCmpOptionName(A.Name, B.Name))<br>
> - return N == -1;<br>
> -<br>
> - for (const char * const *APre = A.Prefixes,<br>
> - * const *BPre = B.Prefixes;<br>
> - *APre != 0 && *BPre != 0; ++APre, ++BPre) {<br>
> - if (int N = StrCmpOptionName(*APre, *BPre))<br>
> - return N == -1;<br>
> - }<br>
> -<br>
> - // Names are the same, check that classes are in order; exactly one<br>
> - // should be joined, and it should succeed the other.<br>
> - assert(((A.Kind == Option::JoinedClass) ^ (B.Kind == Option::JoinedClass)) &&<br>
> - "Unexpected classes for options with same name.");<br>
> - return B.Kind == Option::JoinedClass;<br>
> -}<br>
> -<br>
> -// Support lower_bound between info and an option name.<br>
> -static inline bool operator<(const OptTable::Info &I, const char *Name) {<br>
> - return StrCmpOptionName(I.Name, Name) == -1;<br>
> -}<br>
> -static inline bool operator<(const char *Name, const OptTable::Info &I) {<br>
> - return StrCmpOptionName(Name, I.Name) == -1;<br>
> -}<br>
> -}<br>
> -}<br>
> -<br>
> -//<br>
> -<br>
> -OptSpecifier::OptSpecifier(const Option *Opt) : ID(Opt->getID()) {}<br>
> -<br>
> -//<br>
> -<br>
> -OptTable::OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos)<br>
> - : OptionInfos(_OptionInfos),<br>
> - NumOptionInfos(_NumOptionInfos),<br>
> - TheInputOptionID(0),<br>
> - TheUnknownOptionID(0),<br>
> - FirstSearchableIndex(0)<br>
> -{<br>
> - // Explicitly zero initialize the error to work around a bug in array<br>
> - // value-initialization on MinGW with gcc 4.3.5.<br>
> -<br>
> - // Find start of normal options.<br>
> - for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {<br>
> - unsigned Kind = getInfo(i + 1).Kind;<br>
> - if (Kind == Option::InputClass) {<br>
> - assert(!TheInputOptionID && "Cannot have multiple input options!");<br>
> - TheInputOptionID = getInfo(i + 1).ID;<br>
> - } else if (Kind == Option::UnknownClass) {<br>
> - assert(!TheUnknownOptionID && "Cannot have multiple unknown options!");<br>
> - TheUnknownOptionID = getInfo(i + 1).ID;<br>
> - } else if (Kind != Option::GroupClass) {<br>
> - FirstSearchableIndex = i;<br>
> - break;<br>
> - }<br>
> - }<br>
> - assert(FirstSearchableIndex != 0 && "No searchable options?");<br>
> -<br>
> -#ifndef NDEBUG<br>
> - // Check that everything after the first searchable option is a<br>
> - // regular option class.<br>
> - for (unsigned i = FirstSearchableIndex, e = getNumOptions(); i != e; ++i) {<br>
> - Option::OptionClass Kind = (Option::OptionClass) getInfo(i + 1).Kind;<br>
> - assert((Kind != Option::InputClass && Kind != Option::UnknownClass &&<br>
> - Kind != Option::GroupClass) &&<br>
> - "Special options should be defined first!");<br>
> - }<br>
> -<br>
> - // Check that options are in order.<br>
> - for (unsigned i = FirstSearchableIndex+1, e = getNumOptions(); i != e; ++i) {<br>
> - if (!(getInfo(i) < getInfo(i + 1))) {<br>
> - getOption(i).dump();<br>
> - getOption(i + 1).dump();<br>
> - llvm_unreachable("Options are not in order!");<br>
> - }<br>
> - }<br>
> -#endif<br>
> -<br>
> - // Build prefixes.<br>
> - for (unsigned i = FirstSearchableIndex+1, e = getNumOptions(); i != e; ++i) {<br>
> - if (const char *const *P = getInfo(i).Prefixes) {<br>
> - for (; *P != 0; ++P) {<br>
> - PrefixesUnion.insert(*P);<br>
> - }<br>
> - }<br>
> - }<br>
> -<br>
> - // Build prefix chars.<br>
> - for (llvm::StringSet<>::const_iterator I = PrefixesUnion.begin(),<br>
> - E = PrefixesUnion.end(); I != E; ++I) {<br>
> - StringRef Prefix = I->getKey();<br>
> - for (StringRef::const_iterator C = Prefix.begin(), CE = Prefix.end();<br>
> - C != CE; ++C)<br>
> - if (std::find(PrefixChars.begin(), PrefixChars.end(), *C)<br>
> - == PrefixChars.end())<br>
> - PrefixChars.push_back(*C);<br>
> - }<br>
> -}<br>
> -<br>
> -OptTable::~OptTable() {<br>
> -}<br>
> -<br>
> -const Option OptTable::getOption(OptSpecifier Opt) const {<br>
> - unsigned id = Opt.getID();<br>
> - if (id == 0)<br>
> - return Option(0, 0);<br>
> - assert((unsigned) (id - 1) < getNumOptions() && "Invalid ID.");<br>
> - return Option(&getInfo(id), this);<br>
> -}<br>
> -<br>
> -static bool isInput(const llvm::StringSet<> &Prefixes, StringRef Arg) {<br>
> - if (Arg == "-")<br>
> - return true;<br>
> - for (llvm::StringSet<>::const_iterator I = Prefixes.begin(),<br>
> - E = Prefixes.end(); I != E; ++I)<br>
> - if (Arg.startswith(I->getKey()))<br>
> - return false;<br>
> - return true;<br>
> -}<br>
> -<br>
> -/// \returns Matched size. 0 means no match.<br>
> -static unsigned matchOption(const OptTable::Info *I, StringRef Str) {<br>
> - for (const char * const *Pre = I->Prefixes; *Pre != 0; ++Pre) {<br>
> - StringRef Prefix(*Pre);<br>
> - if (Str.startswith(Prefix) && Str.substr(Prefix.size()).startswith(I->Name))<br>
> - return Prefix.size() + StringRef(I->Name).size();<br>
> - }<br>
> - return 0;<br>
> -}<br>
> -<br>
> -Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index) const {<br>
> - unsigned Prev = Index;<br>
> - const char *Str = Args.getArgString(Index);<br>
> -<br>
> - // Anything that doesn't start with PrefixesUnion is an input, as is '-'<br>
> - // itself.<br>
> - if (isInput(PrefixesUnion, Str))<br>
> - return new Arg(getOption(TheInputOptionID), Str, Index++, Str);<br>
> -<br>
> - const Info *Start = OptionInfos + FirstSearchableIndex;<br>
> - const Info *End = OptionInfos + getNumOptions();<br>
> - StringRef Name = StringRef(Str).ltrim(PrefixChars);<br>
> -<br>
> - // Search for the first next option which could be a prefix.<br>
> - Start = std::lower_bound(Start, End, Name.data());<br>
> -<br>
> - // Options are stored in sorted order, with '\0' at the end of the<br>
> - // alphabet. Since the only options which can accept a string must<br>
> - // prefix it, we iteratively search for the next option which could<br>
> - // be a prefix.<br>
> - //<br>
> - // FIXME: This is searching much more than necessary, but I am<br>
> - // blanking on the simplest way to make it fast. We can solve this<br>
> - // problem when we move to TableGen.<br>
> - for (; Start != End; ++Start) {<br>
> - unsigned ArgSize = 0;<br>
> - // Scan for first option which is a proper prefix.<br>
> - for (; Start != End; ++Start)<br>
> - if ((ArgSize = matchOption(Start, Str)))<br>
> - break;<br>
> - if (Start == End)<br>
> - break;<br>
> -<br>
> - // See if this option matches.<br>
> - if (Arg *A = Option(Start, this).accept(Args, Index, ArgSize))<br>
> - return A;<br>
> -<br>
> - // Otherwise, see if this argument was missing values.<br>
> - if (Prev != Index)<br>
> - return 0;<br>
> - }<br>
> -<br>
> - return new Arg(getOption(TheUnknownOptionID), Str, Index++, Str);<br>
> -}<br>
> -<br>
> -InputArgList *OptTable::ParseArgs(const char* const *ArgBegin,<br>
> - const char* const *ArgEnd,<br>
> - unsigned &MissingArgIndex,<br>
> - unsigned &MissingArgCount) const {<br>
> - InputArgList *Args = new InputArgList(ArgBegin, ArgEnd);<br>
> -<br>
> - // FIXME: Handle '@' args (or at least error on them).<br>
> -<br>
> - MissingArgIndex = MissingArgCount = 0;<br>
> - unsigned Index = 0, End = ArgEnd - ArgBegin;<br>
> - while (Index < End) {<br>
> - // Ignore empty arguments (other things may still take them as arguments).<br>
> - if (Args->getArgString(Index)[0] == '\0') {<br>
> - ++Index;<br>
> - continue;<br>
> - }<br>
> -<br>
> - unsigned Prev = Index;<br>
> - Arg *A = ParseOneArg(*Args, Index);<br>
> - assert(Index > Prev && "Parser failed to consume argument.");<br>
> -<br>
> - // Check for missing argument error.<br>
> - if (!A) {<br>
> - assert(Index >= End && "Unexpected parser error.");<br>
> - assert(Index - Prev - 1 && "No missing arguments!");<br>
> - MissingArgIndex = Prev;<br>
> - MissingArgCount = Index - Prev - 1;<br>
> - break;<br>
> - }<br>
> -<br>
> - Args->append(A);<br>
> - }<br>
> -<br>
> - return Args;<br>
> -}<br>
> -<br>
> -static std::string getOptionHelpName(const OptTable &Opts, OptSpecifier Id) {<br>
> - const Option O = Opts.getOption(Id);<br>
> - std::string Name = O.getPrefixedName();<br>
> -<br>
> - // Add metavar, if used.<br>
> - switch (O.getKind()) {<br>
> - case Option::GroupClass: case Option::InputClass: case Option::UnknownClass:<br>
> - llvm_unreachable("Invalid option with help text.");<br>
> -<br>
> - case Option::MultiArgClass:<br>
> - llvm_unreachable("Cannot print metavar for this kind of option.");<br>
> -<br>
> - case Option::FlagClass:<br>
> - break;<br>
> -<br>
> - case Option::SeparateClass: case Option::JoinedOrSeparateClass:<br>
> - Name += ' ';<br>
> - // FALLTHROUGH<br>
> - case Option::JoinedClass: case Option::CommaJoinedClass:<br>
> - case Option::JoinedAndSeparateClass:<br>
> - if (const char *MetaVarName = Opts.getOptionMetaVar(Id))<br>
> - Name += MetaVarName;<br>
> - else<br>
> - Name += "<value>";<br>
> - break;<br>
> - }<br>
> -<br>
> - return Name;<br>
> -}<br>
> -<br>
> -static void PrintHelpOptionList(raw_ostream &OS, StringRef Title,<br>
> - std::vector<std::pair<std::string,<br>
> - const char*> > &OptionHelp) {<br>
> - OS << Title << ":\n";<br>
> -<br>
> - // Find the maximum option length.<br>
> - unsigned OptionFieldWidth = 0;<br>
> - for (unsigned i = 0, e = OptionHelp.size(); i != e; ++i) {<br>
> - // Skip titles.<br>
> - if (!OptionHelp[i].second)<br>
> - continue;<br>
> -<br>
> - // Limit the amount of padding we are willing to give up for alignment.<br>
> - unsigned Length = OptionHelp[i].first.size();<br>
> - if (Length <= 23)<br>
> - OptionFieldWidth = std::max(OptionFieldWidth, Length);<br>
> - }<br>
> -<br>
> - const unsigned InitialPad = 2;<br>
> - for (unsigned i = 0, e = OptionHelp.size(); i != e; ++i) {<br>
> - const std::string &Option = OptionHelp[i].first;<br>
> - int Pad = OptionFieldWidth - int(Option.size());<br>
> - OS.indent(InitialPad) << Option;<br>
> -<br>
> - // Break on long option names.<br>
> - if (Pad < 0) {<br>
> - OS << "\n";<br>
> - Pad = OptionFieldWidth + InitialPad;<br>
> - }<br>
> - OS.indent(Pad + 1) << OptionHelp[i].second << '\n';<br>
> - }<br>
> -}<br>
> -<br>
> -static const char *getOptionHelpGroup(const OptTable &Opts, OptSpecifier Id) {<br>
> - unsigned GroupID = Opts.getOptionGroupID(Id);<br>
> -<br>
> - // If not in a group, return the default help group.<br>
> - if (!GroupID)<br>
> - return "OPTIONS";<br>
> -<br>
> - // Abuse the help text of the option groups to store the "help group"<br>
> - // name.<br>
> - //<br>
> - // FIXME: Split out option groups.<br>
> - if (const char *GroupHelp = Opts.getOptionHelpText(GroupID))<br>
> - return GroupHelp;<br>
> -<br>
> - // Otherwise keep looking.<br>
> - return getOptionHelpGroup(Opts, GroupID);<br>
> -}<br>
> -<br>
> -void OptTable::PrintHelp(raw_ostream &OS, const char *Name,<br>
> - const char *Title, unsigned short FlagsToInclude,<br>
> - unsigned short FlagsToExclude) const {<br>
> - OS << "OVERVIEW: " << Title << "\n";<br>
> - OS << '\n';<br>
> - OS << "USAGE: " << Name << " [options] <inputs>\n";<br>
> - OS << '\n';<br>
> -<br>
> - // Render help text into a map of group-name to a list of (option, help)<br>
> - // pairs.<br>
> - typedef std::map<std::string,<br>
> - std::vector<std::pair<std::string, const char*> > > helpmap_ty;<br>
> - helpmap_ty GroupedOptionHelp;<br>
> -<br>
> - for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {<br>
> - unsigned Id = i + 1;<br>
> -<br>
> - // FIXME: Split out option groups.<br>
> - if (getOptionKind(Id) == Option::GroupClass)<br>
> - continue;<br>
> -<br>
> - if ((FlagsToInclude && !(getInfo(Id).Flags & FlagsToInclude)) ||<br>
> - getInfo(Id).Flags & FlagsToExclude)<br>
> - continue;<br>
> -<br>
> - if (const char *Text = getOptionHelpText(Id)) {<br>
> - const char *HelpGroup = getOptionHelpGroup(*this, Id);<br>
> - const std::string &OptName = getOptionHelpName(*this, Id);<br>
> - GroupedOptionHelp[HelpGroup].push_back(std::make_pair(OptName, Text));<br>
> - }<br>
> - }<br>
> -<br>
> - for (helpmap_ty::iterator it = GroupedOptionHelp .begin(),<br>
> - ie = GroupedOptionHelp.end(); it != ie; ++it) {<br>
> - if (it != GroupedOptionHelp .begin())<br>
> - OS << "\n";<br>
> - PrintHelpOptionList(OS, it->first, it->second);<br>
> - }<br>
> -<br>
> - OS.flush();<br>
> -}<br>
><br>
> Removed: cfe/trunk/lib/Driver/Option.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Option.cpp?rev=183988&view=auto" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Option.cpp?rev=183988&view=auto</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/Option.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/Option.cpp (removed)<br>
> @@ -1,200 +0,0 @@<br>
> -//===--- Option.cpp - Abstract Driver Options -----------------------------===//<br>
> -//<br>
> -// The LLVM Compiler Infrastructure<br>
> -//<br>
> -// This file is distributed under the University of Illinois Open Source<br>
> -// License. See LICENSE.TXT for details.<br>
> -//<br>
> -//===----------------------------------------------------------------------===//<br>
> -<br>
> -#include "clang/Driver/Option.h"<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> -#include "llvm/ADT/Twine.h"<br>
> -#include "llvm/Support/ErrorHandling.h"<br>
> -#include "llvm/Support/raw_ostream.h"<br>
> -#include <algorithm><br>
> -#include <cassert><br>
> -using namespace clang::driver;<br>
> -<br>
> -Option::Option(const OptTable::Info *info, const OptTable *owner)<br>
> - : Info(info), Owner(owner) {<br>
> -<br>
> - // Multi-level aliases are not supported, and alias options cannot<br>
> - // have groups. This just simplifies option tracking, it is not an<br>
> - // inherent limitation.<br>
> - assert((!Info || !getAlias().isValid() || (!getAlias().getAlias().isValid() &&<br>
> - !getGroup().isValid())) &&<br>
> - "Multi-level aliases and aliases with groups are unsupported.");<br>
> -}<br>
> -<br>
> -Option::~Option() {<br>
> -}<br>
> -<br>
> -void Option::dump() const {<br>
> - llvm::errs() << "<";<br>
> - switch (getKind()) {<br>
> -#define P(N) case N: llvm::errs() << #N; break<br>
> - P(GroupClass);<br>
> - P(InputClass);<br>
> - P(UnknownClass);<br>
> - P(FlagClass);<br>
> - P(JoinedClass);<br>
> - P(SeparateClass);<br>
> - P(CommaJoinedClass);<br>
> - P(MultiArgClass);<br>
> - P(JoinedOrSeparateClass);<br>
> - P(JoinedAndSeparateClass);<br>
> -#undef P<br>
> - }<br>
> -<br>
> - llvm::errs() << " Prefixes:[";<br>
> - for (const char * const *Pre = Info->Prefixes; *Pre != 0; ++Pre) {<br>
> - llvm::errs() << '"' << *Pre << (*(Pre + 1) == 0 ? "\"" : "\", ");<br>
> - }<br>
> - llvm::errs() << ']';<br>
> -<br>
> - llvm::errs() << " Name:\"" << getName() << '"';<br>
> -<br>
> - const Option Group = getGroup();<br>
> - if (Group.isValid()) {<br>
> - llvm::errs() << " Group:";<br>
> - Group.dump();<br>
> - }<br>
> -<br>
> - const Option Alias = getAlias();<br>
> - if (Alias.isValid()) {<br>
> - llvm::errs() << " Alias:";<br>
> - Alias.dump();<br>
> - }<br>
> -<br>
> - if (getKind() == MultiArgClass)<br>
> - llvm::errs() << " NumArgs:" << getNumArgs();<br>
> -<br>
> - llvm::errs() << ">\n";<br>
> -}<br>
> -<br>
> -bool Option::matches(OptSpecifier Opt) const {<br>
> - // Aliases are never considered in matching, look through them.<br>
> - const Option Alias = getAlias();<br>
> - if (Alias.isValid())<br>
> - return Alias.matches(Opt);<br>
> -<br>
> - // Check exact match.<br>
> - if (getID() == Opt.getID())<br>
> - return true;<br>
> -<br>
> - const Option Group = getGroup();<br>
> - if (Group.isValid())<br>
> - return Group.matches(Opt);<br>
> - return false;<br>
> -}<br>
> -<br>
> -Arg *Option::accept(const ArgList &Args,<br>
> - unsigned &Index,<br>
> - unsigned ArgSize) const {<br>
> - const Option &UnaliasedOption = getUnaliasedOption();<br>
> - StringRef Spelling;<br>
> - // If the option was an alias, get the spelling from the unaliased one.<br>
> - if (getID() == UnaliasedOption.getID()) {<br>
> - Spelling = StringRef(Args.getArgString(Index), ArgSize);<br>
> - } else {<br>
> - Spelling = Args.MakeArgString(Twine(UnaliasedOption.getPrefix()) +<br>
> - Twine(UnaliasedOption.getName()));<br>
> - }<br>
> -<br>
> - switch (getKind()) {<br>
> - case FlagClass:<br>
> - if (ArgSize != strlen(Args.getArgString(Index)))<br>
> - return 0;<br>
> -<br>
> - return new Arg(UnaliasedOption, Spelling, Index++);<br>
> - case JoinedClass: {<br>
> - const char *Value = Args.getArgString(Index) + ArgSize;<br>
> - return new Arg(UnaliasedOption, Spelling, Index++, Value);<br>
> - }<br>
> - case CommaJoinedClass: {<br>
> - // Always matches.<br>
> - const char *Str = Args.getArgString(Index) + ArgSize;<br>
> - Arg *A = new Arg(UnaliasedOption, Spelling, Index++);<br>
> -<br>
> - // Parse out the comma separated values.<br>
> - const char *Prev = Str;<br>
> - for (;; ++Str) {<br>
> - char c = *Str;<br>
> -<br>
> - if (!c || c == ',') {<br>
> - if (Prev != Str) {<br>
> - char *Value = new char[Str - Prev + 1];<br>
> - memcpy(Value, Prev, Str - Prev);<br>
> - Value[Str - Prev] = '\0';<br>
> - A->getValues().push_back(Value);<br>
> - }<br>
> -<br>
> - if (!c)<br>
> - break;<br>
> -<br>
> - Prev = Str + 1;<br>
> - }<br>
> - }<br>
> - A->setOwnsValues(true);<br>
> -<br>
> - return A;<br>
> - }<br>
> - case SeparateClass:<br>
> - // Matches iff this is an exact match.<br>
> - // FIXME: Avoid strlen.<br>
> - if (ArgSize != strlen(Args.getArgString(Index)))<br>
> - return 0;<br>
> -<br>
> - Index += 2;<br>
> - if (Index > Args.getNumInputArgStrings())<br>
> - return 0;<br>
> -<br>
> - return new Arg(UnaliasedOption, Spelling,<br>
> - Index - 2, Args.getArgString(Index - 1));<br>
> - case MultiArgClass: {<br>
> - // Matches iff this is an exact match.<br>
> - // FIXME: Avoid strlen.<br>
> - if (ArgSize != strlen(Args.getArgString(Index)))<br>
> - return 0;<br>
> -<br>
> - Index += 1 + getNumArgs();<br>
> - if (Index > Args.getNumInputArgStrings())<br>
> - return 0;<br>
> -<br>
> - Arg *A = new Arg(UnaliasedOption, Spelling, Index - 1 - getNumArgs(),<br>
> - Args.getArgString(Index - getNumArgs()));<br>
> - for (unsigned i = 1; i != getNumArgs(); ++i)<br>
> - A->getValues().push_back(Args.getArgString(Index - getNumArgs() + i));<br>
> - return A;<br>
> - }<br>
> - case JoinedOrSeparateClass: {<br>
> - // If this is not an exact match, it is a joined arg.<br>
> - // FIXME: Avoid strlen.<br>
> - if (ArgSize != strlen(Args.getArgString(Index))) {<br>
> - const char *Value = Args.getArgString(Index) + ArgSize;<br>
> - return new Arg(*this, Spelling, Index++, Value);<br>
> - }<br>
> -<br>
> - // Otherwise it must be separate.<br>
> - Index += 2;<br>
> - if (Index > Args.getNumInputArgStrings())<br>
> - return 0;<br>
> -<br>
> - return new Arg(UnaliasedOption, Spelling,<br>
> - Index - 2, Args.getArgString(Index - 1));<br>
> - }<br>
> - case JoinedAndSeparateClass:<br>
> - // Always matches.<br>
> - Index += 2;<br>
> - if (Index > Args.getNumInputArgStrings())<br>
> - return 0;<br>
> -<br>
> - return new Arg(UnaliasedOption, Spelling, Index - 2,<br>
> - Args.getArgString(Index - 2) + ArgSize,<br>
> - Args.getArgString(Index - 1));<br>
> - default:<br>
> - llvm_unreachable("Invalid option kind!");<br>
> - }<br>
> -}<br>
><br>
> Modified: cfe/trunk/lib/Driver/SanitizerArgs.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/SanitizerArgs.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/SanitizerArgs.h (original)<br>
> +++ cfe/trunk/lib/Driver/SanitizerArgs.h Fri Jun 14 12:17:23 2013<br>
> @@ -9,12 +9,12 @@<br>
> #ifndef CLANG_LIB_DRIVER_SANITIZERARGS_H_<br>
> #define CLANG_LIB_DRIVER_SANITIZERARGS_H_<br>
><br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/Driver.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "llvm/ADT/StringSwitch.h"<br>
> +#include "llvm/Option/Arg.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> #include "llvm/Support/Path.h"<br>
><br>
> namespace clang {<br>
><br>
> Modified: cfe/trunk/lib/Driver/ToolChain.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/ToolChain.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -8,20 +8,21 @@<br>
> //===----------------------------------------------------------------------===//<br>
><br>
> #include "Tools.h"<br>
> -#include "clang/Driver/ToolChain.h"<br>
> #include "clang/Basic/ObjCRuntime.h"<br>
> #include "clang/Driver/Action.h"<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/Driver.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> -#include "clang/Driver/Option.h"<br>
> #include "clang/Driver/Options.h"<br>
> +#include "clang/Driver/ToolChain.h"<br>
> #include "llvm/ADT/StringSwitch.h"<br>
> +#include "llvm/Option/Arg.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> +#include "llvm/Option/Option.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> #include "llvm/Support/FileSystem.h"<br>
> using namespace clang::driver;<br>
> using namespace clang;<br>
> +using namespace llvm::opt;<br>
><br>
> ToolChain::ToolChain(const Driver &D, const llvm::Triple &T,<br>
> const ArgList &A)<br>
><br>
> Modified: cfe/trunk/lib/Driver/ToolChains.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/ToolChains.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -11,18 +11,18 @@<br>
> #include "SanitizerArgs.h"<br>
> #include "clang/Basic/ObjCRuntime.h"<br>
> #include "clang/Basic/Version.h"<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/Compilation.h"<br>
> #include "clang/Driver/Driver.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> -#include "clang/Driver/Option.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "llvm/ADT/STLExtras.h"<br>
> #include "llvm/ADT/SmallString.h"<br>
> #include "llvm/ADT/StringExtras.h"<br>
> #include "llvm/ADT/StringSwitch.h"<br>
> +#include "llvm/Option/Arg.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> +#include "llvm/Option/OptTable.h"<br>
> +#include "llvm/Option/Option.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> #include "llvm/Support/FileSystem.h"<br>
> #include "llvm/Support/MemoryBuffer.h"<br>
> @@ -39,6 +39,7 @@<br>
> using namespace clang::driver;<br>
> using namespace clang::driver::toolchains;<br>
> using namespace clang;<br>
> +using namespace llvm::opt;<br>
><br>
> /// Darwin - Darwin tool chain for i386 and x86_64.<br>
><br>
><br>
> Modified: cfe/trunk/lib/Driver/Tools.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/Tools.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/Tools.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -7,7 +7,6 @@<br>
> //<br>
> //===----------------------------------------------------------------------===//<br>
><br>
> -#include <sys/stat.h><br>
> #include "Tools.h"<br>
> #include "InputInfo.h"<br>
> #include "SanitizerArgs.h"<br>
> @@ -15,29 +14,31 @@<br>
> #include "clang/Basic/ObjCRuntime.h"<br>
> #include "clang/Basic/Version.h"<br>
> #include "clang/Driver/Action.h"<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/Compilation.h"<br>
> #include "clang/Driver/Driver.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> #include "clang/Driver/Job.h"<br>
> -#include "clang/Driver/Option.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "clang/Driver/ToolChain.h"<br>
> #include "clang/Driver/Util.h"<br>
> #include "llvm/ADT/SmallString.h"<br>
> #include "llvm/ADT/StringSwitch.h"<br>
> #include "llvm/ADT/Twine.h"<br>
> +#include "llvm/Option/Arg.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> +#include "llvm/Option/Option.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> #include "llvm/Support/FileSystem.h"<br>
> #include "llvm/Support/Format.h"<br>
> #include "llvm/Support/Host.h"<br>
> #include "llvm/Support/Process.h"<br>
> #include "llvm/Support/raw_ostream.h"<br>
> +#include <sys/stat.h><br>
><br>
> using namespace clang::driver;<br>
> using namespace clang::driver::tools;<br>
> using namespace clang;<br>
> +using namespace llvm::opt;<br>
><br>
> /// CheckPreprocessingOptions - Perform some validation of preprocessing<br>
> /// arguments that is shared with gcc.<br>
><br>
> Modified: cfe/trunk/lib/Driver/Tools.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.h?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/Tools.h (original)<br>
> +++ cfe/trunk/lib/Driver/Tools.h Fri Jun 14 12:17:23 2013<br>
> @@ -14,6 +14,7 @@<br>
> #include "clang/Driver/Types.h"<br>
> #include "clang/Driver/Util.h"<br>
> #include "llvm/ADT/Triple.h"<br>
> +#include "llvm/Option/Option.h"<br>
> #include "llvm/Support/Compiler.h"<br>
><br>
> namespace clang {<br>
> @@ -27,6 +28,7 @@ namespace toolchains {<br>
> }<br>
><br>
> namespace tools {<br>
> +using llvm::opt::ArgStringList;<br>
><br>
> /// \brief Clang compiler tool.<br>
> class LLVM_LIBRARY_VISIBILITY Clang : public Tool {<br>
><br>
> Modified: cfe/trunk/lib/Driver/WindowsToolChain.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/WindowsToolChain.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/WindowsToolChain.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Driver/WindowsToolChain.cpp (original)<br>
> +++ cfe/trunk/lib/Driver/WindowsToolChain.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -10,12 +10,12 @@<br>
> #include "ToolChains.h"<br>
> #include "clang/Basic/CharInfo.h"<br>
> #include "clang/Basic/Version.h"<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/Compilation.h"<br>
> #include "clang/Driver/Driver.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> #include "clang/Driver/Options.h"<br>
> +#include "llvm/Option/Arg.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> #include "llvm/Support/Path.h"<br>
><br>
> @@ -31,6 +31,7 @@<br>
> using namespace clang::driver;<br>
> using namespace clang::driver::toolchains;<br>
> using namespace clang;<br>
> +using namespace llvm::opt;<br>
><br>
> Windows::Windows(const Driver &D, const llvm::Triple& Triple,<br>
> const ArgList &Args)<br>
><br>
> Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)<br>
> +++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -11,13 +11,11 @@<br>
> #include "clang/Basic/Diagnostic.h"<br>
> #include "clang/Basic/FileManager.h"<br>
> #include "clang/Basic/Version.h"<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> -#include "clang/Driver/Option.h"<br>
> #include "clang/Driver/Options.h"<br>
> +#include "clang/Driver/Util.h"<br>
> #include "clang/Frontend/LangStandard.h"<br>
> +#include "clang/Frontend/Utils.h"<br>
> #include "clang/Lex/HeaderSearchOptions.h"<br>
> #include "clang/Serialization/ASTReader.h"<br>
> #include "llvm/ADT/Hashing.h"<br>
> @@ -26,6 +24,10 @@<br>
> #include "llvm/ADT/StringExtras.h"<br>
> #include "llvm/ADT/StringSwitch.h"<br>
> #include "llvm/ADT/Triple.h"<br>
> +#include "llvm/Option/Arg.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> +#include "llvm/Option/OptTable.h"<br>
> +#include "llvm/Option/Option.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> #include "llvm/Support/Host.h"<br>
> #include "llvm/Support/Path.h"<br>
> @@ -58,6 +60,7 @@ CompilerInvocationBase::CompilerInvocati<br>
><br>
> using namespace clang::driver;<br>
> using namespace clang::driver::options;<br>
> +using namespace llvm::opt;<br>
><br>
> //<br>
><br>
> @@ -80,7 +83,7 @@ static unsigned getOptimizationLevel(Arg<br>
> if (S == "s" || S == "z" || S.empty())<br>
> return 2;<br>
><br>
> - return Args.getLastArgIntValue(OPT_O, DefaultOpt, Diags);<br>
> + return getLastArgIntValue(Args, OPT_O, DefaultOpt, Diags);<br>
> }<br>
><br>
> return DefaultOpt;<br>
> @@ -223,11 +226,12 @@ static bool ParseAnalyzerArgs(AnalyzerOp<br>
> Opts.AnalyzeSpecificFunction = Args.getLastArgValue(OPT_analyze_function);<br>
> Opts.UnoptimizedCFG = Args.hasArg(OPT_analysis_UnoptimizedCFG);<br>
> Opts.TrimGraph = Args.hasArg(OPT_trim_egraph);<br>
> - Opts.maxBlockVisitOnPath = Args.getLastArgIntValue(OPT_analyzer_max_loop, 4, Diags);<br>
> + Opts.maxBlockVisitOnPath =<br>
> + getLastArgIntValue(Args, OPT_analyzer_max_loop, 4, Diags);<br>
> Opts.PrintStats = Args.hasArg(OPT_analyzer_stats);<br>
> Opts.InlineMaxStackDepth =<br>
> - Args.getLastArgIntValue(OPT_analyzer_inline_max_stack_depth,<br>
> - Opts.InlineMaxStackDepth, Diags);<br>
> + getLastArgIntValue(Args, OPT_analyzer_inline_max_stack_depth,<br>
> + Opts.InlineMaxStackDepth, Diags);<br>
><br>
> Opts.CheckersControlList.clear();<br>
> for (arg_iterator it = Args.filtered_begin(OPT_analyzer_checker,<br>
> @@ -362,7 +366,7 @@ static bool ParseCodeGenArgs(CodeGenOpti<br>
> Args.hasArg(OPT_cl_fast_relaxed_math));<br>
> Opts.NoZeroInitializedInBSS = Args.hasArg(OPT_mno_zero_initialized_in_bss);<br>
> Opts.BackendOptions = Args.getAllArgValues(OPT_backend_option);<br>
> - Opts.NumRegisterParameters = Args.getLastArgIntValue(OPT_mregparm, 0, Diags);<br>
> + Opts.NumRegisterParameters = getLastArgIntValue(Args, OPT_mregparm, 0, Diags);<br>
> Opts.NoGlobalMerge = Args.hasArg(OPT_mno_global_merge);<br>
> Opts.NoExecStack = Args.hasArg(OPT_mno_exec_stack);<br>
> Opts.EnableSegmentedStacks = Args.hasArg(OPT_split_stacks);<br>
> @@ -421,7 +425,7 @@ static bool ParseCodeGenArgs(CodeGenOpti<br>
> Opts.SanitizeUndefinedTrapOnError =<br>
> Args.hasArg(OPT_fsanitize_undefined_trap_on_error);<br>
> Opts.SSPBufferSize =<br>
> - Args.getLastArgIntValue(OPT_stack_protector_buffer_size, 8, Diags);<br>
> + getLastArgIntValue(Args, OPT_stack_protector_buffer_size, 8, Diags);<br>
> Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);<br>
> if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {<br>
> StringRef Val = A->getValue();<br>
> @@ -570,19 +574,17 @@ bool clang::ParseDiagnosticArgs(Diagnost<br>
> Opts.VerifyDiagnostics = Args.hasArg(OPT_verify);<br>
> Opts.ElideType = !Args.hasArg(OPT_fno_elide_type);<br>
> Opts.ShowTemplateTree = Args.hasArg(OPT_fdiagnostics_show_template_tree);<br>
> - Opts.ErrorLimit = Args.getLastArgIntValue(OPT_ferror_limit, 0, Diags);<br>
> - Opts.MacroBacktraceLimit<br>
> - = Args.getLastArgIntValue(OPT_fmacro_backtrace_limit,<br>
> + Opts.ErrorLimit = getLastArgIntValue(Args, OPT_ferror_limit, 0, Diags);<br>
> + Opts.MacroBacktraceLimit =<br>
> + getLastArgIntValue(Args, OPT_fmacro_backtrace_limit,<br>
> DiagnosticOptions::DefaultMacroBacktraceLimit, Diags);<br>
> - Opts.TemplateBacktraceLimit<br>
> - = Args.getLastArgIntValue(OPT_ftemplate_backtrace_limit,<br>
> - DiagnosticOptions::DefaultTemplateBacktraceLimit,<br>
> - Diags);<br>
> - Opts.ConstexprBacktraceLimit<br>
> - = Args.getLastArgIntValue(OPT_fconstexpr_backtrace_limit,<br>
> - DiagnosticOptions::DefaultConstexprBacktraceLimit,<br>
> - Diags);<br>
> - Opts.TabStop = Args.getLastArgIntValue(OPT_ftabstop,<br>
> + Opts.TemplateBacktraceLimit = getLastArgIntValue(<br>
> + Args, OPT_ftemplate_backtrace_limit,<br>
> + DiagnosticOptions::DefaultTemplateBacktraceLimit, Diags);<br>
> + Opts.ConstexprBacktraceLimit = getLastArgIntValue(<br>
> + Args, OPT_fconstexpr_backtrace_limit,<br>
> + DiagnosticOptions::DefaultConstexprBacktraceLimit, Diags);<br>
> + Opts.TabStop = getLastArgIntValue(Args, OPT_ftabstop,<br>
> DiagnosticOptions::DefaultTabStop, Diags);<br>
> if (Opts.TabStop == 0 || Opts.TabStop > DiagnosticOptions::MaxTabStop) {<br>
> Opts.TabStop = DiagnosticOptions::DefaultTabStop;<br>
> @@ -590,7 +592,7 @@ bool clang::ParseDiagnosticArgs(Diagnost<br>
> Diags->Report(diag::warn_ignoring_ftabstop_value)<br>
> << Opts.TabStop << DiagnosticOptions::DefaultTabStop;<br>
> }<br>
> - Opts.MessageLength = Args.getLastArgIntValue(OPT_fmessage_length, 0, Diags);<br>
> + Opts.MessageLength = getLastArgIntValue(Args, OPT_fmessage_length, 0, Diags);<br>
> addWarningArgs(Args, Opts.Warnings);<br>
><br>
> return Success;<br>
> @@ -845,12 +847,13 @@ static void ParseHeaderSearchArgs(Header<br>
> Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);<br>
> Opts.ModuleCachePath = Args.getLastArgValue(OPT_fmodules_cache_path);<br>
> Opts.DisableModuleHash = Args.hasArg(OPT_fdisable_module_hash);<br>
> - Opts.ModuleCachePruneInterval<br>
> - = Args.getLastArgIntValue(OPT_fmodules_prune_interval, 7*24*60*60);<br>
> - Opts.ModuleCachePruneAfter<br>
> - = Args.getLastArgIntValue(OPT_fmodules_prune_after, 31*24*60*60);<br>
> + Opts.ModuleCachePruneInterval =<br>
> + getLastArgIntValue(Args, OPT_fmodules_prune_interval, 7 * 24 * 60 * 60);<br>
> + Opts.ModuleCachePruneAfter =<br>
> + getLastArgIntValue(Args, OPT_fmodules_prune_after, 31 * 24 * 60 * 60);<br>
> for (arg_iterator it = Args.filtered_begin(OPT_fmodules_ignore_macro),<br>
> - ie = Args.filtered_end(); it != ie; ++it) {<br>
> + ie = Args.filtered_end();<br>
> + it != ie; ++it) {<br>
> StringRef MacroDef = (*it)->getValue();<br>
> Opts.ModulesIgnoreMacros.insert(MacroDef.split('=').first);<br>
> }<br>
> @@ -1219,7 +1222,7 @@ static void ParseLangArgs(LangOptions &O<br>
> = Args.hasArg(OPT_fms_extensions) || Args.hasArg(OPT_fms_compatibility);<br>
> Opts.MicrosoftMode = Args.hasArg(OPT_fms_compatibility);<br>
> Opts.AsmBlocks = Args.hasArg(OPT_fasm_blocks) || Opts.MicrosoftExt;<br>
> - Opts.MSCVersion = Args.getLastArgIntValue(OPT_fmsc_version, 0, Diags);<br>
> + Opts.MSCVersion = getLastArgIntValue(Args, OPT_fmsc_version, 0, Diags);<br>
> Opts.Borland = Args.hasArg(OPT_fborland_extensions);<br>
> Opts.WritableStrings = Args.hasArg(OPT_fwritable_strings);<br>
> Opts.ConstStrings = Args.hasFlag(OPT_fconst_strings, OPT_fno_const_strings,<br>
> @@ -1249,16 +1252,16 @@ static void ParseLangArgs(LangOptions &O<br>
> Opts.AccessControl = !Args.hasArg(OPT_fno_access_control);<br>
> Opts.ElideConstructors = !Args.hasArg(OPT_fno_elide_constructors);<br>
> Opts.MathErrno = Args.hasArg(OPT_fmath_errno);<br>
> - Opts.InstantiationDepth = Args.getLastArgIntValue(OPT_ftemplate_depth, 256,<br>
> - Diags);<br>
> - Opts.ConstexprCallDepth = Args.getLastArgIntValue(OPT_fconstexpr_depth, 512,<br>
> - Diags);<br>
> - Opts.ConstexprStepLimit = Args.getLastArgIntValue(OPT_fconstexpr_steps,<br>
> - 1048576, Diags);<br>
> - Opts.BracketDepth = Args.getLastArgIntValue(OPT_fbracket_depth, 256, Diags);<br>
> + Opts.InstantiationDepth =<br>
> + getLastArgIntValue(Args, OPT_ftemplate_depth, 256, Diags);<br>
> + Opts.ConstexprCallDepth =<br>
> + getLastArgIntValue(Args, OPT_fconstexpr_depth, 512, Diags);<br>
> + Opts.ConstexprStepLimit =<br>
> + getLastArgIntValue(Args, OPT_fconstexpr_steps, 1048576, Diags);<br>
> + Opts.BracketDepth = getLastArgIntValue(Args, OPT_fbracket_depth, 256, Diags);<br>
> Opts.DelayedTemplateParsing = Args.hasArg(OPT_fdelayed_template_parsing);<br>
> - Opts.NumLargeByValueCopy = Args.getLastArgIntValue(OPT_Wlarge_by_value_copy_EQ,<br>
> - 0, Diags);<br>
> + Opts.NumLargeByValueCopy =<br>
> + getLastArgIntValue(Args, OPT_Wlarge_by_value_copy_EQ, 0, Diags);<br>
> Opts.MSBitfields = Args.hasArg(OPT_mms_bitfields);<br>
> Opts.ObjCConstantStringClass =<br>
> Args.getLastArgValue(OPT_fconstant_string_class);<br>
> @@ -1267,9 +1270,9 @@ static void ParseLangArgs(LangOptions &O<br>
> Opts.EncodeExtendedBlockSig =<br>
> Args.hasArg(OPT_fencode_extended_block_signature);<br>
> Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);<br>
> - Opts.PackStruct = Args.getLastArgIntValue(OPT_fpack_struct_EQ, 0, Diags);<br>
> - Opts.PICLevel = Args.getLastArgIntValue(OPT_pic_level, 0, Diags);<br>
> - Opts.PIELevel = Args.getLastArgIntValue(OPT_pie_level, 0, Diags);<br>
> + Opts.PackStruct = getLastArgIntValue(Args, OPT_fpack_struct_EQ, 0, Diags);<br>
> + Opts.PICLevel = getLastArgIntValue(Args, OPT_pic_level, 0, Diags);<br>
> + Opts.PIELevel = getLastArgIntValue(Args, OPT_pie_level, 0, Diags);<br>
> Opts.Static = Args.hasArg(OPT_static_define);<br>
> Opts.DumpRecordLayoutsSimple = Args.hasArg(OPT_fdump_record_layouts_simple);<br>
> Opts.DumpRecordLayouts = Opts.DumpRecordLayoutsSimple<br>
> @@ -1314,7 +1317,7 @@ static void ParseLangArgs(LangOptions &O<br>
> Opts.RetainCommentsFromSystemHeaders =<br>
> Args.hasArg(OPT_fretain_comments_from_system_headers);<br>
><br>
> - unsigned SSP = Args.getLastArgIntValue(OPT_stack_protector, 0, Diags);<br>
> + unsigned SSP = getLastArgIntValue(Args, OPT_stack_protector, 0, Diags);<br>
> switch (SSP) {<br>
> default:<br>
> Diags.Report(diag::err_drv_invalid_value)<br>
> @@ -1546,6 +1549,8 @@ bool CompilerInvocation::CreateFromArgs(<br>
> // Issue errors on arguments that are not valid for CC1.<br>
> for (ArgList::iterator I = Args->begin(), E = Args->end();<br>
> I != E; ++I) {<br>
> + if ((*I)->getOption().matches(options::OPT_INPUT))<br>
> + continue;<br>
> if (!(*I)->getOption().hasFlag(options::CC1Option)) {<br>
> Diags.Report(diag::err_drv_unknown_argument) << (*I)->getAsString(*Args);<br>
> Success = false;<br>
> @@ -1714,3 +1719,20 @@ std::string CompilerInvocation::getModul<br>
><br>
> return llvm::APInt(64, code).toString(36, /*Signed=*/false);<br>
> }<br>
> +<br>
> +namespace clang {<br>
> +<br>
> +// Declared in clang/Frontend/Utils.h.<br>
> +int getLastArgIntValue(const ArgList &Args, OptSpecifier Id, int Default,<br>
> + DiagnosticsEngine *Diags) {<br>
> + int Res = Default;<br>
> + if (Arg *A = Args.getLastArg(Id)) {<br>
> + if (StringRef(A->getValue()).getAsInteger(10, Res)) {<br>
> + if (Diags)<br>
> + Diags->Report(diag::err_drv_invalid_int_value) << A->getAsString(Args)<br>
> + << A->getValue();<br>
> + }<br>
> + }<br>
> + return Res;<br>
> +}<br>
> +}<br>
><br>
> Modified: cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp (original)<br>
> +++ cfe/trunk/lib/Frontend/CreateInvocationFromCommandLine.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -13,15 +13,16 @@<br>
><br>
> #include "clang/Frontend/Utils.h"<br>
> #include "clang/Basic/DiagnosticOptions.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/Compilation.h"<br>
> #include "clang/Driver/Driver.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "clang/Driver/Tool.h"<br>
> #include "clang/Frontend/CompilerInstance.h"<br>
> #include "clang/Frontend/FrontendDiagnostic.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> #include "llvm/Support/Host.h"<br>
> using namespace clang;<br>
> +using namespace llvm::opt;<br>
><br>
> /// createInvocationFromCommandLine - Construct a compiler invocation object for<br>
> /// a command line argument vector.<br>
> @@ -76,7 +77,7 @@ clang::createInvocationFromCommandLine(A<br>
> return 0;<br>
> }<br>
><br>
> - const driver::ArgStringList &CCArgs = Cmd->getArguments();<br>
> + const ArgStringList &CCArgs = Cmd->getArguments();<br>
> OwningPtr<CompilerInvocation> CI(new CompilerInvocation());<br>
> if (!CompilerInvocation::CreateFromArgs(*CI,<br>
> const_cast<const char **>(CCArgs.data()),<br>
><br>
> Modified: cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp (original)<br>
> +++ cfe/trunk/lib/FrontendTool/ExecuteCompilerInvocation.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -15,8 +15,6 @@<br>
> #include "clang/FrontendTool/Utils.h"<br>
> #include "clang/ARCMigrate/ARCMTActions.h"<br>
> #include "clang/CodeGen/CodeGenAction.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> -#include "clang/Driver/Option.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "clang/Frontend/CompilerInstance.h"<br>
> #include "clang/Frontend/CompilerInvocation.h"<br>
> @@ -25,9 +23,12 @@<br>
> #include "clang/Frontend/FrontendPluginRegistry.h"<br>
> #include "clang/Rewrite/Frontend/FrontendActions.h"<br>
> #include "clang/StaticAnalyzer/Frontend/FrontendActions.h"<br>
> +#include "llvm/Option/OptTable.h"<br>
> +#include "llvm/Option/Option.h"<br>
> #include "llvm/Support/DynamicLibrary.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> using namespace clang;<br>
> +using namespace llvm::opt;<br>
><br>
> static FrontendAction *CreateFrontendBaseAction(CompilerInstance &CI) {<br>
> using namespace clang::frontend;<br>
> @@ -177,11 +178,10 @@ static FrontendAction *CreateFrontendAct<br>
> bool clang::ExecuteCompilerInvocation(CompilerInstance *Clang) {<br>
> // Honor -help.<br>
> if (Clang->getFrontendOpts().ShowHelp) {<br>
> - OwningPtr<driver::OptTable> Opts(driver::createDriverOptTable());<br>
> + OwningPtr<OptTable> Opts(driver::createDriverOptTable());<br>
> Opts->PrintHelp(llvm::outs(), "clang -cc1",<br>
> "LLVM 'Clang' Compiler: <a href="http://clang.llvm.org" target="_blank">http://clang.llvm.org</a>",<br>
> - /*Include=*/driver::options::CC1Option,<br>
> - /*Exclude=*/0);<br>
> + /*Include=*/ driver::options::CC1Option, /*Exclude=*/ 0);<br>
> return 0;<br>
> }<br>
><br>
><br>
> Modified: cfe/trunk/lib/Tooling/Tooling.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/lib/Tooling/Tooling.cpp (original)<br>
> +++ cfe/trunk/lib/Tooling/Tooling.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -22,6 +22,7 @@<br>
> #include "clang/Tooling/ArgumentsAdjusters.h"<br>
> #include "clang/Tooling/CompilationDatabase.h"<br>
> #include "llvm/ADT/STLExtras.h"<br>
> +#include "llvm/Option/Option.h"<br>
> #include "llvm/Support/Debug.h"<br>
> #include "llvm/Support/FileSystem.h"<br>
> #include "llvm/Support/Host.h"<br>
> @@ -57,7 +58,7 @@ static clang::driver::Driver *newDriver(<br>
> /// \brief Retrieves the clang CC1 specific flags out of the compilation's jobs.<br>
> ///<br>
> /// Returns NULL on error.<br>
> -static const clang::driver::ArgStringList *getCC1Arguments(<br>
> +static const llvm::opt::ArgStringList *getCC1Arguments(<br>
> clang::DiagnosticsEngine *Diagnostics,<br>
> clang::driver::Compilation *Compilation) {<br>
> // We expect to get back exactly one Command job, if we didn't something<br>
> @@ -86,7 +87,7 @@ static const clang::driver::ArgStringLis<br>
> /// \brief Returns a clang build invocation initialized from the CC1 flags.<br>
> static clang::CompilerInvocation *newInvocation(<br>
> clang::DiagnosticsEngine *Diagnostics,<br>
> - const clang::driver::ArgStringList &CC1Args) {<br>
> + const llvm::opt::ArgStringList &CC1Args) {<br>
> assert(!CC1Args.empty() && "Must at least contain the program name!");<br>
> clang::CompilerInvocation *Invocation = new clang::CompilerInvocation;<br>
> clang::CompilerInvocation::CreateFromArgs(<br>
> @@ -173,7 +174,7 @@ bool ToolInvocation::run() {<br>
> Driver->setCheckInputsExist(false);<br>
> const OwningPtr<clang::driver::Compilation> Compilation(<br>
> Driver->BuildCompilation(llvm::makeArrayRef(Argv)));<br>
> - const clang::driver::ArgStringList *const CC1Args = getCC1Arguments(<br>
> + const llvm::opt::ArgStringList *const CC1Args = getCC1Arguments(<br>
> &Diagnostics, Compilation.get());<br>
> if (CC1Args == NULL) {<br>
> return false;<br>
><br>
> Modified: cfe/trunk/tools/arcmt-test/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/arcmt-test/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/arcmt-test/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/arcmt-test/Makefile (original)<br>
> +++ cfe/trunk/tools/arcmt-test/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -17,7 +17,7 @@ TOOL_NO_EXPORTS = 1<br>
> NO_INSTALL = 1<br>
><br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangARCMigrate.a clangRewriteCore.a \<br>
> clangFrontend.a clangDriver.a clangSerialization.a clangParse.a \<br>
> clangSema.a clangEdit.a clangAnalysis.a clangAST.a clangLex.a \<br>
><br>
> Modified: cfe/trunk/tools/c-arcmt-test/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-arcmt-test/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-arcmt-test/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/c-arcmt-test/Makefile (original)<br>
> +++ cfe/trunk/tools/c-arcmt-test/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -21,7 +21,7 @@ NO_INSTALL = 1<br>
> # LINK_COMPONENTS before including Makefile.rules<br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
><br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
><br>
> # Note that 'USEDLIBS' must include all of the core clang libraries<br>
> # when -static is given to linker on cygming.<br>
><br>
> Modified: cfe/trunk/tools/c-index-test/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/c-index-test/Makefile (original)<br>
> +++ cfe/trunk/tools/c-index-test/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -22,7 +22,7 @@ TOOL_NO_EXPORTS = 1<br>
> # LINK_COMPONENTS before including Makefile.rules<br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
><br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
><br>
> # Note that 'USEDLIBS' must include all of the core clang libraries<br>
> # when -static is given to linker on cygming.<br>
><br>
> Modified: cfe/trunk/tools/clang-check/ClangCheck.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-check/ClangCheck.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-check/ClangCheck.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/clang-check/ClangCheck.cpp (original)<br>
> +++ cfe/trunk/tools/clang-check/ClangCheck.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -17,7 +17,6 @@<br>
> //===----------------------------------------------------------------------===//<br>
><br>
> #include "clang/AST/ASTConsumer.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "clang/Frontend/ASTConsumers.h"<br>
> #include "clang/Frontend/CompilerInstance.h"<br>
> @@ -29,10 +28,12 @@<br>
> #include "llvm/Support/CommandLine.h"<br>
> #include "llvm/Support/Path.h"<br>
> #include "llvm/Support/Signals.h"<br>
> +#include "llvm/Option/OptTable.h"<br>
><br>
> using namespace clang::driver;<br>
> using namespace clang::tooling;<br>
> using namespace llvm;<br>
> +using namespace llvm::opt;<br>
><br>
> static cl::extrahelp CommonHelp(CommonOptionsParser::HelpMessage);<br>
> static cl::extrahelp MoreHelp(<br>
><br>
> Modified: cfe/trunk/tools/clang-check/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-check/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-check/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/clang-check/Makefile (original)<br>
> +++ cfe/trunk/tools/clang-check/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -15,7 +15,7 @@ TOOLNAME = clang-check<br>
> TOOL_NO_EXPORTS = 1<br>
><br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangFrontend.a clangSerialization.a clangDriver.a \<br>
> clangTooling.a clangParse.a clangSema.a \<br>
> clangStaticAnalyzerFrontend.a clangStaticAnalyzerCheckers.a \<br>
><br>
> Modified: cfe/trunk/tools/clang-format/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/clang-format/Makefile (original)<br>
> +++ cfe/trunk/tools/clang-format/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -15,7 +15,7 @@ TOOLNAME = clang-format<br>
> TOOL_NO_EXPORTS = 1<br>
><br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangFormat.a clangTooling.a clangFrontend.a clangSerialization.a \<br>
> clangDriver.a clangParse.a clangSema.a clangAnalysis.a \<br>
> clangRewriteFrontend.a clangRewriteCore.a clangEdit.a clangAST.a \<br>
><br>
> Modified: cfe/trunk/tools/diagtool/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/diagtool/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/diagtool/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/diagtool/Makefile (original)<br>
> +++ cfe/trunk/tools/diagtool/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -17,7 +17,7 @@ TOOL_NO_EXPORTS := 1<br>
> NO_INSTALL = 1<br>
><br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangFrontend.a clangDriver.a clangSerialization.a clangParse.a \<br>
> clangSema.a clangAnalysis.a clangEdit.a clangAST.a clangLex.a \<br>
> clangBasic.a<br>
><br>
> Modified: cfe/trunk/tools/driver/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/driver/Makefile (original)<br>
> +++ cfe/trunk/tools/driver/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -30,7 +30,7 @@ TOOL_INFO_PLIST := Info.plist<br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
><br>
> LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader bitwriter codegen \<br>
> - instrumentation ipo irreader linker selectiondag<br>
> + instrumentation ipo irreader linker selectiondag option<br>
> USEDLIBS = clangFrontendTool.a clangFrontend.a clangDriver.a \<br>
> clangSerialization.a clangCodeGen.a clangParse.a clangSema.a<br>
><br>
><br>
> Modified: cfe/trunk/tools/driver/cc1_main.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1_main.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/driver/cc1_main.cpp (original)<br>
> +++ cfe/trunk/tools/driver/cc1_main.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -13,10 +13,8 @@<br>
> //<br>
> //===----------------------------------------------------------------------===//<br>
><br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> +#include "llvm/Option/Arg.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "clang/Frontend/CompilerInstance.h"<br>
> #include "clang/Frontend/CompilerInvocation.h"<br>
> @@ -26,6 +24,8 @@<br>
> #include "clang/FrontendTool/Utils.h"<br>
> #include "llvm/ADT/Statistic.h"<br>
> #include "llvm/LinkAllPasses.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> +#include "llvm/Option/OptTable.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> #include "llvm/Support/ManagedStatic.h"<br>
> #include "llvm/Support/Signals.h"<br>
> @@ -34,6 +34,7 @@<br>
> #include "llvm/Support/raw_ostream.h"<br>
> #include <cstdio><br>
> using namespace clang;<br>
> +using namespace llvm::opt;<br>
><br>
> //===----------------------------------------------------------------------===//<br>
> // Main driver<br>
><br>
> Modified: cfe/trunk/tools/driver/cc1as_main.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/cc1as_main.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/driver/cc1as_main.cpp (original)<br>
> +++ cfe/trunk/tools/driver/cc1as_main.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -14,14 +14,12 @@<br>
><br>
> #include "clang/Basic/Diagnostic.h"<br>
> #include "clang/Basic/DiagnosticOptions.h"<br>
> -#include "clang/Driver/Arg.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/CC1AsOptions.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "clang/Frontend/FrontendDiagnostic.h"<br>
> #include "clang/Frontend/TextDiagnosticPrinter.h"<br>
> +#include "clang/Frontend/Utils.h"<br>
> #include "llvm/ADT/OwningPtr.h"<br>
> #include "llvm/ADT/StringSwitch.h"<br>
> #include "llvm/ADT/Triple.h"<br>
> @@ -37,6 +35,9 @@<br>
> #include "llvm/MC/MCStreamer.h"<br>
> #include "llvm/MC/MCSubtargetInfo.h"<br>
> #include "llvm/MC/MCTargetAsmParser.h"<br>
> +#include "llvm/Option/Arg.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> +#include "llvm/Option/OptTable.h"<br>
> #include "llvm/Support/CommandLine.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> #include "llvm/Support/FormattedStream.h"<br>
> @@ -56,6 +57,7 @@<br>
> using namespace clang;<br>
> using namespace clang::driver;<br>
> using namespace llvm;<br>
> +using namespace llvm::opt;<br>
><br>
> namespace {<br>
><br>
> @@ -225,8 +227,8 @@ bool AssemblerInvocation::CreateFromArgs<br>
> Opts.ShowVersion = Args->hasArg(OPT_version);<br>
><br>
> // Transliterate Options<br>
> - Opts.OutputAsmVariant = Args->getLastArgIntValue(OPT_output_asm_variant,<br>
> - 0, Diags);<br>
> + Opts.OutputAsmVariant =<br>
> + getLastArgIntValue(*Args.get(), OPT_output_asm_variant, 0, Diags);<br>
> Opts.ShowEncoding = Args->hasArg(OPT_show_encoding);<br>
> Opts.ShowInst = Args->hasArg(OPT_show_inst);<br>
><br>
> @@ -427,7 +429,7 @@ int cc1as_main(const char **ArgBegin, co<br>
><br>
> // Honor -help.<br>
> if (Asm.ShowHelp) {<br>
> - OwningPtr<driver::OptTable> Opts(driver::createCC1AsOptTable());<br>
> + OwningPtr<OptTable> Opts(driver::createCC1AsOptTable());<br>
> Opts->PrintHelp(llvm::outs(), "clang -cc1as", "Clang Integrated Assembler");<br>
> return 0;<br>
> }<br>
><br>
> Modified: cfe/trunk/tools/driver/driver.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/driver/driver.cpp (original)<br>
> +++ cfe/trunk/tools/driver/driver.cpp Fri Jun 14 12:17:23 2013<br>
> @@ -14,12 +14,9 @@<br>
><br>
> #include "clang/Basic/CharInfo.h"<br>
> #include "clang/Basic/DiagnosticOptions.h"<br>
> -#include "clang/Driver/ArgList.h"<br>
> #include "clang/Driver/Compilation.h"<br>
> #include "clang/Driver/Driver.h"<br>
> #include "clang/Driver/DriverDiagnostic.h"<br>
> -#include "clang/Driver/OptTable.h"<br>
> -#include "clang/Driver/Option.h"<br>
> #include "clang/Driver/Options.h"<br>
> #include "clang/Frontend/CompilerInvocation.h"<br>
> #include "clang/Frontend/TextDiagnosticPrinter.h"<br>
> @@ -28,6 +25,9 @@<br>
> #include "llvm/ADT/OwningPtr.h"<br>
> #include "llvm/ADT/SmallString.h"<br>
> #include "llvm/ADT/SmallVector.h"<br>
> +#include "llvm/Option/ArgList.h"<br>
> +#include "llvm/Option/OptTable.h"<br>
> +#include "llvm/Option/Option.h"<br>
> #include "llvm/Support/ErrorHandling.h"<br>
> #include "llvm/Support/FileSystem.h"<br>
> #include "llvm/Support/Host.h"<br>
> @@ -45,6 +45,7 @@<br>
> #include "llvm/Support/system_error.h"<br>
> using namespace clang;<br>
> using namespace clang::driver;<br>
> +using namespace llvm::opt;<br>
><br>
> llvm::sys::Path GetExecutablePath(const char *Argv0, bool CanonicalPrefixes) {<br>
> if (!CanonicalPrefixes)<br>
><br>
> Modified: cfe/trunk/tools/libclang/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/tools/libclang/Makefile (original)<br>
> +++ cfe/trunk/tools/libclang/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -16,7 +16,7 @@ LINK_LIBS_IN_SHARED = 1<br>
> SHARED_LIBRARY = 1<br>
><br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangFrontend.a clangDriver.a \<br>
> clangTooling.a \<br>
> clangSerialization.a \<br>
><br>
> Modified: cfe/trunk/unittests/AST/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/unittests/AST/Makefile (original)<br>
> +++ cfe/trunk/unittests/AST/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -10,7 +10,7 @@<br>
> CLANG_LEVEL = ../..<br>
> TESTNAME = AST<br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangTooling.a clangFrontend.a clangSerialization.a clangDriver.a \<br>
> clangRewriteCore.a clangRewriteFrontend.a \<br>
> clangParse.a clangSema.a clangAnalysis.a \<br>
><br>
> Modified: cfe/trunk/unittests/ASTMatchers/Dynamic/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Dynamic/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Dynamic/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/unittests/ASTMatchers/Dynamic/Makefile (original)<br>
> +++ cfe/trunk/unittests/ASTMatchers/Dynamic/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -11,7 +11,7 @@ CLANG_LEVEL = ../../..<br>
><br>
> TESTNAME = DynamicASTMatchers<br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangTooling.a clangFrontend.a clangSerialization.a clangDriver.a \<br>
> clangRewriteCore.a clangRewriteFrontend.a clangParse.a clangSema.a \<br>
> clangAnalysis.a clangEdit.a clangAST.a clangASTMatchers.a \<br>
><br>
> Modified: cfe/trunk/unittests/ASTMatchers/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/ASTMatchers/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/unittests/ASTMatchers/Makefile (original)<br>
> +++ cfe/trunk/unittests/ASTMatchers/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -13,7 +13,7 @@ PARALLEL_DIRS = Dynamic<br>
><br>
> TESTNAME = ASTMatchers<br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangTooling.a clangFrontend.a clangSerialization.a clangDriver.a \<br>
> clangRewriteCore.a clangRewriteFrontend.a \<br>
> clangParse.a clangSema.a clangAnalysis.a \<br>
><br>
> Modified: cfe/trunk/unittests/Format/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Format/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/unittests/Format/Makefile (original)<br>
> +++ cfe/trunk/unittests/Format/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -10,7 +10,7 @@<br>
> CLANG_LEVEL = ../..<br>
> TESTNAME = Format<br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangFormat.a clangTooling.a clangFrontend.a clangSerialization.a \<br>
> clangDriver.a clangParse.a clangRewriteCore.a \<br>
> clangRewriteFrontend.a clangSema.a clangAnalysis.a clangEdit.a \<br>
><br>
> Modified: cfe/trunk/unittests/Frontend/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Frontend/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Frontend/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/unittests/Frontend/Makefile (original)<br>
> +++ cfe/trunk/unittests/Frontend/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -10,7 +10,7 @@<br>
> CLANG_LEVEL = ../..<br>
> TESTNAME = Frontend<br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangFrontendTool.a clangFrontend.a clangDriver.a \<br>
> clangSerialization.a clangCodeGen.a clangParse.a clangSema.a \<br>
> clangStaticAnalyzerCheckers.a clangStaticAnalyzerCore.a \<br>
><br>
> Modified: cfe/trunk/unittests/Tooling/Makefile<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/Makefile?rev=183989&r1=183988&r2=183989&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/Makefile?rev=183989&r1=183988&r2=183989&view=diff</a><br>
> ==============================================================================<br>
> --- cfe/trunk/unittests/Tooling/Makefile (original)<br>
> +++ cfe/trunk/unittests/Tooling/Makefile Fri Jun 14 12:17:23 2013<br>
> @@ -10,7 +10,7 @@<br>
> CLANG_LEVEL = ../..<br>
> TESTNAME = Tooling<br>
> include $(CLANG_LEVEL)/../../Makefile.config<br>
> -LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc<br>
> +LINK_COMPONENTS := $(TARGETS_TO_BUILD) asmparser bitreader support mc option<br>
> USEDLIBS = clangTooling.a clangFrontend.a clangSerialization.a clangDriver.a \<br>
> clangParse.a clangRewriteCore.a clangRewriteFrontend.a \<br>
> clangSema.a clangAnalysis.a clangEdit.a \<br>
><br>
><br>
> _______________________________________________<br>
> cfe-commits mailing list<br>
> <a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>