From: Justin Bogner Date: Thu, 2 Oct 2014 16:15:37 +0000 (+0000) Subject: Revert "InstrProf: Update for the LLVM API change in r218879" X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=aeb717338e9b3992112ce33b4cc03c7641c2846e;p=clang Revert "InstrProf: Update for the LLVM API change in r218879" r218879 has been reverted for now, this needs to go to match. This reverts commit r218880. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@218882 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CodeGenPGO.cpp b/lib/CodeGen/CodeGenPGO.cpp index 2f1f211b72..d341baf523 100644 --- a/lib/CodeGen/CodeGenPGO.cpp +++ b/lib/CodeGen/CodeGenPGO.cpp @@ -908,7 +908,8 @@ void CodeGenPGO::emitCounterRegionMapping(const Decl *D) { llvm::raw_string_ostream OS(CoverageMapping); CoverageMappingGen MappingGen(*CGM.getCoverageMapping(), CGM.getContext().getSourceManager(), - CGM.getLangOpts(), RegionCounterMap.get()); + CGM.getLangOpts(), RegionCounterMap.get(), + NumRegionCounters); MappingGen.emitCounterMapping(D, OS); OS.flush(); } diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp index 9900ebc014..2bfe0fb860 100644 --- a/lib/CodeGen/CoverageMappingGen.cpp +++ b/lib/CodeGen/CoverageMappingGen.cpp @@ -581,9 +581,11 @@ struct CounterCoverageMappingBuilder CounterCoverageMappingBuilder( CoverageMappingModuleGen &CVM, - llvm::DenseMap &CounterMap, SourceManager &SM, + llvm::DenseMap &CounterMap, + unsigned NumRegionCounters, SourceManager &SM, const LangOptions &LangOpts) - : CoverageMappingBuilder(CVM, SM, LangOpts), CounterMap(CounterMap) {} + : CoverageMappingBuilder(CVM, SM, LangOpts), CounterMap(CounterMap), + Builder(NumRegionCounters) {} /// \brief Write the mapping data to the output stream void write(llvm::raw_ostream &OS) { @@ -1211,7 +1213,8 @@ unsigned CoverageMappingModuleGen::getFileID(const FileEntry *File) { void CoverageMappingGen::emitCounterMapping(const Decl *D, llvm::raw_ostream &OS) { assert(CounterMap); - CounterCoverageMappingBuilder Walker(CVM, *CounterMap, SM, LangOpts); + CounterCoverageMappingBuilder Walker(CVM, *CounterMap, NumRegionCounters, SM, + LangOpts); Walker.VisitDecl(D); Walker.write(OS); } diff --git a/lib/CodeGen/CoverageMappingGen.h b/lib/CodeGen/CoverageMappingGen.h index e4c6412be0..45e0db8bce 100644 --- a/lib/CodeGen/CoverageMappingGen.h +++ b/lib/CodeGen/CoverageMappingGen.h @@ -87,16 +87,20 @@ class CoverageMappingGen { SourceManager &SM; const LangOptions &LangOpts; llvm::DenseMap *CounterMap; + unsigned NumRegionCounters; public: CoverageMappingGen(CoverageMappingModuleGen &CVM, SourceManager &SM, const LangOptions &LangOpts) - : CVM(CVM), SM(SM), LangOpts(LangOpts), CounterMap(nullptr) {} + : CVM(CVM), SM(SM), LangOpts(LangOpts), CounterMap(nullptr), + NumRegionCounters(0) {} CoverageMappingGen(CoverageMappingModuleGen &CVM, SourceManager &SM, const LangOptions &LangOpts, - llvm::DenseMap *CounterMap) - : CVM(CVM), SM(SM), LangOpts(LangOpts), CounterMap(CounterMap) {} + llvm::DenseMap *CounterMap, + unsigned NumRegionCounters) + : CVM(CVM), SM(SM), LangOpts(LangOpts), CounterMap(CounterMap), + NumRegionCounters(NumRegionCounters) {} /// \brief Emit the coverage mapping data which maps the regions of /// code to counters that will be used to find the execution