r183989 - [Driver] Refactor clang driver to use LLVM's Option library

Reid Kleckner rnk at google.com
Tue Jun 18 06:15:44 PDT 2013


Thanks for the test, I'll see if I can fix it.


On Mon, Jun 17, 2013 at 10:50 PM, Richard Smith <richard at metafoo.co.uk>wrote:

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


More information about the cfe-commits mailing list