[PATCH] D36140: [ELF] - Do not segfault if linkerscript tries to access Target too early.

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 01:48:51 PDT 2017


>Rui Ueyama via Phabricator <reviews at reviews.llvm.org> writes:
>
>> Make this a member function of LinkerScript so that you don't need to pass `Location`.
>
>Would it be the correct value? The code looks like:
>
>  std::string Location = getCurrentLocation();
>  ...
>  if (Tok == "CONSTANT") {
>    StringRef Name = readParenLiteral();
>    return [=] { return getConstant(Name); };
>
>so getCurrentLocation will be different after readParenLiteral(), no?
>
>Cheers,
>Rafael

That is true. And also we return lambda here, so just making getConstant()
a member will not help, we need to return lambda which has location evaluated
and baked on parsing stage already.

I'll update the diff with new way of doing what patch do, without passing
Location as argument.

George.


More information about the llvm-commits mailing list