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

Timur Iskhodzhanov timurrrr at google.com
Wed May 7 01:32:07 PDT 2014


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)'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140507/e5ab5822/attachment.html>


More information about the llvm-commits mailing list