[lld] r299115 - Include filenames in error messages to report broken files.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 30 15:56:13 PDT 2017


I tried a few different ideas. First, I tried to pass an InputFile to
check() as you suggested, but that ended up having four functions, which
looked ugly

  template <class T> T check(ErrorOr<T> E, const Twine &Prefix);
  template <class T> T check(Expected<T> E, const Twine &Prefix);
  template <class T> T check(ErrorOr<T> E, InputFile *File);
  template <class T> T check(Expected<T> E, InputFile *File);

Next I tried to make toString() cheaper by making it return a Twine instead
of a StringRef, but that didn't work because sometimes toString(Symbol)
needs to create a new string to demangle a symbol.

So looks like there's no good way to remove that member variable.

On Thu, Mar 30, 2017 at 2:49 PM, Rafael EspĂ­ndola <
rafael.espindola at gmail.com> wrote:

> I see. Maybe pass InputFile to check and have check call getLogName()
> only when needed?
>
> Cheers,
> Rafael
>
>
> On 30 March 2017 at 17:46, Rui Ueyama <ruiu at google.com> wrote:
> > We may be able to do that. I had a concern about the performance penalty
> > because that function would be called on every check() invocation,
> though.
> >
> > On Thu, Mar 30, 2017 at 2:43 PM, Rafael EspĂ­ndola
> > <rafael.espindola at gmail.com> wrote:
> >>
> >> On 30 March 2017 at 17:32, Rui Ueyama <ruiu at google.com> wrote:
> >> > We use a different (and more spacious) format to report undefined
> >> > errors:
> >> > "foo.o in archive bar.a". So, probably yes.
> >> >
> >>
> >>
> >> But LogName is always created with
> >>
> >> F->LogName = (ArchiveName + "(" + F->LogName + ")").str();
> >>
> >> So we could have a getLogName() function instead of a member variable,
> no?
> >>
> >> Cheers,
> >> Rafael
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170330/32ca71b3/attachment.html>


More information about the llvm-commits mailing list