[cfe-commits] r143856 - /cfe/trunk/lib/Driver/Tools.cpp

Matthieu Monrocq matthieu.monrocq at gmail.com
Sun Nov 6 03:11:41 PST 2011


> On Nov 5, 2011, at 6:53 PM, David Blaikie wrote:
>
> > Author: dblaikie
> > Date: Sat Nov  5 20:53:39 2011
> > New Revision: 143856
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=143856&view=rev
> > Log:
> > Fixing -g break caused by a dead reference to a temporary introduced in
> r143732.
> >
> > Modified:
> >    cfe/trunk/lib/Driver/Tools.cpp
> >
> > Modified: cfe/trunk/lib/Driver/Tools.cpp
> > URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=143856&r1=143855&r2=143856&view=diff
> >
> ==============================================================================
> > --- cfe/trunk/lib/Driver/Tools.cpp (original)
> > +++ cfe/trunk/lib/Driver/Tools.cpp Sat Nov  5 20:53:39 2011
> > @@ -1459,7 +1459,7 @@
> >   Args.ClaimAllArgs(options::OPT_g_Group);
> >   if (Arg *A = Args.getLastArg(options::OPT_g_Group))
> >     if (!A->getOption().matches(options::OPT_g0)) {
> > -      StringRef ArgString = A->getAsString(Args);
> > +      const std::string &ArgString = A->getAsString(Args);
> >       bool Valid_g = llvm::StringSwitch<bool>(ArgString)
> >         .Case("-g", true)
> >         .Case("-g3", true)
> >
> >
>

Hi David,

Since getAsString returns a  std::string  and not a reference, I think the
code would be more explicit if you were to shed the  &  as it just
introduces a binding to a temporary.

--Matthieu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20111106/e0718f6e/attachment.html>


More information about the cfe-commits mailing list