[llvm] r278338 - Restore "Resolution-based LTO API."

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 11:30:42 PDT 2016


On Fri, Aug 26, 2016 at 10:56 AM, Rafael EspĂ­ndola
<rafael.espindola at gmail.com> wrote:
>> +    Expected<const Comdat *> getComdat() const {
>> +      const GlobalObject *GO;
>> +      if (auto *GA = dyn_cast<GlobalAlias>(GV)) {
>> +        GO = GA->getBaseObject();
>> +        if (!GO)
>> +          return make_error<StringError>("Unable to determine comdat of alias!",
>> +                                         inconvertibleErrorCode());
>> +      } else {
>> +        GO = cast<GlobalObject>(GV);
>> +      }
>> +      if (GV)
>
>
> This should be "if (GO)", no?

Huh, yeah it probably should. Note this isn't a correctness issue -
GV->getComdat() will essentially do the same checks as above to get
the GO and invoke getComdat() on it. I guess pcc had inlined the
handling here to customize the error message? I'll go ahead and change
this last part to
 if (GO)
  return GO->getComdat();

Thanks!
Teresa

>
> Cheers,
> Rafael



-- 
Teresa Johnson | Software Engineer | tejohnson at google.com | 408-460-2413


More information about the llvm-commits mailing list