14 #ifndef LLVM_CLANG_LIB_CODEGEN_COVERAGEMAPPINGGEN_H
15 #define LLVM_CLANG_LIB_CODEGEN_COVERAGEMAPPINGGEN_H
21 #include "llvm/ADT/DenseMap.h"
22 #include "llvm/ADT/StringMap.h"
23 #include "llvm/IR/GlobalValue.h"
24 #include "llvm/Support/raw_ostream.h"
39 std::vector<SourceRange> SkippedRanges;
55 llvm::SmallDenseMap<const FileEntry *, unsigned, 8> FileEntries;
56 std::vector<llvm::Constant *> FunctionRecords;
57 llvm::StructType *FunctionRecordTy;
58 std::string CoverageMappings;
62 : CGM(CGM), SourceInfo(SourceInfo), FunctionRecordTy(nullptr) {}
71 StringRef FunctionNameValue,
72 uint64_t FunctionHash,
73 const std::string &CoverageMapping);
89 llvm::DenseMap<const Stmt *, unsigned> *CounterMap;
94 : CVM(CVM), SM(SM), LangOpts(LangOpts), CounterMap(nullptr) {}
98 llvm::DenseMap<const Stmt *, unsigned> *CounterMap)
99 : CVM(CVM), SM(SM), LangOpts(LangOpts), CounterMap(CounterMap) {}
Organizes the per-function state that is used while generating code coverage mapping data...
CoverageMappingGen(CoverageMappingModuleGen &CVM, SourceManager &SM, const LangOptions &LangOpts, llvm::DenseMap< const Stmt *, unsigned > *CounterMap)
Stores additional source code information like skipped ranges which is required by the coverage mappi...
This interface provides a way to observe the actions of the preprocessor as it does its thing...
void emit()
Emit the coverage mapping data for a translation unit.
CoverageSourceInfo & getSourceInfo() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
ArrayRef< SourceRange > getSkippedRanges() const
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
Organizes the cross-function state that is used while generating code coverage mapping data...
CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)
unsigned getFileID(const FileEntry *File)
Return the coverage mapping translation unit file id for the given file.
Cached information about one file (either on disk or in the virtual file system). ...
void SourceRangeSkipped(SourceRange Range) override
Hook called when a source range is skipped.
CoverageMappingGen(CoverageMappingModuleGen &CVM, SourceManager &SM, const LangOptions &LangOpts)
Defines the PPCallbacks interface.
void emitCounterMapping(const Decl *D, llvm::raw_ostream &OS)
Emit the coverage mapping data which maps the regions of code to counters that will be used to find t...
Defines the clang::SourceLocation class and associated facilities.
void addFunctionMappingRecord(llvm::GlobalVariable *FunctionName, StringRef FunctionNameValue, uint64_t FunctionHash, const std::string &CoverageMapping)
Add a function's coverage mapping record to the collection of the function mapping records...
A trivial tuple used to represent a source range.
void emitEmptyMapping(const Decl *D, llvm::raw_ostream &OS)
Emit the coverage mapping data for an unused function. It creates mapping regions with the counter of...
This class handles loading and caching of source files into memory.