[PATCH] D84988: [Coverage] Add empty line regions to SkippedRegions
Vedant Kumar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 17 10:30:15 PDT 2020
vsk added inline comments.
================
Comment at: clang/include/clang/Lex/Lexer.h:131
+ const char *NewLinePtr;
+
----------------
Could you leave a comment describing what this is?
================
Comment at: clang/include/clang/Lex/Preprocessor.h:960
+ void setParsingFunctionBody(bool parsing) { ParsingFunctionBody = parsing; }
+ bool isParsingFunctionBody() { return ParsingFunctionBody; }
+
----------------
const
================
Comment at: clang/lib/CodeGen/CoverageMappingGen.cpp:326
+ if (PrevTokLoc.isValid()) {
+ unsigned PrevTokLine = SM.getSpellingLineNumber(PrevTokLoc);
+ if (SR.LineStart == PrevTokLine) {
----------------
It looks like this assumes there is some guarantee that the skipped range (as given by SR) is in the same file as {Prev,Next}TokLoc. If that's correct, can we go ahead and `assert` that?
================
Comment at: clang/lib/Lex/Lexer.cpp:3290
IsAtPhysicalStartOfLine = true;
+ NewLinePtr = CurPtr - 1;
----------------
Is NewLinePtr supposed to point to the start of the most recent newline sequence? For "\r\n", is it supposed to be "\r<NewLinePtr>\n" or "<NewLinePtr>\r\n"?
================
Comment at: llvm/lib/ProfileData/Coverage/CoverageMapping.cpp:483
bool GapRegion = CR.value().Kind == CounterMappingRegion::GapRegion;
if (CR.index() + 1 == Regions.size() ||
----------------
Why is this deletion necessary? Do we need to introduce 0-length regions which alter the count? An example would help.
================
Comment at: llvm/lib/ProfileData/Coverage/CoverageMapping.cpp:580
const auto &R = Segments[I];
- if (!(L.Line < R.Line) && !(L.Line == R.Line && L.Col < R.Col)) {
+ if (!(L.Line <= R.Line) && !(L.Line == R.Line && L.Col <= R.Col)) {
LLVM_DEBUG(dbgs() << " ! Segment " << L.Line << ":" << L.Col
----------------
I don't think this relaxation is correct, since it permits duplicate segments. This is confusing for reporting tools because it's not possible to work out which segment applies at a given source location.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84988/new/
https://reviews.llvm.org/D84988
More information about the llvm-commits
mailing list