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();
}
CounterCoverageMappingBuilder(
CoverageMappingModuleGen &CVM,
- llvm::DenseMap<const Stmt *, unsigned> &CounterMap, SourceManager &SM,
+ llvm::DenseMap<const Stmt *, unsigned> &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) {
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);
}
SourceManager &SM;
const LangOptions &LangOpts;
llvm::DenseMap<const Stmt *, unsigned> *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<const Stmt *, unsigned> *CounterMap)
- : CVM(CVM), SM(SM), LangOpts(LangOpts), CounterMap(CounterMap) {}
+ llvm::DenseMap<const Stmt *, unsigned> *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