From eb7f60201cb348223d3feec20638b3b084804a26 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Thu, 20 Sep 2018 08:53:06 +0000 Subject: [IR] Add a boolean field in DILocation to know if a line must covered or not Summary: Some lines have a hit counter where they should not have one. For example, in C++, some cleanup is adding at the end of a scope represented by a '}'. So such a line has a hit counter where a user expects to not have one. The goal of the patch is to add this information in DILocation which is used to get the covered lines in GCOVProfiling.cpp. A following patch in clang will add this information when generating IR (https://reviews.llvm.org/D49916). Reviewers: marco-c, davidxl, vsk, javed.absar, rnk Reviewed By: rnk Subscribers: eraman, xur, danielcdh, aprantl, rnk, dblaikie, #debug-info, vsk, llvm-commits, sylvestre.ledru Tags: #debug-info Differential Revision: https://reviews.llvm.org/D49915 llvm-svn: 342631 --- llvm/lib/IR/LLVMContextImpl.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'llvm/lib/IR/LLVMContextImpl.h') diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 2b93f521495..dcbbfebd05e 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -280,21 +280,24 @@ template <> struct MDNodeKeyImpl { unsigned Column; Metadata *Scope; Metadata *InlinedAt; + bool ImplicitCode; MDNodeKeyImpl(unsigned Line, unsigned Column, Metadata *Scope, - Metadata *InlinedAt) - : Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt) {} + Metadata *InlinedAt, bool ImplicitCode) + : Line(Line), Column(Column), Scope(Scope), InlinedAt(InlinedAt), + ImplicitCode(ImplicitCode) {} MDNodeKeyImpl(const DILocation *L) : Line(L->getLine()), Column(L->getColumn()), Scope(L->getRawScope()), - InlinedAt(L->getRawInlinedAt()) {} + InlinedAt(L->getRawInlinedAt()), ImplicitCode(L->isImplicitCode()) {} bool isKeyOf(const DILocation *RHS) const { return Line == RHS->getLine() && Column == RHS->getColumn() && - Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt(); + Scope == RHS->getRawScope() && InlinedAt == RHS->getRawInlinedAt() && + ImplicitCode == RHS->isImplicitCode(); } unsigned getHashValue() const { - return hash_combine(Line, Column, Scope, InlinedAt); + return hash_combine(Line, Column, Scope, InlinedAt, ImplicitCode); } }; -- cgit v1.2.3