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;
102 struct FunctionInfo {
105 std::string CoverageMapping;
111 llvm::SmallDenseMap<FileEntryRef, unsigned, 8> FileEntries;
112 std::vector<llvm::Constant *> FunctionNames;
113 std::vector<FunctionInfo> FunctionRecords;
115 std::string getCurrentDirname();
116 std::string normalizeFilename(StringRef
Filename);
119 void emitFunctionMappingRecord(
const FunctionInfo &Info,
120 uint64_t FilenamesRef);
134 StringRef FunctionNameValue,
135 uint64_t FunctionHash,
136 const std::string &CoverageMapping,
156 llvm::DenseMap<const Stmt *, unsigned> *CounterMap;
162 : CVM(CVM),
SM(
SM), LangOpts(LangOpts), CounterMap(nullptr),
163 MCDCState(nullptr) {}
167 llvm::DenseMap<const Stmt *, unsigned> *CounterMap,
169 : CVM(CVM),
SM(
SM), LangOpts(LangOpts), CounterMap(CounterMap),
170 MCDCState(MCDCState) {}
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the PPCallbacks interface.
Defines the clang::Preprocessor interface.
Defines the clang::SourceLocation class and associated facilities.
This class organizes the cross-function state that is used while generating LLVM code.
Organizes the per-function state that is used while generating code coverage mapping data.
void emitEmptyMapping(const Decl *D, llvm::raw_ostream &OS)
Emit the coverage mapping data for an unused function.
CoverageMappingGen(CoverageMappingModuleGen &CVM, SourceManager &SM, const LangOptions &LangOpts)
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, llvm::DenseMap< const Stmt *, unsigned > *CounterMap, MCDC::State *MCDCState)
Organizes the cross-function state that is used while generating code coverage mapping data.
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.
CoverageSourceInfo & getSourceInfo() const
static CoverageSourceInfo * setUpCoverageCallbacks(Preprocessor &PP)
void emit()
Emit the coverage mapping data for a translation unit.
CodeGenModule & getCodeGenModule()
Return an interface into CodeGenModule.
unsigned getFileID(FileEntryRef File)
Return the coverage mapping translation unit file id for the given file.
Stores additional source code information like skipped ranges which is required by the coverage mappi...
void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override
Hook called when a source range is skipped.
void updateNextTokLoc(SourceLocation Loc)
void AddSkippedRange(SourceRange Range, SkippedRange::Kind RangeKind)
std::vector< SkippedRange > & getSkippedRanges()
bool HandleComment(Preprocessor &PP, SourceRange Range) override
SourceLocation PrevTokLoc
CoverageSourceInfo(SourceManager &SourceMgr)
void HandleEmptyline(SourceRange Range) override
Decl - This represents one declaration (or definition), e.g.
Abstract base class that describes a handler that will receive source ranges for empty lines encounte...
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
This interface provides a way to observe the actions of the preprocessor as it does its thing.
Engages in a tight little dance with the lexer to efficiently preprocess tokens.
Encodes a location in the source.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
The JSON file list parser is used to communicate input to InstallAPI.
Per-Function MC/DC state.
SourceLocation NextTokLoc
SkippedRange(SourceRange Range, Kind K, SourceLocation PrevTokLoc=SourceLocation(), SourceLocation NextTokLoc=SourceLocation())
SourceLocation PrevTokLoc