[llvm] r208148 - llvm-cov: Implement --no-output

David Blaikie dblaikie at gmail.com
Wed May 7 08:43:50 PDT 2014


On Wed, May 7, 2014 at 2:00 AM, Timur Iskhodzhanov <timurrrr at google.com> wrote:
> I've worked around that in r208171.
>
> Please take a look and come up with a more permanent fix.

This is essentially the semi-permanent fix (Justin can just remove the
comment). Reid's done this in other places for the same reason.

One discussion we had is that we could modify STLExtras.h to check
compiler version and just bring in the MSVC version of make_unique
into the llvm namespace if it's available, and otherwise define our
own. Then there wouldn't be an ambiguity.

>
>
> 2014-05-07 12:32 GMT+04:00 Timur Iskhodzhanov <timurrrr at google.com>:
>
>>
>> 2014-05-07 6:11 GMT+04:00 Justin Bogner <mail at justinbogner.com>:
>>
>>> +std::string FileInfo::getCoveragePath(StringRef Filename,
>>> +                                      StringRef MainFilename) {
>>> +  if (Options.NoOutput)
>>> +    // This is probably a bug in gcov, but when -n is specified, paths
>>> aren't
>>> +    // mangled at all, and the -l and -p options are ignored. Here, we
>>> do the
>>> +    // same.
>>> +    return Filename;
>>> +
>>> +  std::string CoveragePath;
>>> +  if (Options.LongFileNames && !Filename.equals(MainFilename))
>>> +    CoveragePath =
>>> +        mangleCoveragePath(MainFilename, Options.PreservePaths) + "##";
>>> +  CoveragePath +=
>>> +      mangleCoveragePath(Filename, Options.PreservePaths) + ".gcov";
>>> +  return CoveragePath;
>>> +}
>>> +
>>> +std::unique_ptr<raw_ostream>
>>> +FileInfo::openCoveragePath(StringRef CoveragePath) {
>>> +  if (Options.NoOutput)
>>> +    return make_unique<raw_null_ostream>();
>>> +
>>> +  std::string ErrorInfo;
>>> +  auto OS = make_unique<raw_fd_ostream>(CoveragePath.str().c_str(),
>>> ErrorInfo,
>>> +                                        sys::fs::F_Text);
>>> +  if (!ErrorInfo.empty()) {
>>> +    errs() << ErrorInfo << "\n";
>>> +    return make_unique<raw_null_ostream>();
>>> +  }
>>> +  return std::move(OS);
>>> +}
>>> +
>>
>>
>> FYI Visual Studio 2013 is not happy with that:
>>
>> llvm\lib\IR\GCOV.cpp(518) : error C2668: 'llvm::make_unique' : ambiguous
>> call to overloaded function
>>         llvm\include\llvm/ADT/STLExtras.h(393): could be
>> 'std::unique_ptr<llvm::raw_fd_ostream,std::default_delete<llvm::raw_fd_ostream>>
>> llvm::make_unique<llvm::raw_fd_ostream,const
>> _Elem*,std::string&,llvm::sys::fs::OpenFlags>(const _Elem *&&,std::string
>> &,llvm::sys::fs::OpenFlags &&)'
>>         with
>>         [
>>             _Elem=char
>>         ]
>>         C:\Program Files (x86)\Microsoft Visual Studio
>> 12.0\VC\INCLUDE\memory(1637): or
>> 'std::unique_ptr<llvm::raw_fd_ostream,std::default_delete<llvm::raw_fd_ostream>>
>> std::make_unique<llvm::raw_fd_ostream,const
>> _Elem*,std::string&,llvm::sys::fs::OpenFlags>(const _Elem *&&,std::string
>> &,llvm::sys::fs::OpenFlags &&)' [found using argument-dependent lookup]
>>         with
>>         [
>>             _Elem=char
>>         ]
>>         while trying to match the argument list '(const char *,
>> std::string, llvm::sys::fs::OpenFlags)'
>>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



More information about the llvm-commits mailing list