From 145449b1e420787bb99721a429341fa6be3adfb6 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sun, 3 Jul 2022 16:10:23 +0200 Subject: Vendor import of llvm-project main llvmorg-15-init-15358-g53dc0f107877. --- clang/lib/CodeGen/CoverageMappingGen.h | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'clang/lib/CodeGen/CoverageMappingGen.h') diff --git a/clang/lib/CodeGen/CoverageMappingGen.h b/clang/lib/CodeGen/CoverageMappingGen.h index ae4f435d4ff3..f5282601b640 100644 --- a/clang/lib/CodeGen/CoverageMappingGen.h +++ b/clang/lib/CodeGen/CoverageMappingGen.h @@ -31,15 +31,29 @@ class Decl; class Stmt; struct SkippedRange { + enum Kind { + PPIfElse, // Preprocessor #if/#else ... + EmptyLine, + Comment, + }; + SourceRange Range; // The location of token before the skipped source range. SourceLocation PrevTokLoc; // The location of token after the skipped source range. SourceLocation NextTokLoc; + // The nature of this skipped range + Kind RangeKind; + + bool isComment() { return RangeKind == Comment; } + bool isEmptyLine() { return RangeKind == EmptyLine; } + bool isPPIfElse() { return RangeKind == PPIfElse; } - SkippedRange(SourceRange Range, SourceLocation PrevTokLoc = SourceLocation(), + SkippedRange(SourceRange Range, Kind K, + SourceLocation PrevTokLoc = SourceLocation(), SourceLocation NextTokLoc = SourceLocation()) - : Range(Range), PrevTokLoc(PrevTokLoc), NextTokLoc(NextTokLoc) {} + : Range(Range), PrevTokLoc(PrevTokLoc), NextTokLoc(NextTokLoc), + RangeKind(K) {} }; /// Stores additional source code information like skipped ranges which @@ -62,7 +76,7 @@ public: std::vector &getSkippedRanges() { return SkippedRanges; } - void AddSkippedRange(SourceRange Range); + void AddSkippedRange(SourceRange Range, SkippedRange::Kind RangeKind); void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override; -- cgit v1.3