summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader
diff options
context:
space:
mode:
authorCalixte Denizet <cdenizet@mozilla.com>2018-09-20 08:53:06 +0000
committerCalixte Denizet <cdenizet@mozilla.com>2018-09-20 08:53:06 +0000
commiteb7f60201cb348223d3feec20638b3b084804a26 (patch)
tree91714ce01f4b5ac14c50086733f91282dcf0609f /llvm/lib/Bitcode/Reader
parent226f3ef5a52db932e4acbcfdf9bb860a25ba6d59 (diff)
downloadbcm5719-llvm-eb7f60201cb348223d3feec20638b3b084804a26.tar.gz
bcm5719-llvm-eb7f60201cb348223d3feec20638b3b084804a26.zip
[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
Diffstat (limited to 'llvm/lib/Bitcode/Reader')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp3
-rw-r--r--llvm/lib/Bitcode/Reader/MetadataLoader.cpp6
2 files changed, 6 insertions, 3 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 7ef52acd464..aa83955e646 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -3516,6 +3516,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
unsigned Line = Record[0], Col = Record[1];
unsigned ScopeID = Record[2], IAID = Record[3];
+ bool isImplicitCode = Record.size() == 5 && Record[4];
MDNode *Scope = nullptr, *IA = nullptr;
if (ScopeID) {
@@ -3528,7 +3529,7 @@ Error BitcodeReader::parseFunctionBody(Function *F) {
if (!IA)
return error("Invalid record");
}
- LastLoc = DebugLoc::get(Line, Col, Scope, IA);
+ LastLoc = DebugLoc::get(Line, Col, Scope, IA, isImplicitCode);
I->setDebugLoc(LastLoc);
I = nullptr;
continue;
diff --git a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
index a48bbcc2f2d..1af17f485e1 100644
--- a/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
+++ b/llvm/lib/Bitcode/Reader/MetadataLoader.cpp
@@ -1139,7 +1139,7 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
break;
}
case bitc::METADATA_LOCATION: {
- if (Record.size() != 5)
+ if (Record.size() != 6)
return error("Invalid record");
IsDistinct = Record[0];
@@ -1147,8 +1147,10 @@ Error MetadataLoader::MetadataLoaderImpl::parseOneMetadata(
unsigned Column = Record[2];
Metadata *Scope = getMD(Record[3]);
Metadata *InlinedAt = getMDOrNull(Record[4]);
+ bool ImplicitCode = Record[5];
MetadataList.assignValue(
- GET_OR_DISTINCT(DILocation, (Context, Line, Column, Scope, InlinedAt)),
+ GET_OR_DISTINCT(DILocation, (Context, Line, Column, Scope, InlinedAt,
+ ImplicitCode)),
NextMetadataNo);
NextMetadataNo++;
break;
OpenPOWER on IntegriCloud