[lld] r254032 - ELF2: Factor out isUnderSysroot from readLinkerScript. NFC.

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 24 14:52:08 PST 2015


On Tue, Nov 24, 2015 at 02:45:31PM -0800, Rui Ueyama wrote:
> On Tue, Nov 24, 2015 at 2:39 PM, Joerg Sonnenberger via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> 
> > On Tue, Nov 24, 2015 at 10:26:33PM -0000, Rui Ueyama via llvm-commits
> > wrote:
> > > Modified: lld/trunk/ELF/LinkerScript.cpp
> > > URL:
> > http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=254032&r1=254031&r2=254032&view=diff
> > >
> > ==============================================================================
> > > --- lld/trunk/ELF/LinkerScript.cpp (original)
> > > +++ lld/trunk/ELF/LinkerScript.cpp Tue Nov 24 16:26:33 2015
> > > @@ -297,14 +297,17 @@ void LinkerScript::readOutputSectionDesc
> > >    }
> > >  }
> > >
> > > +static bool isUnderSysroot(StringRef Path) {
> > > +  if (Config->Sysroot == "")
> > > +    return false;
> > > +  for (; !Path.empty(); Path = sys::path::parent_path(Path))
> > > +    if (sys::fs::equivalent(Config->Sysroot, Path))
> > > +      return true;
> > > +  return false;
> > > +}
> >
> > Can you change it back to use .empty()?
> >
> 
> Is that preferred? I changed that since Config::Sysroot type is not very
> obvious in this context (I thought for a while about whether it is a vector
> or a StringRef). I thought that this would improve readability.

I read it as "not set" in this kind of context, so the question of
vector or StringRef doesn't even come to mind.

Joerg


More information about the llvm-commits mailing list