LLVM  13.0.0git
CoverageMapping.h
Go to the documentation of this file.
1 //===- CoverageMapping.h - Code coverage mapping support --------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // Code coverage mapping data is generated by clang and read by
10 // llvm-cov to show code coverage statistics for a file.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPING_H
15 #define LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPING_H
16 
17 #include "llvm/ADT/ArrayRef.h"
18 #include "llvm/ADT/DenseMap.h"
19 #include "llvm/ADT/DenseSet.h"
20 #include "llvm/ADT/Hashing.h"
21 #include "llvm/ADT/None.h"
22 #include "llvm/ADT/StringRef.h"
23 #include "llvm/ADT/iterator.h"
26 #include "llvm/Support/Alignment.h"
27 #include "llvm/Support/Compiler.h"
28 #include "llvm/Support/Debug.h"
29 #include "llvm/Support/Endian.h"
30 #include "llvm/Support/Error.h"
32 #include <cassert>
33 #include <cstdint>
34 #include <iterator>
35 #include <memory>
36 #include <string>
37 #include <system_error>
38 #include <tuple>
39 #include <utility>
40 #include <vector>
41 
42 namespace llvm {
43 
44 class IndexedInstrProfReader;
45 
46 namespace coverage {
47 
50 
51 enum class coveragemap_error {
52  success = 0,
53  eof,
56  truncated,
57  malformed,
60 };
61 
63 
64 inline std::error_code make_error_code(coveragemap_error E) {
65  return std::error_code(static_cast<int>(E), coveragemap_category());
66 }
67 
68 class CoverageMapError : public ErrorInfo<CoverageMapError> {
69 public:
71  assert(Err != coveragemap_error::success && "Not an error");
72  }
73 
74  std::string message() const override;
75 
76  void log(raw_ostream &OS) const override { OS << message(); }
77 
78  std::error_code convertToErrorCode() const override {
79  return make_error_code(Err);
80  }
81 
82  coveragemap_error get() const { return Err; }
83 
84  static char ID;
85 
86 private:
88 };
89 
90 /// A Counter is an abstract value that describes how to compute the
91 /// execution count for a region of code using the collected profile count data.
92 struct Counter {
93  /// The CounterExpression kind (Add or Subtract) is encoded in bit 0 next to
94  /// the CounterKind. This means CounterKind has to leave bit 0 free.
96  static const unsigned EncodingTagBits = 2;
97  static const unsigned EncodingTagMask = 0x3;
99  EncodingTagBits + 1;
100 
101 private:
102  CounterKind Kind = Zero;
103  unsigned ID = 0;
104 
105  Counter(CounterKind Kind, unsigned ID) : Kind(Kind), ID(ID) {}
106 
107 public:
108  Counter() = default;
109 
110  CounterKind getKind() const { return Kind; }
111 
112  bool isZero() const { return Kind == Zero; }
113 
114  bool isExpression() const { return Kind == Expression; }
115 
116  unsigned getCounterID() const { return ID; }
117 
118  unsigned getExpressionID() const { return ID; }
119 
120  friend bool operator==(const Counter &LHS, const Counter &RHS) {
121  return LHS.Kind == RHS.Kind && LHS.ID == RHS.ID;
122  }
123 
124  friend bool operator!=(const Counter &LHS, const Counter &RHS) {
125  return !(LHS == RHS);
126  }
127 
128  friend bool operator<(const Counter &LHS, const Counter &RHS) {
129  return std::tie(LHS.Kind, LHS.ID) < std::tie(RHS.Kind, RHS.ID);
130  }
131 
132  /// Return the counter that represents the number zero.
133  static Counter getZero() { return Counter(); }
134 
135  /// Return the counter that corresponds to a specific profile counter.
136  static Counter getCounter(unsigned CounterId) {
137  return Counter(CounterValueReference, CounterId);
138  }
139 
140  /// Return the counter that corresponds to a specific addition counter
141  /// expression.
142  static Counter getExpression(unsigned ExpressionId) {
143  return Counter(Expression, ExpressionId);
144  }
145 };
146 
147 /// A Counter expression is a value that represents an arithmetic operation
148 /// with two counters.
150  enum ExprKind { Subtract, Add };
153 
155  : Kind(Kind), LHS(LHS), RHS(RHS) {}
156 };
157 
158 /// A Counter expression builder is used to construct the counter expressions.
159 /// It avoids unnecessary duplication and simplifies algebraic expressions.
161  /// A list of all the counter expressions
162  std::vector<CounterExpression> Expressions;
163 
164  /// A lookup table for the index of a given expression.
165  DenseMap<CounterExpression, unsigned> ExpressionIndices;
166 
167  /// Return the counter which corresponds to the given expression.
168  ///
169  /// If the given expression is already stored in the builder, a counter
170  /// that references that expression is returned. Otherwise, the given
171  /// expression is added to the builder's collection of expressions.
172  Counter get(const CounterExpression &E);
173 
174  /// Represents a term in a counter expression tree.
175  struct Term {
176  unsigned CounterID;
177  int Factor;
178 
179  Term(unsigned CounterID, int Factor)
180  : CounterID(CounterID), Factor(Factor) {}
181  };
182 
183  /// Gather the terms of the expression tree for processing.
184  ///
185  /// This collects each addition and subtraction referenced by the counter into
186  /// a sequence that can be sorted and combined to build a simplified counter
187  /// expression.
188  void extractTerms(Counter C, int Sign, SmallVectorImpl<Term> &Terms);
189 
190  /// Simplifies the given expression tree
191  /// by getting rid of algebraically redundant operations.
192  Counter simplify(Counter ExpressionTree);
193 
194 public:
196 
197  /// Return a counter that represents the expression that adds LHS and RHS.
198  Counter add(Counter LHS, Counter RHS);
199 
200  /// Return a counter that represents the expression that subtracts RHS from
201  /// LHS.
202  Counter subtract(Counter LHS, Counter RHS);
203 };
204 
205 using LineColPair = std::pair<unsigned, unsigned>;
206 
207 /// A Counter mapping region associates a source range with a specific counter.
209  enum RegionKind {
210  /// A CodeRegion associates some code with a counter
212 
213  /// An ExpansionRegion represents a file expansion region that associates
214  /// a source range with the expansion of a virtual source file, such as
215  /// for a macro instantiation or #include file.
217 
218  /// A SkippedRegion represents a source range with code that was skipped
219  /// by a preprocessor or similar means.
221 
222  /// A GapRegion is like a CodeRegion, but its count is only set as the
223  /// line execution count when its the only region in the line.
225 
226  /// A BranchRegion represents leaf-level boolean expressions and is
227  /// associated with two counters, each representing the number of times the
228  /// expression evaluates to true or false.
230  };
231 
232  /// Primary Counter that is also used for Branch Regions (TrueCount).
234 
235  /// Secondary Counter used for Branch Regions (FalseCount).
237 
241 
243  unsigned LineStart, unsigned ColumnStart,
244  unsigned LineEnd, unsigned ColumnEnd, RegionKind Kind)
248 
250  unsigned ExpandedFileID, unsigned LineStart,
251  unsigned ColumnStart, unsigned LineEnd,
252  unsigned ColumnEnd, RegionKind Kind)
256  Kind(Kind) {}
257 
258  static CounterMappingRegion
259  makeRegion(Counter Count, unsigned FileID, unsigned LineStart,
260  unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd) {
263  }
264 
265  static CounterMappingRegion
266  makeExpansion(unsigned FileID, unsigned ExpandedFileID, unsigned LineStart,
267  unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd) {
271  }
272 
273  static CounterMappingRegion
274  makeSkipped(unsigned FileID, unsigned LineStart, unsigned ColumnStart,
275  unsigned LineEnd, unsigned ColumnEnd) {
278  }
279 
280  static CounterMappingRegion
282  unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd) {
284  LineEnd, (1U << 31) | ColumnEnd, GapRegion);
285  }
286 
287  static CounterMappingRegion
289  unsigned LineStart, unsigned ColumnStart, unsigned LineEnd,
290  unsigned ColumnEnd) {
293  }
294 
295  inline LineColPair startLoc() const {
297  }
298 
299  inline LineColPair endLoc() const { return LineColPair(LineEnd, ColumnEnd); }
300 };
301 
302 /// Associates a source range with an execution count.
304  uint64_t ExecutionCount;
306  bool Folded;
307 
311 
313  uint64_t FalseExecutionCount)
316 };
317 
318 /// A Counter mapping context is used to connect the counters, expressions
319 /// and the obtained counter values.
321  ArrayRef<CounterExpression> Expressions;
322  ArrayRef<uint64_t> CounterValues;
323 
324 public:
326  ArrayRef<uint64_t> CounterValues = None)
327  : Expressions(Expressions), CounterValues(CounterValues) {}
328 
329  void setCounts(ArrayRef<uint64_t> Counts) { CounterValues = Counts; }
330 
331  void dump(const Counter &C, raw_ostream &OS) const;
332  void dump(const Counter &C) const { dump(C, dbgs()); }
333 
334  /// Return the number of times that a region of code associated with this
335  /// counter was executed.
336  Expected<int64_t> evaluate(const Counter &C) const;
337 
338  unsigned getMaxCounterID(const Counter &C) const;
339 };
340 
341 /// Code coverage information for a single function.
343  /// Raw function name.
344  std::string Name;
345  /// Mapping from FileID (i.e. vector index) to filename. Used to support
346  /// macro expansions within a function in which the macro and function are
347  /// defined in separate files.
348  ///
349  /// TODO: Uniquing filenames across all function records may be a performance
350  /// optimization.
351  std::vector<std::string> Filenames;
352  /// Regions in the function along with their counts.
353  std::vector<CountedRegion> CountedRegions;
354  /// Branch Regions in the function along with their counts.
355  std::vector<CountedRegion> CountedBranchRegions;
356  /// The number of times this function was executed.
357  uint64_t ExecutionCount = 0;
358 
361 
362  FunctionRecord(FunctionRecord &&FR) = default;
363  FunctionRecord &operator=(FunctionRecord &&) = default;
364 
365  void pushRegion(CounterMappingRegion Region, uint64_t Count,
366  uint64_t FalseCount) {
368  CountedBranchRegions.emplace_back(Region, Count, FalseCount);
369  // If both counters are hard-coded to zero, then this region represents a
370  // constant-folded branch.
371  if (Region.Count.isZero() && Region.FalseCount.isZero())
372  CountedBranchRegions.back().Folded = true;
373  return;
374  }
375  if (CountedRegions.empty())
376  ExecutionCount = Count;
377  CountedRegions.emplace_back(Region, Count, FalseCount);
378  }
379 };
380 
381 /// Iterator over Functions, optionally filtered to a single file.
383  : public iterator_facade_base<FunctionRecordIterator,
384  std::forward_iterator_tag, FunctionRecord> {
385  ArrayRef<FunctionRecord> Records;
387  StringRef Filename;
388 
389  /// Skip records whose primary file is not \c Filename.
390  void skipOtherFiles();
391 
392 public:
394  StringRef Filename = "")
395  : Records(Records_), Current(Records.begin()), Filename(Filename) {
396  skipOtherFiles();
397  }
398 
399  FunctionRecordIterator() : Current(Records.begin()) {}
400 
401  bool operator==(const FunctionRecordIterator &RHS) const {
402  return Current == RHS.Current && Filename == RHS.Filename;
403  }
404 
405  const FunctionRecord &operator*() const { return *Current; }
406 
408  assert(Current != Records.end() && "incremented past end");
409  ++Current;
410  skipOtherFiles();
411  return *this;
412  }
413 };
414 
415 /// Coverage information for a macro expansion or #included file.
416 ///
417 /// When covered code has pieces that can be expanded for more detail, such as a
418 /// preprocessor macro use and its definition, these are represented as
419 /// expansions whose coverage can be looked up independently.
421  /// The abstract file this expansion covers.
422  unsigned FileID;
423  /// The region that expands to this record.
425  /// Coverage for the expansion.
427 
429  const FunctionRecord &Function)
430  : FileID(Region.ExpandedFileID), Region(Region), Function(Function) {}
431 };
432 
433 /// The execution count information starting at a point in a file.
434 ///
435 /// A sequence of CoverageSegments gives execution counts for a file in format
436 /// that's simple to iterate through for processing.
438  /// The line where this segment begins.
439  unsigned Line;
440  /// The column where this segment begins.
441  unsigned Col;
442  /// The execution count, or zero if no count was recorded.
443  uint64_t Count;
444  /// When false, the segment was uninstrumented or skipped.
445  bool HasCount;
446  /// Whether this enters a new region or returns to a previous count.
448  /// Whether this enters a gap region.
450 
451  CoverageSegment(unsigned Line, unsigned Col, bool IsRegionEntry)
452  : Line(Line), Col(Col), Count(0), HasCount(false),
454 
455  CoverageSegment(unsigned Line, unsigned Col, uint64_t Count,
456  bool IsRegionEntry, bool IsGapRegion = false,
457  bool IsBranchRegion = false)
458  : Line(Line), Col(Col), Count(Count), HasCount(true),
460 
461  friend bool operator==(const CoverageSegment &L, const CoverageSegment &R) {
462  return std::tie(L.Line, L.Col, L.Count, L.HasCount, L.IsRegionEntry,
463  L.IsGapRegion) == std::tie(R.Line, R.Col, R.Count,
464  R.HasCount, R.IsRegionEntry,
465  R.IsGapRegion);
466  }
467 };
468 
469 /// An instantiation group contains a \c FunctionRecord list, such that each
470 /// record corresponds to a distinct instantiation of the same function.
471 ///
472 /// Note that it's possible for a function to have more than one instantiation
473 /// (consider C++ template specializations or static inline functions).
475  friend class CoverageMapping;
476 
477  unsigned Line;
478  unsigned Col;
479  std::vector<const FunctionRecord *> Instantiations;
480 
481  InstantiationGroup(unsigned Line, unsigned Col,
482  std::vector<const FunctionRecord *> Instantiations)
483  : Line(Line), Col(Col), Instantiations(std::move(Instantiations)) {}
484 
485 public:
486  InstantiationGroup(const InstantiationGroup &) = delete;
488 
489  /// Get the number of instantiations in this group.
490  size_t size() const { return Instantiations.size(); }
491 
492  /// Get the line where the common function was defined.
493  unsigned getLine() const { return Line; }
494 
495  /// Get the column where the common function was defined.
496  unsigned getColumn() const { return Col; }
497 
498  /// Check if the instantiations in this group have a common mangled name.
499  bool hasName() const {
500  for (unsigned I = 1, E = Instantiations.size(); I < E; ++I)
501  if (Instantiations[I]->Name != Instantiations[0]->Name)
502  return false;
503  return true;
504  }
505 
506  /// Get the common mangled name for instantiations in this group.
507  StringRef getName() const {
508  assert(hasName() && "Instantiations don't have a shared name");
509  return Instantiations[0]->Name;
510  }
511 
512  /// Get the total execution count of all instantiations in this group.
513  uint64_t getTotalExecutionCount() const {
514  uint64_t Count = 0;
515  for (const FunctionRecord *F : Instantiations)
516  Count += F->ExecutionCount;
517  return Count;
518  }
519 
520  /// Get the instantiations in this group.
522  return Instantiations;
523  }
524 };
525 
526 /// Coverage information to be processed or displayed.
527 ///
528 /// This represents the coverage of an entire file, expansion, or function. It
529 /// provides a sequence of CoverageSegments to iterate through, as well as the
530 /// list of expansions that can be further processed.
532  friend class CoverageMapping;
533 
534  std::string Filename;
535  std::vector<CoverageSegment> Segments;
536  std::vector<ExpansionRecord> Expansions;
537  std::vector<CountedRegion> BranchRegions;
538 
539 public:
540  CoverageData() = default;
541 
542  CoverageData(StringRef Filename) : Filename(Filename) {}
543 
544  /// Get the name of the file this data covers.
545  StringRef getFilename() const { return Filename; }
546 
547  /// Get an iterator over the coverage segments for this object. The segments
548  /// are guaranteed to be uniqued and sorted by location.
549  std::vector<CoverageSegment>::const_iterator begin() const {
550  return Segments.begin();
551  }
552 
553  std::vector<CoverageSegment>::const_iterator end() const {
554  return Segments.end();
555  }
556 
557  bool empty() const { return Segments.empty(); }
558 
559  /// Expansions that can be further processed.
560  ArrayRef<ExpansionRecord> getExpansions() const { return Expansions; }
561 
562  /// Branches that can be further processed.
563  ArrayRef<CountedRegion> getBranches() const { return BranchRegions; }
564 };
565 
566 /// The mapping of profile information to coverage data.
567 ///
568 /// This is the main interface to get coverage information, using a profile to
569 /// fill out execution counts.
571  DenseMap<size_t, DenseSet<size_t>> RecordProvenance;
572  std::vector<FunctionRecord> Functions;
573  DenseMap<size_t, SmallVector<unsigned, 0>> FilenameHash2RecordIndices;
574  std::vector<std::pair<std::string, uint64_t>> FuncHashMismatches;
575 
576  CoverageMapping() = default;
577 
578  // Load coverage records from readers.
579  static Error loadFromReaders(
580  ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
581  IndexedInstrProfReader &ProfileReader, CoverageMapping &Coverage);
582 
583  /// Add a function record corresponding to \p Record.
584  Error loadFunctionRecord(const CoverageMappingRecord &Record,
585  IndexedInstrProfReader &ProfileReader);
586 
587  /// Look up the indices for function records which are at least partially
588  /// defined in the specified file. This is guaranteed to return a superset of
589  /// such records: extra records not in the file may be included if there is
590  /// a hash collision on the filename. Clients must be robust to collisions.
592  getImpreciseRecordIndicesForFilename(StringRef Filename) const;
593 
594 public:
595  CoverageMapping(const CoverageMapping &) = delete;
596  CoverageMapping &operator=(const CoverageMapping &) = delete;
597 
598  /// Load the coverage mapping using the given readers.
600  load(ArrayRef<std::unique_ptr<CoverageMappingReader>> CoverageReaders,
601  IndexedInstrProfReader &ProfileReader);
602 
603  /// Load the coverage mapping from the given object files and profile. If
604  /// \p Arches is non-empty, it must specify an architecture for each object.
605  /// Ignores non-instrumented object files unless all are not instrumented.
607  load(ArrayRef<StringRef> ObjectFilenames, StringRef ProfileFilename,
608  ArrayRef<StringRef> Arches = None, StringRef CompilationDir = "");
609 
610  /// The number of functions that couldn't have their profiles mapped.
611  ///
612  /// This is a count of functions whose profile is out of date or otherwise
613  /// can't be associated with any coverage information.
614  unsigned getMismatchedCount() const { return FuncHashMismatches.size(); }
615 
616  /// A hash mismatch occurs when a profile record for a symbol does not have
617  /// the same hash as a coverage mapping record for the same symbol. This
618  /// returns a list of hash mismatches, where each mismatch is a pair of the
619  /// symbol name and its coverage mapping hash.
621  return FuncHashMismatches;
622  }
623 
624  /// Returns a lexicographically sorted, unique list of files that are
625  /// covered.
626  std::vector<StringRef> getUniqueSourceFiles() const;
627 
628  /// Get the coverage for a particular file.
629  ///
630  /// The given filename must be the name as recorded in the coverage
631  /// information. That is, only names returned from getUniqueSourceFiles will
632  /// yield a result.
633  CoverageData getCoverageForFile(StringRef Filename) const;
634 
635  /// Get the coverage for a particular function.
637 
638  /// Get the coverage for an expansion within a coverage set.
639  CoverageData getCoverageForExpansion(const ExpansionRecord &Expansion) const;
640 
641  /// Gets all of the functions covered by this profile.
643  return make_range(FunctionRecordIterator(Functions),
645  }
646 
647  /// Gets all of the functions in a particular file.
649  getCoveredFunctions(StringRef Filename) const {
650  return make_range(FunctionRecordIterator(Functions, Filename),
652  }
653 
654  /// Get the list of function instantiation groups in a particular file.
655  ///
656  /// Every instantiation group in a program is attributed to exactly one file:
657  /// the file in which the definition for the common function begins.
658  std::vector<InstantiationGroup>
659  getInstantiationGroups(StringRef Filename) const;
660 };
661 
662 /// Coverage statistics for a single line.
664  uint64_t ExecutionCount;
665  bool HasMultipleRegions;
666  bool Mapped;
667  unsigned Line;
669  const CoverageSegment *WrappedSegment;
670 
671  friend class LineCoverageIterator;
672  LineCoverageStats() = default;
673 
674 public:
676  const CoverageSegment *WrappedSegment, unsigned Line);
677 
678  uint64_t getExecutionCount() const { return ExecutionCount; }
679 
680  bool hasMultipleRegions() const { return HasMultipleRegions; }
681 
682  bool isMapped() const { return Mapped; }
683 
684  unsigned getLine() const { return Line; }
685 
687  return LineSegments;
688  }
689 
690  const CoverageSegment *getWrappedSegment() const { return WrappedSegment; }
691 };
692 
693 /// An iterator over the \c LineCoverageStats objects for lines described by
694 /// a \c CoverageData instance.
696  : public iterator_facade_base<
697  LineCoverageIterator, std::forward_iterator_tag, LineCoverageStats> {
698 public:
700  : LineCoverageIterator(CD, CD.begin()->Line) {}
701 
702  LineCoverageIterator(const CoverageData &CD, unsigned Line)
703  : CD(CD), WrappedSegment(nullptr), Next(CD.begin()), Ended(false),
704  Line(Line), Segments(), Stats() {
705  this->operator++();
706  }
707 
708  bool operator==(const LineCoverageIterator &R) const {
709  return &CD == &R.CD && Next == R.Next && Ended == R.Ended;
710  }
711 
712  const LineCoverageStats &operator*() const { return Stats; }
713 
714  LineCoverageStats &operator*() { return Stats; }
715 
717 
719  auto EndIt = *this;
720  EndIt.Next = CD.end();
721  EndIt.Ended = true;
722  return EndIt;
723  }
724 
725 private:
726  const CoverageData &CD;
727  const CoverageSegment *WrappedSegment;
728  std::vector<CoverageSegment>::const_iterator Next;
729  bool Ended;
730  unsigned Line;
732  LineCoverageStats Stats;
733 };
734 
735 /// Get a \c LineCoverageIterator range for the lines described by \p CD.
738  auto Begin = LineCoverageIterator(CD);
739  auto End = Begin.getEnd();
740  return make_range(Begin, End);
741 }
742 
743 // Coverage mappping data (V2) has the following layout:
744 // IPSK_covmap:
745 // [CoverageMapFileHeader]
746 // [ArrayStart]
747 // [CovMapFunctionRecordV2]
748 // [CovMapFunctionRecordV2]
749 // ...
750 // [ArrayEnd]
751 // [Encoded Filenames and Region Mapping Data]
752 //
753 // Coverage mappping data (V3) has the following layout:
754 // IPSK_covmap:
755 // [CoverageMapFileHeader]
756 // [Encoded Filenames]
757 // IPSK_covfun:
758 // [ArrayStart]
759 // odr_name_1: [CovMapFunctionRecordV3]
760 // odr_name_2: [CovMapFunctionRecordV3]
761 // ...
762 // [ArrayEnd]
763 //
764 // Both versions of the coverage mapping format encode the same information,
765 // but the V3 format does so more compactly by taking advantage of linkonce_odr
766 // semantics (it allows exactly 1 function record per name reference).
767 
768 /// This namespace defines accessors shared by different versions of coverage
769 /// mapping records.
770 namespace accessors {
771 
772 /// Return the structural hash associated with the function.
773 template <class FuncRecordTy, support::endianness Endian>
774 uint64_t getFuncHash(const FuncRecordTy *Record) {
775  return support::endian::byte_swap<uint64_t, Endian>(Record->FuncHash);
776 }
777 
778 /// Return the coverage map data size for the function.
779 template <class FuncRecordTy, support::endianness Endian>
780 uint64_t getDataSize(const FuncRecordTy *Record) {
781  return support::endian::byte_swap<uint32_t, Endian>(Record->DataSize);
782 }
783 
784 /// Return the function lookup key. The value is considered opaque.
785 template <class FuncRecordTy, support::endianness Endian>
786 uint64_t getFuncNameRef(const FuncRecordTy *Record) {
787  return support::endian::byte_swap<uint64_t, Endian>(Record->NameRef);
788 }
789 
790 /// Return the PGO name of the function. Used for formats in which the name is
791 /// a hash.
792 template <class FuncRecordTy, support::endianness Endian>
793 Error getFuncNameViaRef(const FuncRecordTy *Record,
794  InstrProfSymtab &ProfileNames, StringRef &FuncName) {
795  uint64_t NameRef = getFuncNameRef<FuncRecordTy, Endian>(Record);
796  FuncName = ProfileNames.getFuncName(NameRef);
797  return Error::success();
798 }
799 
800 /// Read coverage mapping out-of-line, from \p MappingBuf. This is used when the
801 /// coverage mapping is attached to the file header, instead of to the function
802 /// record.
803 template <class FuncRecordTy, support::endianness Endian>
805  const char *MappingBuf) {
806  return {MappingBuf, size_t(getDataSize<FuncRecordTy, Endian>(Record))};
807 }
808 
809 /// Advance to the next out-of-line coverage mapping and its associated
810 /// function record.
811 template <class FuncRecordTy, support::endianness Endian>
812 std::pair<const char *, const FuncRecordTy *>
813 advanceByOneOutOfLine(const FuncRecordTy *Record, const char *MappingBuf) {
814  return {MappingBuf + getDataSize<FuncRecordTy, Endian>(Record), Record + 1};
815 }
816 
817 } // end namespace accessors
818 
820 template <class IntPtrT>
823 
824 #define COVMAP_V1
825 #define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Type Name;
827 #undef COVMAP_V1
828  CovMapFunctionRecordV1() = delete;
829 
830  template <support::endianness Endian> uint64_t getFuncHash() const {
831  return accessors::getFuncHash<ThisT, Endian>(this);
832  }
833 
834  template <support::endianness Endian> uint64_t getDataSize() const {
835  return accessors::getDataSize<ThisT, Endian>(this);
836  }
837 
838  /// Return function lookup key. The value is consider opaque.
839  template <support::endianness Endian> IntPtrT getFuncNameRef() const {
840  return support::endian::byte_swap<IntPtrT, Endian>(NamePtr);
841  }
842 
843  /// Return the PGO name of the function.
844  template <support::endianness Endian>
845  Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const {
846  IntPtrT NameRef = getFuncNameRef<Endian>();
847  uint32_t NameS = support::endian::byte_swap<uint32_t, Endian>(NameSize);
848  FuncName = ProfileNames.getFuncName(NameRef, NameS);
849  if (NameS && FuncName.empty())
850  return make_error<CoverageMapError>(coveragemap_error::malformed);
851  return Error::success();
852  }
853 
854  template <support::endianness Endian>
855  std::pair<const char *, const ThisT *>
856  advanceByOne(const char *MappingBuf) const {
857  return accessors::advanceByOneOutOfLine<ThisT, Endian>(this, MappingBuf);
858  }
859 
860  template <support::endianness Endian> uint64_t getFilenamesRef() const {
861  llvm_unreachable("V1 function format does not contain a filenames ref");
862  }
863 
864  template <support::endianness Endian>
865  StringRef getCoverageMapping(const char *MappingBuf) const {
866  return accessors::getCoverageMappingOutOfLine<ThisT, Endian>(this,
867  MappingBuf);
868  }
869 };
870 
873 
874 #define COVMAP_V2
875 #define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Type Name;
877 #undef COVMAP_V2
878  CovMapFunctionRecordV2() = delete;
879 
880  template <support::endianness Endian> uint64_t getFuncHash() const {
881  return accessors::getFuncHash<ThisT, Endian>(this);
882  }
883 
884  template <support::endianness Endian> uint64_t getDataSize() const {
885  return accessors::getDataSize<ThisT, Endian>(this);
886  }
887 
888  template <support::endianness Endian> uint64_t getFuncNameRef() const {
889  return accessors::getFuncNameRef<ThisT, Endian>(this);
890  }
891 
892  template <support::endianness Endian>
893  Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const {
894  return accessors::getFuncNameViaRef<ThisT, Endian>(this, ProfileNames,
895  FuncName);
896  }
897 
898  template <support::endianness Endian>
899  std::pair<const char *, const ThisT *>
900  advanceByOne(const char *MappingBuf) const {
901  return accessors::advanceByOneOutOfLine<ThisT, Endian>(this, MappingBuf);
902  }
903 
904  template <support::endianness Endian> uint64_t getFilenamesRef() const {
905  llvm_unreachable("V2 function format does not contain a filenames ref");
906  }
907 
908  template <support::endianness Endian>
909  StringRef getCoverageMapping(const char *MappingBuf) const {
910  return accessors::getCoverageMappingOutOfLine<ThisT, Endian>(this,
911  MappingBuf);
912  }
913 };
914 
917 
918 #define COVMAP_V3
919 #define COVMAP_FUNC_RECORD(Type, LLVMType, Name, Init) Type Name;
921 #undef COVMAP_V3
922  CovMapFunctionRecordV3() = delete;
923 
924  template <support::endianness Endian> uint64_t getFuncHash() const {
925  return accessors::getFuncHash<ThisT, Endian>(this);
926  }
927 
928  template <support::endianness Endian> uint64_t getDataSize() const {
929  return accessors::getDataSize<ThisT, Endian>(this);
930  }
931 
932  template <support::endianness Endian> uint64_t getFuncNameRef() const {
933  return accessors::getFuncNameRef<ThisT, Endian>(this);
934  }
935 
936  template <support::endianness Endian>
937  Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const {
938  return accessors::getFuncNameViaRef<ThisT, Endian>(this, ProfileNames,
939  FuncName);
940  }
941 
942  /// Get the filename set reference.
943  template <support::endianness Endian> uint64_t getFilenamesRef() const {
944  return support::endian::byte_swap<uint64_t, Endian>(FilenamesRef);
945  }
946 
947  /// Read the inline coverage mapping. Ignore the buffer parameter, it is for
948  /// out-of-line coverage mapping data only.
949  template <support::endianness Endian>
950  StringRef getCoverageMapping(const char *) const {
951  return StringRef(&CoverageMapping, getDataSize<Endian>());
952  }
953 
954  // Advance to the next inline coverage mapping and its associated function
955  // record. Ignore the out-of-line coverage mapping buffer.
956  template <support::endianness Endian>
957  std::pair<const char *, const CovMapFunctionRecordV3 *>
958  advanceByOne(const char *) const {
959  assert(isAddrAligned(Align(8), this) && "Function record not aligned");
960  const char *Next = ((const char *)this) + sizeof(CovMapFunctionRecordV3) -
961  sizeof(char) + getDataSize<Endian>();
962  // Each function record has an alignment of 8, so we need to adjust
963  // alignment before reading the next record.
964  Next += offsetToAlignedAddr(Next, Align(8));
965  return {nullptr, reinterpret_cast<const CovMapFunctionRecordV3 *>(Next)};
966  }
967 };
968 
969 // Per module coverage mapping data header, i.e. CoverageMapFileHeader
970 // documented above.
971 struct CovMapHeader {
972 #define COVMAP_HEADER(Type, LLVMType, Name, Init) Type Name;
974  template <support::endianness Endian> uint32_t getNRecords() const {
975  return support::endian::byte_swap<uint32_t, Endian>(NRecords);
976  }
977 
978  template <support::endianness Endian> uint32_t getFilenamesSize() const {
979  return support::endian::byte_swap<uint32_t, Endian>(FilenamesSize);
980  }
981 
982  template <support::endianness Endian> uint32_t getCoverageSize() const {
983  return support::endian::byte_swap<uint32_t, Endian>(CoverageSize);
984  }
985 
986  template <support::endianness Endian> uint32_t getVersion() const {
987  return support::endian::byte_swap<uint32_t, Endian>(Version);
988  }
989 };
990 
992 
994  Version1 = 0,
995  // Function's name reference from CovMapFuncRecord is changed from raw
996  // name string pointer to MD5 to support name section compression. Name
997  // section is also compressed.
998  Version2 = 1,
999  // A new interpretation of the columnEnd field is added in order to mark
1000  // regions as gap areas.
1002  // Function records are named, uniqued, and moved to a dedicated section.
1004  // Branch regions referring to two counters are added
1006  // Compilation directory is stored separately and combined with relative
1007  // filenames to produce an absolute file path.
1009  // The current version is Version6.
1010  CurrentVersion = INSTR_PROF_COVMAP_VERSION
1011 };
1012 
1013 template <int CovMapVersion, class IntPtrT> struct CovMapTraits {
1015  using NameRefType = uint64_t;
1016 };
1017 
1018 template <class IntPtrT> struct CovMapTraits<CovMapVersion::Version3, IntPtrT> {
1020  using NameRefType = uint64_t;
1021 };
1022 
1023 template <class IntPtrT> struct CovMapTraits<CovMapVersion::Version2, IntPtrT> {
1025  using NameRefType = uint64_t;
1026 };
1027 
1028 template <class IntPtrT> struct CovMapTraits<CovMapVersion::Version1, IntPtrT> {
1030  using NameRefType = IntPtrT;
1031 };
1032 
1033 } // end namespace coverage
1034 
1035 /// Provide DenseMapInfo for CounterExpression
1036 template<> struct DenseMapInfo<coverage::CounterExpression> {
1038  using namespace coverage;
1039 
1040  return CounterExpression(CounterExpression::ExprKind::Subtract,
1041  Counter::getCounter(~0U),
1042  Counter::getCounter(~0U));
1043  }
1044 
1046  using namespace coverage;
1047 
1048  return CounterExpression(CounterExpression::ExprKind::Add,
1049  Counter::getCounter(~0U),
1050  Counter::getCounter(~0U));
1051  }
1052 
1053  static unsigned getHashValue(const coverage::CounterExpression &V) {
1054  return static_cast<unsigned>(
1056  V.RHS.getKind(), V.RHS.getCounterID()));
1057  }
1058 
1059  static bool isEqual(const coverage::CounterExpression &LHS,
1060  const coverage::CounterExpression &RHS) {
1061  return LHS.Kind == RHS.Kind && LHS.LHS == RHS.LHS && LHS.RHS == RHS.RHS;
1062  }
1063 };
1064 
1065 } // end namespace llvm
1066 
1067 #endif // LLVM_PROFILEDATA_COVERAGE_COVERAGEMAPPING_H
llvm::coverage::Counter::getExpression
static Counter getExpression(unsigned ExpressionId)
Return the counter that corresponds to a specific addition counter expression.
Definition: CoverageMapping.h:142
llvm::coverage::CounterMappingRegion::makeGapRegion
static CounterMappingRegion makeGapRegion(Counter Count, unsigned FileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd)
Definition: CoverageMapping.h:281
llvm::coverage::coveragemap_error::success
@ success
llvm::coverage::CounterMappingRegion::ColumnEnd
unsigned ColumnEnd
Definition: CoverageMapping.h:239
llvm::coverage::CounterExpression::LHS
Counter LHS
Definition: CoverageMapping.h:152
llvm::coverage::CounterExpression
A Counter expression is a value that represents an arithmetic operation with two counters.
Definition: CoverageMapping.h:149
llvm::coverage::CovMapTraits
Definition: CoverageMapping.h:1013
LLVM_PACKED_END
#define LLVM_PACKED_END
Definition: Compiler.h:398
llvm::coverage::CoverageData::empty
bool empty() const
Definition: CoverageMapping.h:557
llvm::coverage::CoverageMapping::getCoverageForExpansion
CoverageData getCoverageForExpansion(const ExpansionRecord &Expansion) const
Get the coverage for an expansion within a coverage set.
Definition: CoverageMapping.cpp:782
llvm::coverage::CounterExpressionBuilder
A Counter expression builder is used to construct the counter expressions.
Definition: CoverageMapping.h:160
llvm::coverage::CoverageMapping::getInstantiationGroups
std::vector< InstantiationGroup > getInstantiationGroups(StringRef Filename) const
Get the list of function instantiation groups in a particular file.
Definition: CoverageMapping.cpp:732
llvm::DenseMapInfo< coverage::CounterExpression >::getTombstoneKey
static coverage::CounterExpression getTombstoneKey()
Definition: CoverageMapping.h:1045
llvm::coverage::CoverageData::end
std::vector< CoverageSegment >::const_iterator end() const
Definition: CoverageMapping.h:553
llvm::coverage::Counter::isZero
bool isZero() const
Definition: CoverageMapping.h:112
llvm::coverage::CovMapFunctionRecordV3::CovMapFunctionRecordV3
CovMapFunctionRecordV3()=delete
llvm::coverage::FunctionRecord::Filenames
std::vector< std::string > Filenames
Mapping from FileID (i.e.
Definition: CoverageMapping.h:351
llvm::coverage::CovMapFunctionRecordV1::CovMapFunctionRecordV1
CovMapFunctionRecordV1()=delete
llvm::coverage::CounterMappingRegion::Count
Counter Count
Primary Counter that is also used for Branch Regions (TrueCount).
Definition: CoverageMapping.h:233
llvm
Definition: AllocatorList.h:23
llvm::coverage::Version4
@ Version4
Definition: CoverageMapping.h:1003
llvm::coverage::CovMapTraits::NameRefType
uint64_t NameRefType
Definition: CoverageMapping.h:1015
llvm::coverage::CounterMappingRegion::endLoc
LineColPair endLoc() const
Definition: CoverageMapping.h:299
llvm::coverage::CountedRegion::FalseExecutionCount
uint64_t FalseExecutionCount
Definition: CoverageMapping.h:305
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:153
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
LLVM_PACKED_START
#define LLVM_PACKED_START
Definition: Compiler.h:397
llvm::coverage::CoverageMapError
Definition: CoverageMapping.h:68
llvm::coverage::InstantiationGroup::getName
StringRef getName() const
Get the common mangled name for instantiations in this group.
Definition: CoverageMapping.h:507
llvm::coverage::CounterExpressionBuilder::subtract
Counter subtract(Counter LHS, Counter RHS)
Return a counter that represents the expression that subtracts RHS from LHS.
Definition: CoverageMapping.cpp:130
llvm::coverage::CoverageMapError::get
coveragemap_error get() const
Definition: CoverageMapping.h:82
llvm::coverage::CounterMappingRegion::LineStart
unsigned LineStart
Definition: CoverageMapping.h:239
llvm::coverage::CounterMappingRegion::FileID
unsigned FileID
Definition: CoverageMapping.h:238
llvm::coverage::coveragemap_error::no_data_found
@ no_data_found
llvm::coverage::FunctionRecordIterator::FunctionRecordIterator
FunctionRecordIterator()
Definition: CoverageMapping.h:399
llvm::coverage::CoverageMapping::getCoveredFunctions
iterator_range< FunctionRecordIterator > getCoveredFunctions(StringRef Filename) const
Gets all of the functions in a particular file.
Definition: CoverageMapping.h:649
llvm::coverage::CoverageMappingReader
Definition: CoverageMappingReader.h:99
llvm::coverage::Version3
@ Version3
Definition: CoverageMapping.h:1001
llvm::coverage::CounterExpression::ExprKind
ExprKind
Definition: CoverageMapping.h:150
llvm::coverage::CovMapVersion
CovMapVersion
Definition: CoverageMapping.h:993
llvm::Function
Definition: Function.h:61
llvm::coverage::CounterExpression::Subtract
@ Subtract
Definition: CoverageMapping.h:150
llvm::coverage::CounterMappingRegion
A Counter mapping region associates a source range with a specific counter.
Definition: CoverageMapping.h:208
StringRef.h
llvm::coverage::CoverageData::getBranches
ArrayRef< CountedRegion > getBranches() const
Branches that can be further processed.
Definition: CoverageMapping.h:563
llvm::coverage::LineCoverageIterator::operator==
bool operator==(const LineCoverageIterator &R) const
Definition: CoverageMapping.h:708
llvm::coverage::CountedRegion::CountedRegion
CountedRegion(const CounterMappingRegion &R, uint64_t ExecutionCount, uint64_t FalseExecutionCount)
Definition: CoverageMapping.h:312
llvm::coverage::CoverageData::getExpansions
ArrayRef< ExpansionRecord > getExpansions() const
Expansions that can be further processed.
Definition: CoverageMapping.h:560
llvm::coverage::CovMapFunctionRecordV2::getFuncHash
uint64_t getFuncHash() const
Definition: CoverageMapping.h:880
llvm::ArrayRef::iterator
const_pointer iterator
Definition: ArrayRef.h:50
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1167
llvm::coverage::CovMapFunctionRecordV1
Definition: CoverageMapping.h:821
llvm::coverage::LineCoverageIterator
An iterator over the LineCoverageStats objects for lines described by a CoverageData instance.
Definition: CoverageMapping.h:695
llvm::coverage::LineCoverageStats::getLine
unsigned getLine() const
Definition: CoverageMapping.h:684
llvm::coverage::Counter::Expression
@ Expression
Definition: CoverageMapping.h:95
llvm::coverage::LineCoverageStats::getWrappedSegment
const CoverageSegment * getWrappedSegment() const
Definition: CoverageMapping.h:690
llvm::coverage::CounterExpression::RHS
Counter RHS
Definition: CoverageMapping.h:152
llvm::Error::success
static ErrorSuccess success()
Create a success value.
Definition: Error.h:332
llvm::coverage::CovMapTraits< CovMapVersion::Version1, IntPtrT >::NameRefType
IntPtrT NameRefType
Definition: CoverageMapping.h:1030
llvm::coverage::Counter::operator!=
friend bool operator!=(const Counter &LHS, const Counter &RHS)
Definition: CoverageMapping.h:124
llvm::coverage::FunctionRecord::FunctionRecord
FunctionRecord(StringRef Name, ArrayRef< StringRef > Filenames)
Definition: CoverageMapping.h:359
Error.h
llvm::coverage::Counter::getCounter
static Counter getCounter(unsigned CounterId)
Return the counter that corresponds to a specific profile counter.
Definition: CoverageMapping.h:136
llvm::coverage::CounterMappingRegion::makeSkipped
static CounterMappingRegion makeSkipped(unsigned FileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd)
Definition: CoverageMapping.h:274
llvm::coverage::CounterExpressionBuilder::add
Counter add(Counter LHS, Counter RHS)
Return a counter that represents the expression that adds LHS and RHS.
Definition: CoverageMapping.cpp:126
llvm::coverage::accessors::getFuncHash
uint64_t getFuncHash(const FuncRecordTy *Record)
Return the structural hash associated with the function.
Definition: CoverageMapping.h:774
llvm::coverage::Counter::CounterValueReference
@ CounterValueReference
Definition: CoverageMapping.h:95
llvm::coverage::FunctionRecordIterator::operator++
FunctionRecordIterator & operator++()
Definition: CoverageMapping.h:407
llvm::coverage::CounterMappingRegion::makeBranchRegion
static CounterMappingRegion makeBranchRegion(Counter Count, Counter FalseCount, unsigned FileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd)
Definition: CoverageMapping.h:288
DenseMap.h
llvm::sys::path::end
const_iterator end(StringRef path)
Get end iterator over path.
Definition: Path.cpp:233
llvm::sys::path::begin
const_iterator begin(StringRef path, Style style=Style::native)
Get begin iterator over path.
Definition: Path.cpp:224
llvm::coverage::coveragemap_error
coveragemap_error
Definition: CoverageMapping.h:51
llvm::coverage::CovMapFunctionRecordV1::getFuncNameRef
IntPtrT getFuncNameRef() const
Return function lookup key. The value is consider opaque.
Definition: CoverageMapping.h:839
llvm::coverage::CoverageSegment::IsRegionEntry
bool IsRegionEntry
Whether this enters a new region or returns to a previous count.
Definition: CoverageMapping.h:447
llvm::coverage::CounterMappingRegion::ExpansionRegion
@ ExpansionRegion
An ExpansionRegion represents a file expansion region that associates a source range with the expansi...
Definition: CoverageMapping.h:216
Hashing.h
llvm::coverage::InstantiationGroup::getLine
unsigned getLine() const
Get the line where the common function was defined.
Definition: CoverageMapping.h:493
llvm::coverage::CounterExpression::Add
@ Add
Definition: CoverageMapping.h:150
llvm::coverage::LineCoverageStats::getLineSegments
ArrayRef< const CoverageSegment * > getLineSegments() const
Definition: CoverageMapping.h:686
llvm::Expected
Tagged union holding either a T or a Error.
Definition: APFloat.h:42
llvm::coverage::Counter::CounterKind
CounterKind
The CounterExpression kind (Add or Subtract) is encoded in bit 0 next to the CounterKind.
Definition: CoverageMapping.h:95
llvm::DenseMapInfo< coverage::CounterExpression >::isEqual
static bool isEqual(const coverage::CounterExpression &LHS, const coverage::CounterExpression &RHS)
Definition: CoverageMapping.h:1059
llvm::coverage::InstantiationGroup::getInstantiations
ArrayRef< const FunctionRecord * > getInstantiations() const
Get the instantiations in this group.
Definition: CoverageMapping.h:521
llvm::M68kBeads::Term
@ Term
Definition: M68kBaseInfo.h:71
llvm::coverage::CovMapHeader::getFilenamesSize
uint32_t getFilenamesSize() const
Definition: CoverageMapping.h:978
llvm::coverage::coveragemap_error::unsupported_version
@ unsupported_version
llvm::coverage::CounterMappingRegion::Kind
RegionKind Kind
Definition: CoverageMapping.h:240
llvm::coverage::CoverageSegment::IsGapRegion
bool IsGapRegion
Whether this enters a gap region.
Definition: CoverageMapping.h:449
llvm::coverage::CoverageMapError::message
std::string message() const override
Return the error message as a string.
Definition: CoverageMapping.cpp:894
llvm::coverage::CoverageData::getFilename
StringRef getFilename() const
Get the name of the file this data covers.
Definition: CoverageMapping.h:545
llvm::coverage::CounterMappingRegion::CounterMappingRegion
CounterMappingRegion(Counter Count, Counter FalseCount, unsigned FileID, unsigned ExpandedFileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd, RegionKind Kind)
Definition: CoverageMapping.h:249
llvm::coverage::accessors::getCoverageMappingOutOfLine
StringRef getCoverageMappingOutOfLine(const FuncRecordTy *Record, const char *MappingBuf)
Read coverage mapping out-of-line, from MappingBuf.
Definition: CoverageMapping.h:804
llvm::coverage::CountedRegion::Folded
bool Folded
Definition: CoverageMapping.h:306
size_t
llvm::coverage::coveragemap_error::decompression_failed
@ decompression_failed
llvm::coverage::ExpansionRecord::Function
const FunctionRecord & Function
Coverage for the expansion.
Definition: CoverageMapping.h:426
F
#define F(x, y, z)
Definition: MD5.cpp:56
InstrProfData.inc
llvm::coverage::accessors::getDataSize
uint64_t getDataSize(const FuncRecordTy *Record)
Return the coverage map data size for the function.
Definition: CoverageMapping.h:780
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:132
llvm::coverage::CovMapFunctionRecordV3::getFuncName
Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const
Definition: CoverageMapping.h:937
llvm::coverage::CoverageMapError::log
void log(raw_ostream &OS) const override
Print an error message to an output stream.
Definition: CoverageMapping.h:76
llvm::coverage::coveragemap_error::eof
@ eof
llvm::coverage::Version1
@ Version1
Definition: CoverageMapping.h:994
llvm::coverage::LineCoverageIterator::operator++
LineCoverageIterator & operator++()
Definition: CoverageMapping.cpp:842
llvm::DenseMapInfo
Definition: APInt.h:34
llvm::coverage::CurrentVersion
@ CurrentVersion
Definition: CoverageMapping.h:1010
llvm::coverage::FunctionRecordIterator::FunctionRecordIterator
FunctionRecordIterator(ArrayRef< FunctionRecord > Records_, StringRef Filename="")
Definition: CoverageMapping.h:393
llvm::coverage::CovMapFunctionRecordV3::getFuncNameRef
uint64_t getFuncNameRef() const
Definition: CoverageMapping.h:932
llvm::coverage::LineColPair
std::pair< unsigned, unsigned > LineColPair
Definition: CoverageMapping.h:205
llvm::coverage::Counter::operator==
friend bool operator==(const Counter &LHS, const Counter &RHS)
Definition: CoverageMapping.h:120
llvm::coverage::Version5
@ Version5
Definition: CoverageMapping.h:1005
llvm::coverage::coveragemap_error::malformed
@ malformed
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::coverage::CovMapHeader::getVersion
uint32_t getVersion() const
Definition: CoverageMapping.h:986
llvm::coverage::CovMapFunctionRecordV2
Definition: CoverageMapping.h:871
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::coverage::CounterMappingRegion::LineEnd
unsigned LineEnd
Definition: CoverageMapping.h:239
llvm::coverage::CovMapFunctionRecordV3::getCoverageMapping
StringRef getCoverageMapping(const char *) const
Read the inline coverage mapping.
Definition: CoverageMapping.h:950
llvm::coverage::CovMapFunctionRecordV2::CovMapFunctionRecordV2
CovMapFunctionRecordV2()=delete
llvm::coverage::LineCoverageIterator::LineCoverageIterator
LineCoverageIterator(const CoverageData &CD, unsigned Line)
Definition: CoverageMapping.h:702
llvm::coverage::CoverageSegment::Line
unsigned Line
The line where this segment begins.
Definition: CoverageMapping.h:439
llvm::coverage::CoverageMapping::getCoverageForFunction
CoverageData getCoverageForFunction(const FunctionRecord &Function) const
Get the coverage for a particular function.
Definition: CoverageMapping.cpp:757
llvm::coverage::FunctionRecordIterator::operator==
bool operator==(const FunctionRecordIterator &RHS) const
Definition: CoverageMapping.h:401
llvm::coverage::CovMapFunctionRecordV2::getCoverageMapping
StringRef getCoverageMapping(const char *MappingBuf) const
Definition: CoverageMapping.h:909
llvm::coverage::FunctionRecord::CountedBranchRegions
std::vector< CountedRegion > CountedBranchRegions
Branch Regions in the function along with their counts.
Definition: CoverageMapping.h:355
llvm::coverage::LineCoverageIterator::getEnd
LineCoverageIterator getEnd() const
Definition: CoverageMapping.h:718
llvm::coverage::CounterMappingRegion::ExpandedFileID
unsigned ExpandedFileID
Definition: CoverageMapping.h:238
llvm::coverage::Counter::operator<
friend bool operator<(const Counter &LHS, const Counter &RHS)
Definition: CoverageMapping.h:128
llvm::coverage::CoverageMapping::getMismatchedCount
unsigned getMismatchedCount() const
The number of functions that couldn't have their profiles mapped.
Definition: CoverageMapping.h:614
DenseSet.h
false
Definition: StackSlotColoring.cpp:142
llvm::coverage::CoverageMapping::getUniqueSourceFiles
std::vector< StringRef > getUniqueSourceFiles() const
Returns a lexicographically sorted, unique list of files that are covered.
Definition: CoverageMapping.cpp:656
llvm::coverage::CovMapFunctionRecordV1::getFilenamesRef
uint64_t getFilenamesRef() const
Definition: CoverageMapping.h:860
InstrProf.h
llvm::coverage::InstantiationGroup::getTotalExecutionCount
uint64_t getTotalExecutionCount() const
Get the total execution count of all instantiations in this group.
Definition: CoverageMapping.h:513
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:50
llvm::coverage::coveragemap_error::invalid_or_missing_arch_specifier
@ invalid_or_missing_arch_specifier
llvm::coverage::CovMapFunctionRecordV2::getFuncName
Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const
Definition: CoverageMapping.h:893
llvm::coverage::CovMapFunctionRecordV3::getDataSize
uint64_t getDataSize() const
Definition: CoverageMapping.h:928
llvm::IndexedInstrProf::Version
const uint64_t Version
Definition: InstrProf.h:991
llvm::coverage::CovMapFunctionRecordV1::getCoverageMapping
StringRef getCoverageMapping(const char *MappingBuf) const
Definition: CoverageMapping.h:865
llvm::coverage::getLineCoverageStats
static iterator_range< LineCoverageIterator > getLineCoverageStats(const coverage::CoverageData &CD)
Get a LineCoverageIterator range for the lines described by CD.
Definition: CoverageMapping.h:737
Align
uint64_t Align
Definition: ELFObjHandler.cpp:83
llvm::coverage::CounterMappingContext::dump
void dump(const Counter &C, raw_ostream &OS) const
Definition: CoverageMapping.cpp:135
llvm::coverage::CoverageData::begin
std::vector< CoverageSegment >::const_iterator begin() const
Get an iterator over the coverage segments for this object.
Definition: CoverageMapping.h:549
llvm::None
const NoneType None
Definition: None.h:23
llvm::coverage::CounterMappingContext::evaluate
Expected< int64_t > evaluate(const Counter &C) const
Return the number of times that a region of code associated with this counter was executed.
Definition: CoverageMapping.cpp:165
llvm::coverage::CoverageSegment::HasCount
bool HasCount
When false, the segment was uninstrumented or skipped.
Definition: CoverageMapping.h:445
llvm::coverage::CounterMappingRegion::makeExpansion
static CounterMappingRegion makeExpansion(unsigned FileID, unsigned ExpandedFileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd)
Definition: CoverageMapping.h:266
llvm::coverage::coveragemap_error::truncated
@ truncated
llvm::coverage::make_error_code
std::error_code make_error_code(coveragemap_error E)
Definition: CoverageMapping.h:64
llvm::coverage::FunctionRecord
Code coverage information for a single function.
Definition: CoverageMapping.h:342
llvm::coverage::CoverageData::CoverageData
CoverageData(StringRef Filename)
Definition: CoverageMapping.h:542
llvm::COFF::NameSize
@ NameSize
Definition: COFF.h:58
llvm::coverage::CoverageSegment::CoverageSegment
CoverageSegment(unsigned Line, unsigned Col, bool IsRegionEntry)
Definition: CoverageMapping.h:451
llvm::DenseMapInfo< coverage::CounterExpression >::getEmptyKey
static coverage::CounterExpression getEmptyKey()
Definition: CoverageMapping.h:1037
llvm::coverage::CovMapFunctionRecordV3::getFuncHash
uint64_t getFuncHash() const
Definition: CoverageMapping.h:924
llvm::coverage::CounterMappingRegion::makeRegion
static CounterMappingRegion makeRegion(Counter Count, unsigned FileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd)
Definition: CoverageMapping.h:259
llvm::IndexedInstrProfReader
Reader for the indexed binary instrprof format.
Definition: InstrProfReader.h:451
llvm::DenseMap
Definition: DenseMap.h:714
llvm::coverage::CoverageMapping::operator=
CoverageMapping & operator=(const CoverageMapping &)=delete
llvm::coverage::CovMapFunctionRecordV1::getDataSize
uint64_t getDataSize() const
Definition: CoverageMapping.h:834
llvm::coverage::CountedRegion::CountedRegion
CountedRegion(const CounterMappingRegion &R, uint64_t ExecutionCount)
Definition: CoverageMapping.h:308
llvm::coverage::CovMapFunctionRecordV3
Definition: CoverageMapping.h:915
llvm::coverage::Counter
A Counter is an abstract value that describes how to compute the execution count for a region of code...
Definition: CoverageMapping.h:92
iterator.h
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::iterator_facade_base
CRTP base class which implements the entire standard iterator facade in terms of a minimal subset of ...
Definition: iterator.h:66
ArrayRef.h
llvm::coverage::CoverageSegment::operator==
friend bool operator==(const CoverageSegment &L, const CoverageSegment &R)
Definition: CoverageMapping.h:461
llvm::coverage::CounterMappingRegion::CounterMappingRegion
CounterMappingRegion(Counter Count, unsigned FileID, unsigned ExpandedFileID, unsigned LineStart, unsigned ColumnStart, unsigned LineEnd, unsigned ColumnEnd, RegionKind Kind)
Definition: CoverageMapping.h:242
llvm::coverage::coveragemap_category
const std::error_category & coveragemap_category()
Definition: CoverageMapping.cpp:900
llvm::coverage::CovMapFunctionRecordV2::getFuncNameRef
uint64_t getFuncNameRef() const
Definition: CoverageMapping.h:888
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::coverage::CovMapHeader
Definition: CoverageMapping.h:971
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1540
llvm::coverage::CounterMappingRegion::startLoc
LineColPair startLoc() const
Definition: CoverageMapping.h:295
llvm::coverage::ExpansionRecord::Region
const CountedRegion & Region
The region that expands to this record.
Definition: CoverageMapping.h:424
llvm::coverage::CovMapHeader::getNRecords
uint32_t getNRecords() const
Definition: CoverageMapping.h:974
llvm::coverage::CountedRegion::ExecutionCount
uint64_t ExecutionCount
Definition: CoverageMapping.h:304
iterator_range.h
llvm::coverage::CounterExpressionBuilder::getExpressions
ArrayRef< CounterExpression > getExpressions() const
Definition: CoverageMapping.h:195
llvm::coverage::CounterMappingContext::dump
void dump(const Counter &C) const
Definition: CoverageMapping.h:332
llvm::Record
Definition: Record.h:1472
llvm::ErrorInfo
Base class for user error types.
Definition: Error.h:350
llvm::coverage::ExpansionRecord::ExpansionRecord
ExpansionRecord(const CountedRegion &Region, const FunctionRecord &Function)
Definition: CoverageMapping.h:428
llvm::coverage::InstantiationGroup::getColumn
unsigned getColumn() const
Get the column where the common function was defined.
Definition: CoverageMapping.h:496
llvm::coverage::CounterMappingRegion::BranchRegion
@ BranchRegion
A BranchRegion represents leaf-level boolean expressions and is associated with two counters,...
Definition: CoverageMapping.h:229
llvm::coverage::LineCoverageIterator::operator*
LineCoverageStats & operator*()
Definition: CoverageMapping.h:714
llvm::coverage::CounterMappingRegion::GapRegion
@ GapRegion
A GapRegion is like a CodeRegion, but its count is only set as the line execution count when its the ...
Definition: CoverageMapping.h:224
llvm::coverage::FunctionRecord::ExecutionCount
uint64_t ExecutionCount
The number of times this function was executed.
Definition: CoverageMapping.h:357
llvm::offsetToAlignedAddr
uint64_t offsetToAlignedAddr(const void *Addr, Align Alignment)
Returns the necessary adjustment for aligning Addr to Alignment bytes, rounding up.
Definition: Alignment.h:202
llvm::coverage::Counter::isExpression
bool isExpression() const
Definition: CoverageMapping.h:114
llvm::Expression
Class representing an expression and its matching format.
Definition: FileCheckImpl.h:237
llvm::coverage::LineCoverageStats::getExecutionCount
uint64_t getExecutionCount() const
Definition: CoverageMapping.h:678
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:32
None.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::coverage::LineCoverageIterator::LineCoverageIterator
LineCoverageIterator(const CoverageData &CD)
Definition: CoverageMapping.h:699
llvm::coverage::Counter::EncodingCounterTagAndExpansionRegionTagBits
static const unsigned EncodingCounterTagAndExpansionRegionTagBits
Definition: CoverageMapping.h:98
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:136
llvm::coverage::CoverageMapping
The mapping of profile information to coverage data.
Definition: CoverageMapping.h:570
llvm::coverage::CovMapFunctionRecordV1::getFuncName
Error getFuncName(InstrProfSymtab &ProfileNames, StringRef &FuncName) const
Return the PGO name of the function.
Definition: CoverageMapping.h:845
llvm::coverage::CoverageMapping::getCoverageForFile
CoverageData getCoverageForFile(StringRef Filename) const
Get the coverage for a particular file.
Definition: CoverageMapping.cpp:701
uint32_t
Compiler.h
llvm::coverage::CounterMappingRegion::FalseCount
Counter FalseCount
Secondary Counter used for Branch Regions (FalseCount).
Definition: CoverageMapping.h:236
llvm::DenseMapInfo< coverage::CounterExpression >::getHashValue
static unsigned getHashValue(const coverage::CounterExpression &V)
Definition: CoverageMapping.h:1053
llvm::coverage::CovMapFunctionRecordV2::getFilenamesRef
uint64_t getFilenamesRef() const
Definition: CoverageMapping.h:904
llvm::coverage::CovMapFunctionRecordV2::getDataSize
uint64_t getDataSize() const
Definition: CoverageMapping.h:884
llvm::coverage::CoverageSegment::Count
uint64_t Count
The execution count, or zero if no count was recorded.
Definition: CoverageMapping.h:443
llvm::coverage::CounterMappingRegion::RegionKind
RegionKind
Definition: CoverageMapping.h:209
llvm::coverage::CoverageData
Coverage information to be processed or displayed.
Definition: CoverageMapping.h:531
Alignment.h
llvm::coverage::LineCoverageStats
Coverage statistics for a single line.
Definition: CoverageMapping.h:663
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
std
Definition: BitVector.h:838
llvm::InstrProfSymtab
A symbol table used for function PGO name look-up with keys (such as pointers, md5hash values) to the...
Definition: InstrProf.h:414
llvm::coverage::FunctionRecordIterator::operator*
const FunctionRecord & operator*() const
Definition: CoverageMapping.h:405
llvm::coverage::LineCoverageStats::hasMultipleRegions
bool hasMultipleRegions() const
Definition: CoverageMapping.h:680
llvm::coverage::CounterMappingContext::setCounts
void setCounts(ArrayRef< uint64_t > Counts)
Definition: CoverageMapping.h:329
llvm::coverage::CoverageMapError::ID
static char ID
Definition: CoverageMapping.h:84
llvm::coverage::FunctionRecordIterator
Iterator over Functions, optionally filtered to a single file.
Definition: CoverageMapping.h:382
llvm::coverage::ExpansionRecord::FileID
unsigned FileID
The abstract file this expansion covers.
Definition: CoverageMapping.h:422
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition: Error.h:157
llvm::coverage::CovMapTraits< CovMapVersion::Version3, IntPtrT >::NameRefType
uint64_t NameRefType
Definition: CoverageMapping.h:1020
llvm::isAddrAligned
bool isAddrAligned(Align Lhs, const void *Addr)
Checks that Addr is a multiple of the alignment.
Definition: Alignment.h:143
llvm::coverage::CovMapFunctionRecordV2::advanceByOne
std::pair< const char *, const ThisT * > advanceByOne(const char *MappingBuf) const
Definition: CoverageMapping.h:900
llvm::coverage::CounterMappingRegion::ColumnStart
unsigned ColumnStart
Definition: CoverageMapping.h:239
llvm::coverage::CounterExpression::CounterExpression
CounterExpression(ExprKind Kind, Counter LHS, Counter RHS)
Definition: CoverageMapping.h:154
llvm::coverage::LineCoverageStats::isMapped
bool isMapped() const
Definition: CoverageMapping.h:682
llvm::coverage::FunctionRecord::Name
std::string Name
Raw function name.
Definition: CoverageMapping.h:344
llvm::coverage::CoverageMapping::load
static Expected< std::unique_ptr< CoverageMapping > > load(ArrayRef< std::unique_ptr< CoverageMappingReader >> CoverageReaders, IndexedInstrProfReader &ProfileReader)
Load the coverage mapping using the given readers.
Definition: CoverageMapping.cpp:326
llvm::coverage::CounterMappingContext
A Counter mapping context is used to connect the counters, expressions and the obtained counter value...
Definition: CoverageMapping.h:320
llvm::MCID::Add
@ Add
Definition: MCInstrDesc.h:183
llvm::coverage::FunctionRecord::pushRegion
void pushRegion(CounterMappingRegion Region, uint64_t Count, uint64_t FalseCount)
Definition: CoverageMapping.h:365
llvm::coverage::Counter::getCounterID
unsigned getCounterID() const
Definition: CoverageMapping.h:116
llvm::coverage::FunctionRecord::operator=
FunctionRecord & operator=(FunctionRecord &&)=default
llvm::coverage::CoverageData::CoverageData
CoverageData()=default
llvm::InstrProfSymtab::getFuncName
StringRef getFuncName(uint64_t FuncNameAddress, size_t NameSize)
Return function's PGO name from the function name's symbol address in the object file.
Definition: CoverageMappingReader.cpp:463
llvm::coverage::accessors::getFuncNameViaRef
Error getFuncNameViaRef(const FuncRecordTy *Record, InstrProfSymtab &ProfileNames, StringRef &FuncName)
Return the PGO name of the function.
Definition: CoverageMapping.h:793
llvm::coverage::InstantiationGroup::hasName
bool hasName() const
Check if the instantiations in this group have a common mangled name.
Definition: CoverageMapping.h:499
llvm::coverage::accessors::advanceByOneOutOfLine
std::pair< const char *, const FuncRecordTy * > advanceByOneOutOfLine(const FuncRecordTy *Record, const char *MappingBuf)
Advance to the next out-of-line coverage mapping and its associated function record.
Definition: CoverageMapping.h:813
llvm::coverage::CovMapFunctionRecordV1::getFuncHash
uint64_t getFuncHash() const
Definition: CoverageMapping.h:830
llvm::coverage::Counter::Zero
@ Zero
Definition: CoverageMapping.h:95
llvm::coverage::Counter::Counter
Counter()=default
llvm::coverage::CoverageMapError::convertToErrorCode
std::error_code convertToErrorCode() const override
Convert this error to a std::error_code.
Definition: CoverageMapping.h:78
llvm::coverage::Counter::getExpressionID
unsigned getExpressionID() const
Definition: CoverageMapping.h:118
llvm::coverage::LineCoverageIterator::operator*
const LineCoverageStats & operator*() const
Definition: CoverageMapping.h:712
llvm::coverage::InstantiationGroup::size
size_t size() const
Get the number of instantiations in this group.
Definition: CoverageMapping.h:490
llvm::hash_combine
hash_code hash_combine(const Ts &...args)
Combine values into a single hash_code.
Definition: Hashing.h:604
llvm::coverage::CounterMappingContext::CounterMappingContext
CounterMappingContext(ArrayRef< CounterExpression > Expressions, ArrayRef< uint64_t > CounterValues=None)
Definition: CoverageMapping.h:325
llvm::coverage::Version6
@ Version6
Definition: CoverageMapping.h:1008
Expressions
gvn Early GVN Hoisting of Expressions
Definition: GVNHoist.cpp:1259
llvm::coverage::CovMapFunctionRecordV3::getFilenamesRef
uint64_t getFilenamesRef() const
Get the filename set reference.
Definition: CoverageMapping.h:943
llvm::coverage::Version2
@ Version2
Definition: CoverageMapping.h:998
llvm::coverage::CoverageSegment::CoverageSegment
CoverageSegment(unsigned Line, unsigned Col, uint64_t Count, bool IsRegionEntry, bool IsGapRegion=false, bool IsBranchRegion=false)
Definition: CoverageMapping.h:455
llvm::coverage::Counter::EncodingTagMask
static const unsigned EncodingTagMask
Definition: CoverageMapping.h:97
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::coverage::accessors::getFuncNameRef
uint64_t getFuncNameRef(const FuncRecordTy *Record)
Return the function lookup key. The value is considered opaque.
Definition: CoverageMapping.h:786
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::coverage::Counter::getZero
static Counter getZero()
Return the counter that represents the number zero.
Definition: CoverageMapping.h:133
llvm::coverage::CovMapFunctionRecordV3::advanceByOne
std::pair< const char *, const CovMapFunctionRecordV3 * > advanceByOne(const char *) const
Definition: CoverageMapping.h:958
llvm::coverage::CounterMappingRegion::CodeRegion
@ CodeRegion
A CodeRegion associates some code with a counter.
Definition: CoverageMapping.h:211
llvm::coverage::CounterExpression::Kind
ExprKind Kind
Definition: CoverageMapping.h:151
llvm::coverage::CounterMappingContext::getMaxCounterID
unsigned getMaxCounterID(const Counter &C) const
Definition: CoverageMapping.cpp:189
llvm::coverage::CoverageMapping::getHashMismatches
ArrayRef< std::pair< std::string, uint64_t > > getHashMismatches() const
A hash mismatch occurs when a profile record for a symbol does not have the same hash as a coverage m...
Definition: CoverageMapping.h:620
llvm::coverage::CoverageMapping::getCoveredFunctions
iterator_range< FunctionRecordIterator > getCoveredFunctions() const
Gets all of the functions covered by this profile.
Definition: CoverageMapping.h:642
llvm::coverage::ExpansionRecord
Coverage information for a macro expansion or #included file.
Definition: CoverageMapping.h:420
llvm::coverage::CoverageMapError::CoverageMapError
CoverageMapError(coveragemap_error Err)
Definition: CoverageMapping.h:70
llvm::Region
Definition: RegionInfo.h:889
raw_ostream.h
llvm::coverage::Counter::EncodingTagBits
static const unsigned EncodingTagBits
Definition: CoverageMapping.h:96
error_category
static ManagedStatic< _object_error_category > error_category
Definition: Error.cpp:76
llvm::coverage::CovMapTraits< CovMapVersion::Version2, IntPtrT >::NameRefType
uint64_t NameRefType
Definition: CoverageMapping.h:1025
Endian.h
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1799
llvm::coverage::CoverageSegment
The execution count information starting at a point in a file.
Definition: CoverageMapping.h:437
llvm::coverage::Counter::getKind
CounterKind getKind() const
Definition: CoverageMapping.h:110
llvm::coverage::InstantiationGroup
An instantiation group contains a FunctionRecord list, such that each record corresponds to a distinc...
Definition: CoverageMapping.h:474
llvm::coverage::CovMapFunctionRecordV1::advanceByOne
std::pair< const char *, const ThisT * > advanceByOne(const char *MappingBuf) const
Definition: CoverageMapping.h:856
llvm::coverage::CountedRegion
Associates a source range with an execution count.
Definition: CoverageMapping.h:303
llvm::coverage::CoverageMappingRecord
Coverage mapping information for a single function.
Definition: CoverageMappingReader.h:35
Debug.h
llvm::coverage::CounterMappingRegion::SkippedRegion
@ SkippedRegion
A SkippedRegion represents a source range with code that was skipped by a preprocessor or similar mea...
Definition: CoverageMapping.h:220
llvm::ArrayRef::end
iterator end() const
Definition: ArrayRef.h:154
llvm::coverage::CovMapHeader::getCoverageSize
uint32_t getCoverageSize() const
Definition: CoverageMapping.h:982
llvm::coverage::CoverageSegment::Col
unsigned Col
The column where this segment begins.
Definition: CoverageMapping.h:441
llvm::coverage::FunctionRecord::CountedRegions
std::vector< CountedRegion > CountedRegions
Regions in the function along with their counts.
Definition: CoverageMapping.h:353