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/Bitcode/Writer/BitcodeWriter.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp') diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp index adaa58651223..b8444bc86d7e 100644 --- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -1403,6 +1403,7 @@ unsigned ModuleBitcodeWriter::createDILocationAbbrev() { Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 8)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::VBR, 6)); + Abbv->Add(BitCodeAbbrevOp(BitCodeAbbrevOp::Fixed, 1)); return Stream.EmitAbbrev(std::move(Abbv)); } @@ -1417,6 +1418,7 @@ void ModuleBitcodeWriter::writeDILocation(const DILocation *N, Record.push_back(N->getColumn()); Record.push_back(VE.getMetadataID(N->getScope())); Record.push_back(VE.getMetadataOrNullID(N->getInlinedAt())); + Record.push_back(N->isImplicitCode()); Stream.EmitRecord(bitc::METADATA_LOCATION, Record, Abbrev); Record.clear(); @@ -3093,6 +3095,7 @@ void ModuleBitcodeWriter::writeFunction( Vals.push_back(DL->getColumn()); Vals.push_back(VE.getMetadataOrNullID(DL->getScope())); Vals.push_back(VE.getMetadataOrNullID(DL->getInlinedAt())); + Vals.push_back(DL->isImplicitCode()); Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals); Vals.clear(); -- cgit v1.2.3