@@ -94,9 +94,9 @@ class GCOVFunction;
9494class GCOVProfiler {
9595public:
9696 GCOVProfiler ()
97- : GCOVProfiler(GCOVOptions::getDefault(), vfs::getRealFileSystem()) {}
98- GCOVProfiler (const GCOVOptions &Opts, IntrusiveRefCntPtr< vfs::FileSystem> VFS)
99- : Options(Opts), VFS(std::move( VFS) ) {}
97+ : GCOVProfiler(GCOVOptions::getDefault(), * vfs::getRealFileSystem ()) {}
98+ GCOVProfiler (const GCOVOptions &Opts, vfs::FileSystem & VFS)
99+ : Options(Opts), VFS(VFS) {}
100100 bool
101101 runOnModule (Module &M, function_ref<BlockFrequencyInfo *(Function &F)> GetBFI,
102102 function_ref<BranchProbabilityInfo *(Function &F)> GetBPI,
@@ -113,7 +113,7 @@ class GCOVProfiler {
113113 os->write_zeros (4 - s.size () % 4 );
114114 }
115115 void writeBytes (const char *Bytes, int Size) { os->write (Bytes, Size); }
116- vfs::FileSystem &getVirtualFileSystem () const { return * VFS; }
116+ vfs::FileSystem &getVirtualFileSystem () const { return VFS; }
117117
118118private:
119119 // Create the .gcno files for the Module based on DebugInfo.
@@ -170,7 +170,7 @@ class GCOVProfiler {
170170 std::vector<Regex> ExcludeRe;
171171 DenseSet<const BasicBlock *> ExecBlocks;
172172 StringMap<bool > InstrumentedFiles;
173- IntrusiveRefCntPtr< vfs::FileSystem> VFS;
173+ vfs::FileSystem & VFS;
174174};
175175
176176struct BBInfo {
@@ -460,7 +460,7 @@ bool GCOVProfiler::isFunctionInstrumented(const Function &F) {
460460 if (FilterRe.empty () && ExcludeRe.empty ()) {
461461 return true ;
462462 }
463- SmallString<128 > Filename = getFilename (F.getSubprogram (), * VFS);
463+ SmallString<128 > Filename = getFilename (F.getSubprogram (), VFS);
464464 auto It = InstrumentedFiles.find (Filename);
465465 if (It != InstrumentedFiles.end ()) {
466466 return It->second ;
@@ -472,7 +472,7 @@ bool GCOVProfiler::isFunctionInstrumented(const Function &F) {
472472 // Path can be
473473 // /usr/lib/gcc/x86_64-linux-gnu/8/../../../../include/c++/8/bits/*.h so for
474474 // such a case we must get the real_path.
475- if (VFS-> getRealPath (Filename, RealPath)) {
475+ if (VFS. getRealPath (Filename, RealPath)) {
476476 // real_path can fail with path like "foo.c".
477477 RealFilename = Filename;
478478 } else {
@@ -529,7 +529,7 @@ std::string GCOVProfiler::mangleName(const DICompileUnit *CU,
529529 SmallString<128 > Filename = CU->getFilename ();
530530 sys::path::replace_extension (Filename, Notes ? " gcno" : " gcda" );
531531 StringRef FName = sys::path::filename (Filename);
532- ErrorOr<std::string> CWD = VFS-> getCurrentWorkingDirectory ();
532+ ErrorOr<std::string> CWD = VFS. getCurrentWorkingDirectory ();
533533 if (!CWD)
534534 return std::string (FName);
535535 SmallString<128 > CurPath{*CWD};
@@ -560,7 +560,7 @@ bool GCOVProfiler::runOnModule(
560560PreservedAnalyses GCOVProfilerPass::run (Module &M,
561561 ModuleAnalysisManager &AM) {
562562
563- GCOVProfiler Profiler (GCOVOpts, VFS);
563+ GCOVProfiler Profiler (GCOVOpts, * VFS);
564564 FunctionAnalysisManager &FAM =
565565 AM.getResult <FunctionAnalysisManagerModuleProxy>(M).getManager ();
566566
@@ -795,7 +795,7 @@ bool GCOVProfiler::emitProfileNotes(
795795 // Add the function line number to the lines of the entry block
796796 // to have a counter for the function definition.
797797 uint32_t Line = SP->getLine ();
798- auto Filename = getFilename (SP, * VFS);
798+ auto Filename = getFilename (SP, VFS);
799799
800800 BranchProbabilityInfo *BPI = GetBPI (F);
801801 BlockFrequencyInfo *BFI = GetBFI (F);
@@ -887,7 +887,7 @@ bool GCOVProfiler::emitProfileNotes(
887887 if (SP != getDISubprogram (Scope))
888888 continue ;
889889
890- GCOVLines &Lines = Block.getFile (getFilename (Loc->getScope (), * VFS));
890+ GCOVLines &Lines = Block.getFile (getFilename (Loc->getScope (), VFS));
891891 Lines.addLine (Loc.getLine ());
892892 }
893893 Line = 0 ;
0 commit comments