diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-07-03 14:10:23 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-07-03 14:10:23 +0000 |
| commit | 145449b1e420787bb99721a429341fa6be3adfb6 (patch) | |
| tree | 1d56ae694a6de602e348dd80165cf881a36600ed /clang/lib/CodeGen/CoverageMappingGen.h | |
| parent | ecbca9f5fb7d7613d2b94982c4825eb0d33d6842 (diff) | |
Vendor import of llvm-project main llvmorg-15-init-15358-g53dc0f107877.vendor/llvm-project/llvmorg-15-init-15358-g53dc0f107877
Diffstat (limited to 'clang/lib/CodeGen/CoverageMappingGen.h')
| -rw-r--r-- | clang/lib/CodeGen/CoverageMappingGen.h | 20 |
1 files changed, 17 insertions, 3 deletions
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<SkippedRange> &getSkippedRanges() { return SkippedRanges; } - void AddSkippedRange(SourceRange Range); + void AddSkippedRange(SourceRange Range, SkippedRange::Kind RangeKind); void SourceRangeSkipped(SourceRange Range, SourceLocation EndifLoc) override; |
