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;
101 std::string CoverageMapping;
107 llvm::SmallDenseMap<const FileEntry *, unsigned, 8> FileEntries;
108 std::vector<llvm::Constant *> FunctionNames;
109 std::vector<FunctionInfo> FunctionRecords;
111 std::string getCurrentDirname();
112 std::string normalizeFilename(StringRef
Filename);
115 void emitFunctionMappingRecord(
const FunctionInfo &Info,
116 uint64_t FilenamesRef);
130 StringRef FunctionNameValue,
131 uint64_t FunctionHash,
132 const std::string &CoverageMapping,
152 llvm::DenseMap<const Stmt *, unsigned> *CounterMap;
157 : CVM(CVM),
SM(
SM), LangOpts(LangOpts), CounterMap(nullptr) {}
161 llvm::DenseMap<const Stmt *, unsigned> *CounterMap)
162 : CVM(CVM),
SM(
SM), LangOpts(LangOpts), CounterMap(CounterMap) {}
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.
CoverageMappingGen(CoverageMappingModuleGen &CVM, SourceManager &SM, const LangOptions &LangOpts, llvm::DenseMap< const Stmt *, unsigned > *CounterMap)
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...
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(const FileEntry *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...
Cached information about one file (either on disk or in the virtual file system).
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 ...
SourceLocation NextTokLoc
SkippedRange(SourceRange Range, Kind K, SourceLocation PrevTokLoc=SourceLocation(), SourceLocation NextTokLoc=SourceLocation())
SourceLocation PrevTokLoc