[Coverage] Add empty line regions to SkippedRegions
Differential Revision: https://reviews.llvm.org/D84988
diff --git a/clang/lib/CodeGen/CoverageMappingGen.h b/clang/lib/CodeGen/CoverageMappingGen.h
index d3eec22..645ad23 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.h
+++ b/clang/lib/CodeGen/CoverageMappingGen.h
@@ -45,22 +45,29 @@
/// Stores additional source code information like skipped ranges which
/// is required by the coverage mapping generator and is obtained from
/// the preprocessor.
-class CoverageSourceInfo : public PPCallbacks, public CommentHandler {
+class CoverageSourceInfo : public PPCallbacks,
+ public CommentHandler,
+ public EmptylineHandler {
// A vector of skipped source ranges and PrevTokLoc with NextTokLoc.
std::vector<SkippedRange> SkippedRanges;
- bool AfterComment = false;
+
+ SourceManager &SourceMgr;
public:
// Location of the token parsed before HandleComment is called. This is
// updated every time Preprocessor::Lex lexes a new token.
SourceLocation PrevTokLoc;
- // The location of token before comment.
- SourceLocation BeforeCommentLoc;
+
+ CoverageSourceInfo(SourceManager &SourceMgr) : SourceMgr(SourceMgr) {}
std::vector<SkippedRange> &getSkippedRanges() { return SkippedRanges; }
+ void AddSkippedRange(SourceRange Range);
+
void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override;
+ void HandleEmptyline(SourceRange Range) override;
+
bool HandleComment(Preprocessor &PP, SourceRange Range) override;
void updateNextTokLoc(SourceLocation Loc);