mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-11-04 06:09:05 +00:00
llvm-cov: Don't pointlessly create a unique_ptr (NFC)
There's no ownership going on here, and no reason to heap allocate this object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217113 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c7ad7ec8b9
commit
b79ed97962
@ -615,18 +615,17 @@ int CodeCoverageTool::show(int argc, const char **argv,
|
||||
if (findMainViewFileID(Function, MainFileID))
|
||||
continue;
|
||||
StringRef SourceFile = Function.Filenames[MainFileID];
|
||||
std::unique_ptr<SourceCoverageView> mainView;
|
||||
auto SourceBuffer = getSourceFile(SourceFile);
|
||||
if (!SourceBuffer)
|
||||
return 1;
|
||||
auto Range = findExpandedFileInterestingLineRange(MainFileID, Function);
|
||||
mainView.reset(new SourceCoverageView(SourceBuffer.get(), ViewOpts,
|
||||
Range.first, Range.second));
|
||||
createSourceFileView(SourceFile, *mainView, Function, true);
|
||||
SourceCoverageView mainView(SourceBuffer.get(), ViewOpts, Range.first,
|
||||
Range.second);
|
||||
createSourceFileView(SourceFile, mainView, Function, true);
|
||||
ViewOpts.colored_ostream(outs(), raw_ostream::CYAN)
|
||||
<< Function.PrettyName << " from " << SourceFile << ":";
|
||||
outs() << "\n";
|
||||
mainView->render(outs());
|
||||
mainView.render(outs());
|
||||
if (FunctionMappingRecords.size() > 1)
|
||||
outs() << "\n";
|
||||
}
|
||||
@ -648,12 +647,11 @@ int CodeCoverageTool::show(int argc, const char **argv,
|
||||
}
|
||||
|
||||
for (const auto &SourceFile : SourceFiles) {
|
||||
std::unique_ptr<SourceCoverageView> mainView;
|
||||
auto SourceBuffer = getSourceFile(SourceFile);
|
||||
if (!SourceBuffer)
|
||||
return 1;
|
||||
mainView.reset(new SourceCoverageView(SourceBuffer.get(), ViewOpts));
|
||||
if (createSourceFileView(SourceFile, *mainView, FunctionMappingRecords)) {
|
||||
SourceCoverageView mainView(SourceBuffer.get(), ViewOpts);
|
||||
if (createSourceFileView(SourceFile, mainView, FunctionMappingRecords)) {
|
||||
ViewOpts.colored_ostream(outs(), raw_ostream::RED)
|
||||
<< "warning: The file '" << SourceFile << "' isn't covered.";
|
||||
outs() << "\n";
|
||||
@ -664,7 +662,7 @@ int CodeCoverageTool::show(int argc, const char **argv,
|
||||
ViewOpts.colored_ostream(outs(), raw_ostream::CYAN) << SourceFile << ":";
|
||||
outs() << "\n";
|
||||
}
|
||||
mainView->render(outs());
|
||||
mainView.render(outs());
|
||||
if (SourceFiles.size() > 1)
|
||||
outs() << "\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user