<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>FYI, this introduced an assertion hit when building compiler-rt:</div><div><br></div><div><blockquote type="cite"><pre style="font-family: 'Courier New', courier, monotype; "><span class="stderr" style="color: red; ">Assertion failed: ((unsigned) (id - 1) < getNumOptions() && "Invalid ID."), function getOption, file [...]/llvm/tools/clang/lib/Driver/OptTable.cpp, line 128.</span></pre></blockquote><br></div><div>I reverted it in r166245 along with subsequent commits r166230 and r166235.</div><div><br></div><div>-Argyrios</div><br><div><div>On Oct 18, 2012, at 1:33 PM, Michael J. Spencer <<a href="mailto:bigcheesegs@gmail.com">bigcheesegs@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Author: mspencer<br>Date: Thu Oct 18 15:33:42 2012<br>New Revision: 166223<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=166223&view=rev">http://llvm.org/viewvc/llvm-project?rev=166223&view=rev</a><br>Log:<br>[Options] make Option a value type.<br><br>Modified:<br>    cfe/trunk/include/clang/Driver/Arg.h<br>    cfe/trunk/include/clang/Driver/ArgList.h<br>    cfe/trunk/include/clang/Driver/OptTable.h<br>    cfe/trunk/include/clang/Driver/Option.h<br>    cfe/trunk/lib/Driver/Arg.cpp<br>    cfe/trunk/lib/Driver/ArgList.cpp<br>    cfe/trunk/lib/Driver/OptTable.cpp<br>    cfe/trunk/lib/Driver/Option.cpp<br>    cfe/trunk/lib/Driver/ToolChains.cpp<br><br>Modified: cfe/trunk/include/clang/Driver/Arg.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Arg.h?rev=166223&r1=166222&r2=166223&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Arg.h?rev=166223&r1=166222&r2=166223&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/Driver/Arg.h (original)<br>+++ cfe/trunk/include/clang/Driver/Arg.h Thu Oct 18 15:33:42 2012<br>@@ -15,6 +15,8 @@<br> #ifndef CLANG_DRIVER_ARG_H_<br> #define CLANG_DRIVER_ARG_H_<br><br>+#include "clang/Driver/Option.h"<br>+<br> #include "Util.h"<br> #include "llvm/ADT/SmallVector.h"<br> #include "llvm/ADT/StringRef.h"<br>@@ -23,7 +25,6 @@<br> namespace clang {<br> namespace driver {<br>   class ArgList;<br>-  class Option;<br><br>   /// \brief A concrete instance of a particular driver option.<br>   ///<br>@@ -38,7 +39,7 @@<br><br>   private:<br>     /// \brief The option this argument is an instance of.<br>-    const Option *Opt;<br>+    const Option Opt;<br><br>     /// \brief The argument this argument was derived from (during tool chain<br>     /// argument translation), if any.<br>@@ -60,14 +61,14 @@<br>     SmallVector<const char *, 2> Values;<br><br>   public:<br>-    Arg(const Option *Opt, unsigned Index, const Arg *BaseArg = 0);<br>-    Arg(const Option *Opt, unsigned Index,<br>+    Arg(const Option Opt, unsigned Index, const Arg *BaseArg = 0);<br>+    Arg(const Option Opt, unsigned Index,<br>         const char *Value0, const Arg *BaseArg = 0);<br>-    Arg(const Option *Opt, unsigned Index,<br>+    Arg(const Option Opt, unsigned Index,<br>         const char *Value0, const char *Value1, const Arg *BaseArg = 0);<br>     ~Arg();<br><br>-    const Option &getOption() const { return *Opt; }<br>+    const Option getOption() const { return Opt; }<br>     unsigned getIndex() const { return Index; }<br><br>     /// \brief Return the base argument which generated this arg.<br><br>Modified: cfe/trunk/include/clang/Driver/ArgList.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ArgList.h?rev=166223&r1=166222&r2=166223&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ArgList.h?rev=166223&r1=166222&r2=166223&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/Driver/ArgList.h (original)<br>+++ cfe/trunk/include/clang/Driver/ArgList.h Thu Oct 18 15:33:42 2012<br>@@ -11,6 +11,7 @@<br> #define CLANG_DRIVER_ARGLIST_H_<br><br> #include "clang/Basic/LLVM.h"<br>+#include "clang/Driver/Option.h"<br> #include "clang/Driver/OptSpecifier.h"<br> #include "clang/Driver/Util.h"<br> #include "llvm/ADT/SmallVector.h"<br>@@ -374,14 +375,14 @@<br><br>     /// AddFlagArg - Construct a new FlagArg for the given option \p Id and<br>     /// append it to the argument list.<br>-    void AddFlagArg(const Arg *BaseArg, const Option *Opt) {<br>+    void AddFlagArg(const Arg *BaseArg, const Option Opt) {<br>       append(MakeFlagArg(BaseArg, Opt));<br>     }<br><br>     /// AddPositionalArg - Construct a new Positional arg for the given option<br>     /// \p Id, with the provided \p Value and append it to the argument<br>     /// list.<br>-    void AddPositionalArg(const Arg *BaseArg, const Option *Opt,<br>+    void AddPositionalArg(const Arg *BaseArg, const Option Opt,<br>                           StringRef Value) {<br>       append(MakePositionalArg(BaseArg, Opt, Value));<br>     }<br>@@ -390,7 +391,7 @@<br>     /// AddSeparateArg - Construct a new Positional arg for the given option<br>     /// \p Id, with the provided \p Value and append it to the argument<br>     /// list.<br>-    void AddSeparateArg(const Arg *BaseArg, const Option *Opt,<br>+    void AddSeparateArg(const Arg *BaseArg, const Option Opt,<br>                         StringRef Value) {<br>       append(MakeSeparateArg(BaseArg, Opt, Value));<br>     }<br>@@ -398,28 +399,28 @@<br><br>     /// AddJoinedArg - Construct a new Positional arg for the given option<br>     /// \p Id, with the provided \p Value and append it to the argument list.<br>-    void AddJoinedArg(const Arg *BaseArg, const Option *Opt,<br>+    void AddJoinedArg(const Arg *BaseArg, const Option Opt,<br>                       StringRef Value) {<br>       append(MakeJoinedArg(BaseArg, Opt, Value));<br>     }<br><br><br>     /// MakeFlagArg - Construct a new FlagArg for the given option \p Id.<br>-    Arg *MakeFlagArg(const Arg *BaseArg, const Option *Opt) const;<br>+    Arg *MakeFlagArg(const Arg *BaseArg, const Option Opt) const;<br><br>     /// MakePositionalArg - Construct a new Positional arg for the<br>     /// given option \p Id, with the provided \p Value.<br>-    Arg *MakePositionalArg(const Arg *BaseArg, const Option *Opt,<br>+    Arg *MakePositionalArg(const Arg *BaseArg, const Option Opt,<br>                            StringRef Value) const;<br><br>     /// MakeSeparateArg - Construct a new Positional arg for the<br>     /// given option \p Id, with the provided \p Value.<br>-    Arg *MakeSeparateArg(const Arg *BaseArg, const Option *Opt,<br>+    Arg *MakeSeparateArg(const Arg *BaseArg, const Option Opt,<br>                          StringRef Value) const;<br><br>     /// MakeJoinedArg - Construct a new Positional arg for the<br>     /// given option \p Id, with the provided \p Value.<br>-    Arg *MakeJoinedArg(const Arg *BaseArg, const Option *Opt,<br>+    Arg *MakeJoinedArg(const Arg *BaseArg, const Option Opt,<br>                        StringRef Value) const;<br><br>     /// @}<br><br>Modified: cfe/trunk/include/clang/Driver/OptTable.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/OptTable.h?rev=166223&r1=166222&r2=166223&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/OptTable.h?rev=166223&r1=166222&r2=166223&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/Driver/OptTable.h (original)<br>+++ cfe/trunk/include/clang/Driver/OptTable.h Thu Oct 18 15:33:42 2012<br>@@ -47,15 +47,6 @@<br>     const Info *OptionInfos;<br>     unsigned NumOptionInfos;<br><br>-    /// \brief The lazily constructed options table, indexed by option::ID - 1.<br>-    mutable Option **Options;<br>-<br>-    /// \brief Prebound input option instance.<br>-    const Option *TheInputOption;<br>-<br>-    /// \brief Prebound unknown option instance.<br>-    const Option *TheUnknownOption;<br>-<br>     /// The index of the first option which can be parsed (i.e., is not a<br>     /// special option like 'input' or 'unknown', and is not an option group).<br>     unsigned FirstSearchableIndex;<br>@@ -67,8 +58,6 @@<br>       return OptionInfos[id - 1];<br>     }<br><br>-    Option *CreateOption(unsigned id) const;<br>-<br>   protected:<br>     OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos);<br>   public:<br>@@ -81,17 +70,7 @@<br>     /// if necessary.<br>     ///<br>     /// \return The option, or null for the INVALID option id.<br>-    const Option *getOption(OptSpecifier Opt) const {<br>-      unsigned id = Opt.getID();<br>-      if (id == 0)<br>-        return 0;<br>-<br>-      assert((unsigned) (id - 1) < getNumOptions() && "Invalid ID.");<br>-      Option *&Entry = Options[id - 1];<br>-      if (!Entry)<br>-        Entry = CreateOption(id);<br>-      return Entry;<br>-    }<br>+    const Option getOption(OptSpecifier Opt) const;<br><br>     /// \brief Lookup the name of the given option.<br>     const char *getOptionName(OptSpecifier id) const {<br><br>Modified: cfe/trunk/include/clang/Driver/Option.h<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Option.h?rev=166223&r1=166222&r2=166223&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Option.h?rev=166223&r1=166222&r2=166223&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/Driver/Option.h (original)<br>+++ cfe/trunk/include/clang/Driver/Option.h Thu Oct 18 15:33:42 2012<br>@@ -76,11 +76,36 @@<br>     Option(const OptTable::Info *Info, const OptTable *Owner);<br>     ~Option();<br><br>-    unsigned getID() const { return Info->ID; }<br>-    OptionClass getKind() const { return OptionClass(Info->Kind); }<br>-    StringRef getName() const { return Info->Name; }<br>-    const Option *getGroup() const { return Owner->getOption(Info->GroupID); }<br>-    const Option *getAlias() const { return Owner->getOption(Info->AliasID); }<br>+    bool isValid() const {<br>+      return Info != 0;<br>+    }<br>+<br>+    unsigned getID() const {<br>+      assert(Info && "Must have a valid info!");<br>+      return Info->ID;<br>+    }<br>+    <br>+    OptionClass getKind() const {<br>+      assert(Info && "Must have a valid info!");<br>+      return OptionClass(Info->Kind);<br>+    }<br>+    <br>+    StringRef getName() const {<br>+      assert(Info && "Must have a valid info!");<br>+      return Info->Name;<br>+    }<br>+    <br>+    const Option getGroup() const {<br>+      assert(Info && "Must have a valid info!");<br>+      assert(Owner && "Must have a valid owner!");<br>+      return Owner->getOption(Info->GroupID);<br>+    }<br>+    <br>+    const Option getAlias() const {<br>+      assert(Info && "Must have a valid info!");<br>+      assert(Owner && "Must have a valid owner!");<br>+      return Owner->getOption(Info->AliasID);<br>+    }<br><br>     unsigned getNumArgs() const { return Info->Param; }<br><br>@@ -130,16 +155,16 @@<br><br>     /// getUnaliasedOption - Return the final option this option<br>     /// aliases (itself, if the option has no alias).<br>-    const Option *getUnaliasedOption() const {<br>-      const Option *Alias = getAlias();<br>-      if (Alias) return Alias->getUnaliasedOption();<br>-      return this;<br>+    const Option getUnaliasedOption() const {<br>+      const Option Alias = getAlias();<br>+      if (Alias.isValid()) return Alias.getUnaliasedOption();<br>+      return *this;<br>     }<br><br>     /// getRenderName - Return the name to use when rendering this<br>     /// option.<br>     StringRef getRenderName() const {<br>-      return getUnaliasedOption()->getName();<br>+      return getUnaliasedOption().getName();<br>     }<br><br>     /// matches - Predicate for whether this option is part of the<br><br>Modified: cfe/trunk/lib/Driver/Arg.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Arg.cpp?rev=166223&r1=166222&r2=166223&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Arg.cpp?rev=166223&r1=166222&r2=166223&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Driver/Arg.cpp (original)<br>+++ cfe/trunk/lib/Driver/Arg.cpp Thu Oct 18 15:33:42 2012<br>@@ -16,19 +16,19 @@<br><br> using namespace clang::driver;<br><br>-Arg::Arg(const Option *_Opt, unsigned _Index, const Arg *_BaseArg)<br>+Arg::Arg(const Option _Opt, unsigned _Index, const Arg *_BaseArg)<br>   : Opt(_Opt), BaseArg(_BaseArg), Index(_Index),<br>     Claimed(false), OwnsValues(false) {<br> }<br><br>-Arg::Arg(const Option *_Opt, unsigned _Index, <br>+Arg::Arg(const Option _Opt, unsigned _Index,<br>          const char *Value0, const Arg *_BaseArg)<br>   : Opt(_Opt), BaseArg(_BaseArg), Index(_Index),<br>     Claimed(false), OwnsValues(false) {<br>   Values.push_back(Value0);<br> }<br><br>-Arg::Arg(const Option *_Opt, unsigned _Index, <br>+Arg::Arg(const Option _Opt, unsigned _Index,<br>          const char *Value0, const char *Value1, const Arg *_BaseArg)<br>   : Opt(_Opt), BaseArg(_BaseArg), Index(_Index),<br>     Claimed(false), OwnsValues(false) {<br>@@ -47,7 +47,7 @@<br>   llvm::errs() << "<";<br><br>   llvm::errs() << " Opt:";<br>-  Opt->dump();<br>+  Opt.dump();<br><br>   llvm::errs() << " Index:" << Index;<br><br>@@ -104,7 +104,7 @@<br>     Output.push_back(Args.MakeArgString(OS.str()));<br>     break;<br>   }<br>- <br>+<br>  case Option::RenderJoinedStyle:<br>     Output.push_back(Args.GetOrMakeJoinedArgString(<br>                        getIndex(), getOption().getName(), getValue(Args, 0)));<br><br>Modified: cfe/trunk/lib/Driver/ArgList.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=166223&r1=166222&r2=166223&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ArgList.cpp?rev=166223&r1=166222&r2=166223&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Driver/ArgList.cpp (original)<br>+++ cfe/trunk/lib/Driver/ArgList.cpp Thu Oct 18 15:33:42 2012<br>@@ -362,13 +362,13 @@<br>   return BaseArgs.MakeArgString(Str);<br> }<br><br>-Arg *DerivedArgList::MakeFlagArg(const Arg *BaseArg, const Option *Opt) const {<br>-  Arg *A = new Arg(Opt, BaseArgs.MakeIndex(Opt->getName()), BaseArg);<br>+Arg *DerivedArgList::MakeFlagArg(const Arg *BaseArg, const Option Opt) const {<br>+  Arg *A = new Arg(Opt, BaseArgs.MakeIndex(Opt.getName()), BaseArg);<br>   SynthesizedArgs.push_back(A);<br>   return A;<br> }<br><br>-Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option *Opt,<br>+Arg *DerivedArgList::MakePositionalArg(const Arg *BaseArg, const Option Opt,<br>                                        StringRef Value) const {<br>   unsigned Index = BaseArgs.MakeIndex(Value);<br>   Arg *A = new Arg(Opt, Index, BaseArgs.getArgString(Index), BaseArg);<br>@@ -376,19 +376,19 @@<br>   return A;<br> }<br><br>-Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option *Opt,<br>+Arg *DerivedArgList::MakeSeparateArg(const Arg *BaseArg, const Option Opt,<br>                                      StringRef Value) const {<br>-  unsigned Index = BaseArgs.MakeIndex(Opt->getName(), Value);<br>+  unsigned Index = BaseArgs.MakeIndex(Opt.getName(), Value);<br>   Arg *A = new Arg(Opt, Index, BaseArgs.getArgString(Index + 1), BaseArg);<br>   SynthesizedArgs.push_back(A);<br>   return A;<br> }<br><br>-Arg *DerivedArgList::MakeJoinedArg(const Arg *BaseArg, const Option *Opt,<br>+Arg *DerivedArgList::MakeJoinedArg(const Arg *BaseArg, const Option Opt,<br>                                    StringRef Value) const {<br>-  unsigned Index = BaseArgs.MakeIndex(Opt->getName().str() + Value.str());<br>+  unsigned Index = BaseArgs.MakeIndex(Opt.getName().str() + Value.str());<br>   Arg *A = new Arg(Opt, Index,<br>-                   BaseArgs.getArgString(Index) + Opt->getName().size(),<br>+                   BaseArgs.getArgString(Index) + Opt.getName().size(),<br>                    BaseArg);<br>   SynthesizedArgs.push_back(A);<br>   return A;<br><br>Modified: cfe/trunk/lib/Driver/OptTable.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/OptTable.cpp?rev=166223&r1=166222&r2=166223&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/OptTable.cpp?rev=166223&r1=166222&r2=166223&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Driver/OptTable.cpp (original)<br>+++ cfe/trunk/lib/Driver/OptTable.cpp Thu Oct 18 15:33:42 2012<br>@@ -11,6 +11,7 @@<br> #include "clang/Driver/Arg.h"<br> #include "clang/Driver/ArgList.h"<br> #include "clang/Driver/Option.h"<br>+#include "clang/Driver/Options.h"<br> #include "llvm/Support/raw_ostream.h"<br> #include "llvm/Support/ErrorHandling.h"<br> #include <algorithm><br>@@ -79,22 +80,16 @@<br><br> OptTable::OptTable(const Info *_OptionInfos, unsigned _NumOptionInfos)<br>   : OptionInfos(_OptionInfos), NumOptionInfos(_NumOptionInfos),<br>-    Options(new Option*[NumOptionInfos]),<br>-    TheInputOption(0), TheUnknownOption(0), FirstSearchableIndex(0)<br>+    FirstSearchableIndex(0)<br> {<br>   // Explicitly zero initialize the error to work around a bug in array<br>   // value-initialization on MinGW with gcc 4.3.5.<br>-  memset(Options, 0, sizeof(*Options) * NumOptionInfos);<br><br>   // Find start of normal options.<br>   for (unsigned i = 0, e = getNumOptions(); i != e; ++i) {<br>     unsigned Kind = getInfo(i + 1).Kind;<br>     if (Kind == Option::InputClass) {<br>-      assert(!TheInputOption && "Cannot have multiple input options!");<br>-      TheInputOption = getOption(i + 1);<br>     } else if (Kind == Option::UnknownClass) {<br>-      assert(!TheUnknownOption && "Cannot have multiple input options!");<br>-      TheUnknownOption = getOption(i + 1);<br>     } else if (Kind != Option::GroupClass) {<br>       FirstSearchableIndex = i;<br>       break;<br>@@ -115,8 +110,8 @@<br>   // Check that options are in order.<br>   for (unsigned i = FirstSearchableIndex+1, e = getNumOptions(); i != e; ++i) {<br>     if (!(getInfo(i) < getInfo(i + 1))) {<br>-      getOption(i)->dump();<br>-      getOption(i + 1)->dump();<br>+      getOption(i).dump();<br>+      getOption(i + 1).dump();<br>       llvm_unreachable("Options are not in order!");<br>     }<br>   }<br>@@ -124,17 +119,18 @@<br> }<br><br> OptTable::~OptTable() {<br>-  for (unsigned i = 0, e = getNumOptions(); i != e; ++i)<br>-    delete Options[i];<br>-  delete[] Options;<br> }<br><br>-bool OptTable::isOptionHelpHidden(OptSpecifier id) const {<br>-  return getInfo(id).Flags & options::HelpHidden;<br>+const Option OptTable::getOption(OptSpecifier Opt) const {<br>+  unsigned id = Opt.getID();<br>+  if (id == 0)<br>+    return Option(0, 0);<br>+  assert((unsigned) (id - 1) < getNumOptions() && "Invalid ID.");<br>+  return Option(&getInfo(id), this);<br> }<br><br>-Option *OptTable::CreateOption(unsigned id) const {<br>-  return new Option(&getInfo(id), this);<br>+bool OptTable::isOptionHelpHidden(OptSpecifier id) const {<br>+  return getInfo(id).Flags & options::HelpHidden;<br> }<br><br> Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index) const {<br>@@ -143,7 +139,7 @@<br><br>   // Anything that doesn't start with '-' is an input, as is '-' itself.<br>   if (Str[0] != '-' || Str[1] == '\0')<br>-    return new Arg(TheInputOption, Index++, Str);<br>+    return new Arg(getOption(options::OPT_INPUT), Index++, Str);<br><br>   const Info *Start = OptionInfos + FirstSearchableIndex;<br>   const Info *End = OptionInfos + getNumOptions();<br>@@ -169,7 +165,7 @@<br>       break;<br><br>     // See if this option matches.<br>-    if (Arg *A = getOption(Start - OptionInfos + 1)->accept(Args, Index))<br>+    if (Arg *A = getOption(Start - OptionInfos + 1).accept(Args, Index))<br>       return A;<br><br>     // Otherwise, see if this argument was missing values.<br>@@ -177,7 +173,7 @@<br>       return 0;<br>   }<br><br>-  return new Arg(TheUnknownOption, Index++, Str);<br>+  return new Arg(getOption(options::OPT_UNKNOWN), Index++, Str);<br> }<br><br> InputArgList *OptTable::ParseArgs(const char* const *ArgBegin,<br><br>Modified: cfe/trunk/lib/Driver/Option.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Option.cpp?rev=166223&r1=166222&r2=166223&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Option.cpp?rev=166223&r1=166222&r2=166223&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Driver/Option.cpp (original)<br>+++ cfe/trunk/lib/Driver/Option.cpp Thu Oct 18 15:33:42 2012<br>@@ -23,7 +23,8 @@<br>   // Multi-level aliases are not supported, and alias options cannot<br>   // have groups. This just simplifies option tracking, it is not an<br>   // inherent limitation.<br>-  assert((!getAlias() || (!getAlias()->getAlias() && !getGroup())) &&<br>+  assert(!Info || (!getAlias().isValid() || (!getAlias().getAlias().isValid() &&<br>+         !getGroup().isValid())) &&<br>          "Multi-level aliases and aliases with groups are unsupported.");<br> }<br><br>@@ -49,16 +50,16 @@<br><br>   llvm::errs() << " Name:\"" << getName() << '"';<br><br>-  const Option *Group = getGroup();<br>-  if (Group) {<br>+  const Option Group = getGroup();<br>+  if (Group.isValid()) {<br>     llvm::errs() << " Group:";<br>-    Group->dump();<br>+    Group.dump();<br>   }<br><br>-  const Option *Alias = getAlias();<br>-  if (Alias) {<br>+  const Option Alias = getAlias();<br>+  if (Alias.isValid()) {<br>     llvm::errs() << " Alias:";<br>-    Alias->dump();<br>+    Alias.dump();<br>   }<br><br>   if (getKind() == MultiArgClass)<br>@@ -69,17 +70,17 @@<br><br> bool Option::matches(OptSpecifier Opt) const {<br>   // Aliases are never considered in matching, look through them.<br>-  const Option *Alias = getAlias();<br>-  if (Alias)<br>-    return Alias->matches(Opt);<br>+  const Option Alias = getAlias();<br>+  if (Alias.isValid())<br>+    return Alias.matches(Opt);<br><br>   // Check exact match.<br>   if (getID() == Opt.getID())<br>     return true;<br><br>-  const Option *Group = getGroup();<br>-  if (Group)<br>-    return Group->matches(Opt);<br>+  const Option Group = getGroup();<br>+  if (Group.isValid())<br>+    return Group.matches(Opt);<br>   return false;<br> }<br><br>@@ -155,7 +156,7 @@<br>     // FIXME: Avoid strlen.<br>     if (getName().size() != strlen(Args.getArgString(Index))) {<br>       const char *Value = Args.getArgString(Index) + getName().size();<br>-      return new Arg(this, Index++, Value);<br>+      return new Arg(*this, Index++, Value);<br>     }<br><br>     // Otherwise it must be separate.<br><br>Modified: cfe/trunk/lib/Driver/ToolChains.cpp<br>URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=166223&r1=166222&r2=166223&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=166223&r1=166222&r2=166223&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/Driver/ToolChains.cpp (original)<br>+++ cfe/trunk/lib/Driver/ToolChains.cpp Thu Oct 18 15:33:42 2012<br>@@ -485,7 +485,7 @@<br>         }<br>         // When using the define to indicate the simulator, we force<br>         // 10.6 macosx target.<br>-        const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);<br>+        const Option O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);<br>         OSXVersion = Args.MakeJoinedArg(0, O, "10.6");<br>         Args.append(OSXVersion);<br>         break;<br>@@ -559,21 +559,21 @@<br>     }<br><br>     if (!OSXTarget.empty()) {<br>-      const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);<br>+      const Option O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);<br>       OSXVersion = Args.MakeJoinedArg(0, O, OSXTarget);<br>       Args.append(OSXVersion);<br>     } else if (!iOSTarget.empty()) {<br>-      const Option *O = Opts.getOption(options::OPT_miphoneos_version_min_EQ);<br>+      const Option O = Opts.getOption(options::OPT_miphoneos_version_min_EQ);<br>       iOSVersion = Args.MakeJoinedArg(0, O, iOSTarget);<br>       Args.append(iOSVersion);<br>     } else if (!iOSSimTarget.empty()) {<br>-      const Option *O = Opts.getOption(<br>+      const Option O = Opts.getOption(<br>         options::OPT_mios_simulator_version_min_EQ);<br>       iOSSimVersion = Args.MakeJoinedArg(0, O, iOSSimTarget);<br>       Args.append(iOSSimVersion);<br>     } else {<br>       // Otherwise, assume we are targeting OS X.<br>-      const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);<br>+      const Option O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);<br>       OSXVersion = Args.MakeJoinedArg(0, O, MacosxVersionMin);<br>       Args.append(OSXVersion);<br>     }<br>@@ -835,8 +835,8 @@<br>   // how the driver driver works.<br>   if (BoundArch) {<br>     StringRef Name = BoundArch;<br>-    const Option *MCpu = Opts.getOption(options::OPT_mcpu_EQ);<br>-    const Option *MArch = Opts.getOption(options::OPT_march_EQ);<br>+    const Option MCpu = Opts.getOption(options::OPT_mcpu_EQ);<br>+    const Option MArch = Opts.getOption(options::OPT_march_EQ);<br><br>     // This code must be kept in sync with LLVM's getArchTypeForDarwinArch,<br>     // which defines the list of which architectures we accept.<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits<br></blockquote></div><br></body></html>