Go to the documentation of this file.
13 #ifndef LLVM_CLANG_LIB_CODEGEN_COVERAGEMAPPINGGEN_H
14 #define LLVM_CLANG_LIB_CODEGEN_COVERAGEMAPPINGGEN_H
20 #include "llvm/ADT/DenseMap.h"
21 #include "llvm/IR/GlobalValue.h"
22 #include "llvm/Support/raw_ostream.h"
66 std::vector<SkippedRange> SkippedRanges;
107 llvm::SmallDenseMap<const FileEntry *, unsigned, 8> FileEntries;
108 std::vector<llvm::Constant *> FunctionNames;
109 std::vector<FunctionInfo> FunctionRecords;
110 std::map<std::string, std::string> CoveragePrefixMap;
116 void emitFunctionMappingRecord(
const FunctionInfo &Info,
131 StringRef FunctionNameValue,
153 llvm::DenseMap<const Stmt *, unsigned> *CounterMap;
158 : CVM(CVM),
SM(
SM), LangOpts(LangOpts), CounterMap(nullptr) {}
162 llvm::DenseMap<const Stmt *, unsigned> *CounterMap)
163 : CVM(CVM),
SM(
SM), LangOpts(LangOpts), CounterMap(CounterMap) {}
void addFunctionMappingRecord(llvm::GlobalVariable *FunctionName, StringRef FunctionNameValue, uint64_t FunctionHash, const std::string &CoverageMapping, bool IsUsed=true)
Add a function's coverage mapping record to the collection of the function mapping records.
CoverageMappingGen(CoverageMappingModuleGen &CVM, SourceManager &SM, const LangOptions &LangOpts, llvm::DenseMap< const Stmt *, unsigned > *CounterMap)
std::vector< SkippedRange > & getSkippedRanges()
A trivial tuple used to represent a source range.
Encodes a location in the source.
This interface provides a way to observe the actions of the preprocessor as it does its thing.
CodeGenModule & getCodeGenModule()
Return an interface into CodeGenModule.
SourceLocation NextTokLoc
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...
CoverageMappingGen(CoverageMappingModuleGen &CVM, SourceManager &SM, const LangOptions &LangOpts)
Stores additional source code information like skipped ranges which is required by the coverage mappi...
static CoverageSourceInfo * setUpCoverageCallbacks(Preprocessor &PP)
This class handles loading and caching of source files into memory.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
SourceLocation PrevTokLoc
void AddSkippedRange(SourceRange Range, SkippedRange::Kind RangeKind)
void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override
Hook called when a source range is skipped.
Organizes the cross-function state that is used while generating code coverage mapping data.
void emit()
Emit the coverage mapping data for a translation unit.
Organizes the per-function state that is used while generating code coverage mapping data.
Abstract base class that describes a handler that will receive source ranges for empty lines encounte...
CoverageSourceInfo & getSourceInfo() const
void updateNextTokLoc(SourceLocation Loc)
Cached information about one file (either on disk or in the virtual file system).
This class organizes the cross-function state that is used while generating LLVM code.
Decl - This represents one declaration (or definition), e.g.
unsigned getFileID(const FileEntry *File)
Return the coverage mapping translation unit file id for the given file.
void emitEmptyMapping(const Decl *D, llvm::raw_ostream &OS)
Emit the coverage mapping data for an unused function.
bool HandleComment(Preprocessor &PP, SourceRange Range) override
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
SkippedRange(SourceRange Range, Kind K, SourceLocation PrevTokLoc=SourceLocation(), SourceLocation NextTokLoc=SourceLocation())
void HandleEmptyline(SourceRange Range) override
CoverageSourceInfo(SourceManager &SourceMgr)
CoverageMappingModuleGen(CodeGenModule &CGM, CoverageSourceInfo &SourceInfo)
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
SourceLocation PrevTokLoc