[llvm] r304589 - Fix build error with clang and gcc.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 11:49:56 PDT 2017


Result is a std::unique_ptr<T> where T is a subclass of DebugSubsection.
So you can't implicitly convert from unique_ptr<T> to
unique_ptr<DebugSubsection>.

I *think* this is correct, but if not maybe I need to investigate further?

On Mon, Jun 5, 2017 at 11:42 AM David Blaikie <dblaikie at gmail.com> wrote:

> Is the llvm::cast necessary here? I can't quite spot why it would be.
>
> On Fri, Jun 2, 2017 at 1:00 PM Zachary Turner via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
>
>> Author: zturner
>> Date: Fri Jun  2 15:00:10 2017
>> New Revision: 304589
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=304589&view=rev
>> Log:
>> Fix build error with clang and gcc.
>>
>> Modified:
>>     llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
>>
>> Modified: llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp?rev=304589&r1=304588&r2=304589&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp (original)
>> +++ llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp Fri Jun  2
>> 15:00:10 2017
>> @@ -261,7 +261,7 @@ std::unique_ptr<DebugSubsection> YAMLLin
>>        }
>>      }
>>    }
>> -  return Result;
>> +  return llvm::cast<DebugSubsection>(std::move(Result));
>>  }
>>
>>  std::unique_ptr<DebugSubsection>
>> @@ -282,7 +282,7 @@ YAMLInlineeLinesSubsection::toCodeViewSu
>>        Result->addExtraFile(EF);
>>      }
>>    }
>> -  return Result;
>> +  return llvm::cast<DebugSubsection>(std::move(Result));
>>  }
>>
>>  static Expected<SourceFileChecksumEntry>
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170605/e3b2c1de/attachment.html>


More information about the llvm-commits mailing list