summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.h
diff options
context:
space:
mode:
authorAlex Lorenz <arphaman@gmail.com>2014-08-04 18:41:51 +0000
committerAlex Lorenz <arphaman@gmail.com>2014-08-04 18:41:51 +0000
commitee02499a8fb64f9710b4543f2f46c5305dcb11fc (patch)
tree65514c3a36a4efeb1f20869ef94c33b107632ac2 /clang/lib/CodeGen/CodeGenModule.h
parent1193b5e272db7aa969380e95503b2512d3f17270 (diff)
downloadbcm5719-llvm-ee02499a8fb64f9710b4543f2f46c5305dcb11fc.tar.gz
bcm5719-llvm-ee02499a8fb64f9710b4543f2f46c5305dcb11fc.zip
Add coverage mapping generation.
This patch adds the '-fcoverage-mapping' option which allows clang to generate the coverage mapping information that can be used to provide code coverage analysis using the execution counts obtained from the instrumentation based profiling (-fprofile-instr-generate). llvm-svn: 214752
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h
index 326e4c7a290..7b7ee22bdc5 100644
--- a/clang/lib/CodeGen/CodeGenModule.h
+++ b/clang/lib/CodeGen/CodeGenModule.h
@@ -73,6 +73,7 @@ class DiagnosticsEngine;
class AnnotateAttr;
class CXXDestructorDecl;
class Module;
+class CoverageSourceInfo;
namespace CodeGen {
@@ -87,6 +88,7 @@ class CGOpenMPRuntime;
class CGCUDARuntime;
class BlockFieldFlags;
class FunctionArgList;
+class CoverageMappingModuleGen;
struct OrderGlobalInits {
unsigned int priority;
@@ -477,10 +479,15 @@ class CodeGenModule : public CodeGenTypeCache {
std::unique_ptr<SanitizerMetadata> SanitizerMD;
/// @}
+
+ llvm::DenseMap<const Decl *, bool> DeferredEmptyCoverageMappingDecls;
+
+ std::unique_ptr<CoverageMappingModuleGen> CoverageMapping;
public:
CodeGenModule(ASTContext &C, const CodeGenOptions &CodeGenOpts,
llvm::Module &M, const llvm::DataLayout &TD,
- DiagnosticsEngine &Diags);
+ DiagnosticsEngine &Diags,
+ CoverageSourceInfo *CoverageInfo = nullptr);
~CodeGenModule();
@@ -529,6 +536,10 @@ public:
InstrProfStats &getPGOStats() { return PGOStats; }
llvm::IndexedInstrProfReader *getPGOReader() const { return PGOReader.get(); }
+ CoverageMappingModuleGen *getCoverageMapping() const {
+ return CoverageMapping.get();
+ }
+
llvm::Constant *getStaticLocalDeclAddress(const VarDecl *D) {
return StaticLocalDeclMap[D];
}
@@ -815,6 +826,18 @@ public:
/// Emit code for a single top level declaration.
void EmitTopLevelDecl(Decl *D);
+ /// \brief Stored a deferred empty coverage mapping for an unused
+ /// and thus uninstrumented top level declaration.
+ void AddDeferredUnusedCoverageMapping(Decl *D);
+
+ /// \brief Remove the deferred empty coverage mapping as this
+ /// declaration is actually instrumented.
+ void ClearUnusedCoverageMapping(const Decl *D);
+
+ /// \brief Emit all the deferred coverage mappings
+ /// for the uninstrumented functions.
+ void EmitDeferredUnusedCoverageMappings();
+
/// Tell the consumer that this variable has been instantiated.
void HandleCXXStaticMemberVarInstantiation(VarDecl *VD);
OpenPOWER on IntegriCloud