Rely on autobrief, remove \briefs from a header. NFC.

llvm-svn: 309905
This commit is contained in:
Vedant Kumar 2017-08-02 23:35:26 +00:00
parent dde19c5a73
commit be6b598bfa
1 changed files with 59 additions and 62 deletions

View File

@ -85,7 +85,7 @@ private:
coveragemap_error Err; coveragemap_error Err;
}; };
/// \brief A Counter is an abstract value that describes how to compute the /// A Counter is an abstract value that describes how to compute the
/// execution count for a region of code using the collected profile count data. /// execution count for a region of code using the collected profile count data.
struct Counter { struct Counter {
enum CounterKind { Zero, CounterValueReference, Expression }; enum CounterKind { Zero, CounterValueReference, Expression };
@ -125,23 +125,23 @@ public:
return std::tie(LHS.Kind, LHS.ID) < std::tie(RHS.Kind, RHS.ID); return std::tie(LHS.Kind, LHS.ID) < std::tie(RHS.Kind, RHS.ID);
} }
/// \brief Return the counter that represents the number zero. /// Return the counter that represents the number zero.
static Counter getZero() { return Counter(); } static Counter getZero() { return Counter(); }
/// \brief Return the counter that corresponds to a specific profile counter. /// Return the counter that corresponds to a specific profile counter.
static Counter getCounter(unsigned CounterId) { static Counter getCounter(unsigned CounterId) {
return Counter(CounterValueReference, CounterId); return Counter(CounterValueReference, CounterId);
} }
/// \brief Return the counter that corresponds to a specific /// Return the counter that corresponds to a specific addition counter
/// addition counter expression. /// expression.
static Counter getExpression(unsigned ExpressionId) { static Counter getExpression(unsigned ExpressionId) {
return Counter(Expression, ExpressionId); return Counter(Expression, ExpressionId);
} }
}; };
/// \brief A Counter expression is a value that represents an arithmetic /// A Counter expression is a value that represents an arithmetic operation
/// operation with two counters. /// with two counters.
struct CounterExpression { struct CounterExpression {
enum ExprKind { Subtract, Add }; enum ExprKind { Subtract, Add };
ExprKind Kind; ExprKind Kind;
@ -151,17 +151,16 @@ struct CounterExpression {
: Kind(Kind), LHS(LHS), RHS(RHS) {} : Kind(Kind), LHS(LHS), RHS(RHS) {}
}; };
/// \brief A Counter expression builder is used to construct the /// A Counter expression builder is used to construct the counter expressions.
/// counter expressions. It avoids unnecessary duplication /// It avoids unnecessary duplication and simplifies algebraic expressions.
/// and simplifies algebraic expressions.
class CounterExpressionBuilder { class CounterExpressionBuilder {
/// \brief A list of all the counter expressions /// A list of all the counter expressions
std::vector<CounterExpression> Expressions; std::vector<CounterExpression> Expressions;
/// \brief A lookup table for the index of a given expression. /// A lookup table for the index of a given expression.
DenseMap<CounterExpression, unsigned> ExpressionIndices; DenseMap<CounterExpression, unsigned> ExpressionIndices;
/// \brief Return the counter which corresponds to the given expression. /// Return the counter which corresponds to the given expression.
/// ///
/// If the given expression is already stored in the builder, a counter /// If the given expression is already stored in the builder, a counter
/// that references that expression is returned. Otherwise, the given /// that references that expression is returned. Otherwise, the given
@ -177,43 +176,41 @@ class CounterExpressionBuilder {
: CounterID(CounterID), Factor(Factor) {} : CounterID(CounterID), Factor(Factor) {}
}; };
/// \brief Gather the terms of the expression tree for processing. /// Gather the terms of the expression tree for processing.
/// ///
/// This collects each addition and subtraction referenced by the counter into /// This collects each addition and subtraction referenced by the counter into
/// a sequence that can be sorted and combined to build a simplified counter /// a sequence that can be sorted and combined to build a simplified counter
/// expression. /// expression.
void extractTerms(Counter C, int Sign, SmallVectorImpl<Term> &Terms); void extractTerms(Counter C, int Sign, SmallVectorImpl<Term> &Terms);
/// \brief Simplifies the given expression tree /// Simplifies the given expression tree
/// by getting rid of algebraically redundant operations. /// by getting rid of algebraically redundant operations.
Counter simplify(Counter ExpressionTree); Counter simplify(Counter ExpressionTree);
public: public:
ArrayRef<CounterExpression> getExpressions() const { return Expressions; } ArrayRef<CounterExpression> getExpressions() const { return Expressions; }
/// \brief Return a counter that represents the expression /// Return a counter that represents the expression that adds LHS and RHS.
/// that adds LHS and RHS.
Counter add(Counter LHS, Counter RHS); Counter add(Counter LHS, Counter RHS);
/// \brief Return a counter that represents the expression /// Return a counter that represents the expression that subtracts RHS from
/// that subtracts RHS from LHS. /// LHS.
Counter subtract(Counter LHS, Counter RHS); Counter subtract(Counter LHS, Counter RHS);
}; };
/// \brief A Counter mapping region associates a source range with /// A Counter mapping region associates a source range with a specific counter.
/// a specific counter.
struct CounterMappingRegion { struct CounterMappingRegion {
enum RegionKind { enum RegionKind {
/// \brief A CodeRegion associates some code with a counter /// A CodeRegion associates some code with a counter
CodeRegion, CodeRegion,
/// \brief An ExpansionRegion represents a file expansion region that /// An ExpansionRegion represents a file expansion region that associates
/// associates a source range with the expansion of a virtual source file, /// a source range with the expansion of a virtual source file, such as
/// such as for a macro instantiation or #include file. /// for a macro instantiation or #include file.
ExpansionRegion, ExpansionRegion,
/// \brief A SkippedRegion represents a source range with code that /// A SkippedRegion represents a source range with code that was skipped
/// was skipped by a preprocessor or similar means. /// by a preprocessor or similar means.
SkippedRegion SkippedRegion
}; };
@ -260,7 +257,7 @@ struct CounterMappingRegion {
} }
}; };
/// \brief Associates a source range with an execution count. /// Associates a source range with an execution count.
struct CountedRegion : public CounterMappingRegion { struct CountedRegion : public CounterMappingRegion {
uint64_t ExecutionCount; uint64_t ExecutionCount;
@ -268,8 +265,8 @@ struct CountedRegion : public CounterMappingRegion {
: CounterMappingRegion(R), ExecutionCount(ExecutionCount) {} : CounterMappingRegion(R), ExecutionCount(ExecutionCount) {}
}; };
/// \brief A Counter mapping context is used to connect the counters, /// A Counter mapping context is used to connect the counters, expressions
/// expressions and the obtained counter values. /// and the obtained counter values.
class CounterMappingContext { class CounterMappingContext {
ArrayRef<CounterExpression> Expressions; ArrayRef<CounterExpression> Expressions;
ArrayRef<uint64_t> CounterValues; ArrayRef<uint64_t> CounterValues;
@ -284,20 +281,20 @@ public:
void dump(const Counter &C, raw_ostream &OS) const; void dump(const Counter &C, raw_ostream &OS) const;
void dump(const Counter &C) const { dump(C, dbgs()); } void dump(const Counter &C) const { dump(C, dbgs()); }
/// \brief Return the number of times that a region of code associated with /// Return the number of times that a region of code associated with this
/// this counter was executed. /// counter was executed.
Expected<int64_t> evaluate(const Counter &C) const; Expected<int64_t> evaluate(const Counter &C) const;
}; };
/// \brief Code coverage information for a single function. /// Code coverage information for a single function.
struct FunctionRecord { struct FunctionRecord {
/// \brief Raw function name. /// Raw function name.
std::string Name; std::string Name;
/// \brief Associated files. /// Associated files.
std::vector<std::string> Filenames; std::vector<std::string> Filenames;
/// \brief Regions in the function along with their counts. /// Regions in the function along with their counts.
std::vector<CountedRegion> CountedRegions; std::vector<CountedRegion> CountedRegions;
/// \brief The number of times this function was executed. /// The number of times this function was executed.
uint64_t ExecutionCount; uint64_t ExecutionCount;
FunctionRecord(StringRef Name, ArrayRef<StringRef> Filenames) FunctionRecord(StringRef Name, ArrayRef<StringRef> Filenames)
@ -313,7 +310,7 @@ struct FunctionRecord {
} }
}; };
/// \brief Iterator over Functions, optionally filtered to a single file. /// Iterator over Functions, optionally filtered to a single file.
class FunctionRecordIterator class FunctionRecordIterator
: public iterator_facade_base<FunctionRecordIterator, : public iterator_facade_base<FunctionRecordIterator,
std::forward_iterator_tag, FunctionRecord> { std::forward_iterator_tag, FunctionRecord> {
@ -321,7 +318,7 @@ class FunctionRecordIterator
ArrayRef<FunctionRecord>::iterator Current; ArrayRef<FunctionRecord>::iterator Current;
StringRef Filename; StringRef Filename;
/// \brief Skip records whose primary file is not \c Filename. /// Skip records whose primary file is not \c Filename.
void skipOtherFiles(); void skipOtherFiles();
public: public:
@ -347,17 +344,17 @@ public:
} }
}; };
/// \brief Coverage information for a macro expansion or #included file. /// Coverage information for a macro expansion or #included file.
/// ///
/// When covered code has pieces that can be expanded for more detail, such as a /// When covered code has pieces that can be expanded for more detail, such as a
/// preprocessor macro use and its definition, these are represented as /// preprocessor macro use and its definition, these are represented as
/// expansions whose coverage can be looked up independently. /// expansions whose coverage can be looked up independently.
struct ExpansionRecord { struct ExpansionRecord {
/// \brief The abstract file this expansion covers. /// The abstract file this expansion covers.
unsigned FileID; unsigned FileID;
/// \brief The region that expands to this record. /// The region that expands to this record.
const CountedRegion &Region; const CountedRegion &Region;
/// \brief Coverage for the expansion. /// Coverage for the expansion.
const FunctionRecord &Function; const FunctionRecord &Function;
ExpansionRecord(const CountedRegion &Region, ExpansionRecord(const CountedRegion &Region,
@ -365,20 +362,20 @@ struct ExpansionRecord {
: FileID(Region.ExpandedFileID), Region(Region), Function(Function) {} : FileID(Region.ExpandedFileID), Region(Region), Function(Function) {}
}; };
/// \brief The execution count information starting at a point in a file. /// The execution count information starting at a point in a file.
/// ///
/// A sequence of CoverageSegments gives execution counts for a file in format /// A sequence of CoverageSegments gives execution counts for a file in format
/// that's simple to iterate through for processing. /// that's simple to iterate through for processing.
struct CoverageSegment { struct CoverageSegment {
/// \brief The line where this segment begins. /// The line where this segment begins.
unsigned Line; unsigned Line;
/// \brief The column where this segment begins. /// The column where this segment begins.
unsigned Col; unsigned Col;
/// \brief The execution count, or zero if no count was recorded. /// The execution count, or zero if no count was recorded.
uint64_t Count; uint64_t Count;
/// \brief When false, the segment was uninstrumented or skipped. /// When false, the segment was uninstrumented or skipped.
bool HasCount; bool HasCount;
/// \brief Whether this enters a new region or returns to a previous count. /// Whether this enters a new region or returns to a previous count.
bool IsRegionEntry; bool IsRegionEntry;
CoverageSegment(unsigned Line, unsigned Col, bool IsRegionEntry) CoverageSegment(unsigned Line, unsigned Col, bool IsRegionEntry)
@ -453,7 +450,7 @@ public:
} }
}; };
/// \brief Coverage information to be processed or displayed. /// Coverage information to be processed or displayed.
/// ///
/// This represents the coverage of an entire file, expansion, or function. It /// This represents the coverage of an entire file, expansion, or function. It
/// provides a sequence of CoverageSegments to iterate through, as well as the /// provides a sequence of CoverageSegments to iterate through, as well as the
@ -470,7 +467,7 @@ public:
CoverageData(StringRef Filename) : Filename(Filename) {} CoverageData(StringRef Filename) : Filename(Filename) {}
/// \brief Get the name of the file this data covers. /// Get the name of the file this data covers.
StringRef getFilename() const { return Filename; } StringRef getFilename() const { return Filename; }
std::vector<CoverageSegment>::const_iterator begin() const { std::vector<CoverageSegment>::const_iterator begin() const {
@ -483,11 +480,11 @@ public:
bool empty() const { return Segments.empty(); } bool empty() const { return Segments.empty(); }
/// \brief Expansions that can be further processed. /// Expansions that can be further processed.
ArrayRef<ExpansionRecord> getExpansions() const { return Expansions; } ArrayRef<ExpansionRecord> getExpansions() const { return Expansions; }
}; };
/// \brief The mapping of profile information to coverage data. /// The mapping of profile information to coverage data.
/// ///
/// This is the main interface to get coverage information, using a profile to /// This is the main interface to get coverage information, using a profile to
/// fill out execution counts. /// fill out execution counts.
@ -498,7 +495,7 @@ class CoverageMapping {
CoverageMapping() = default; CoverageMapping() = default;
/// \brief Add a function record corresponding to \p Record. /// Add a function record corresponding to \p Record.
Error loadFunctionRecord(const CoverageMappingRecord &Record, Error loadFunctionRecord(const CoverageMappingRecord &Record,
IndexedInstrProfReader &ProfileReader); IndexedInstrProfReader &ProfileReader);
@ -517,30 +514,30 @@ public:
load(ArrayRef<StringRef> ObjectFilenames, StringRef ProfileFilename, load(ArrayRef<StringRef> ObjectFilenames, StringRef ProfileFilename,
ArrayRef<StringRef> Arches = None); ArrayRef<StringRef> Arches = None);
/// \brief The number of functions that couldn't have their profiles mapped. /// The number of functions that couldn't have their profiles mapped.
/// ///
/// This is a count of functions whose profile is out of date or otherwise /// This is a count of functions whose profile is out of date or otherwise
/// can't be associated with any coverage information. /// can't be associated with any coverage information.
unsigned getMismatchedCount() { return MismatchedFunctionCount; } unsigned getMismatchedCount() { return MismatchedFunctionCount; }
/// \brief Returns a lexicographically sorted, unique list of files that are /// Returns a lexicographically sorted, unique list of files that are
/// covered. /// covered.
std::vector<StringRef> getUniqueSourceFiles() const; std::vector<StringRef> getUniqueSourceFiles() const;
/// \brief Get the coverage for a particular file. /// Get the coverage for a particular file.
/// ///
/// The given filename must be the name as recorded in the coverage /// The given filename must be the name as recorded in the coverage
/// information. That is, only names returned from getUniqueSourceFiles will /// information. That is, only names returned from getUniqueSourceFiles will
/// yield a result. /// yield a result.
CoverageData getCoverageForFile(StringRef Filename) const; CoverageData getCoverageForFile(StringRef Filename) const;
/// \brief Gets all of the functions covered by this profile. /// Gets all of the functions covered by this profile.
iterator_range<FunctionRecordIterator> getCoveredFunctions() const { iterator_range<FunctionRecordIterator> getCoveredFunctions() const {
return make_range(FunctionRecordIterator(Functions), return make_range(FunctionRecordIterator(Functions),
FunctionRecordIterator()); FunctionRecordIterator());
} }
/// \brief Gets all of the functions in a particular file. /// Gets all of the functions in a particular file.
iterator_range<FunctionRecordIterator> iterator_range<FunctionRecordIterator>
getCoveredFunctions(StringRef Filename) const { getCoveredFunctions(StringRef Filename) const {
return make_range(FunctionRecordIterator(Functions, Filename), return make_range(FunctionRecordIterator(Functions, Filename),
@ -554,10 +551,10 @@ public:
std::vector<InstantiationGroup> std::vector<InstantiationGroup>
getInstantiationGroups(StringRef Filename) const; getInstantiationGroups(StringRef Filename) const;
/// \brief Get the coverage for a particular function. /// Get the coverage for a particular function.
CoverageData getCoverageForFunction(const FunctionRecord &Function) const; CoverageData getCoverageForFunction(const FunctionRecord &Function) const;
/// \brief Get the coverage for an expansion within a coverage set. /// Get the coverage for an expansion within a coverage set.
CoverageData getCoverageForExpansion(const ExpansionRecord &Expansion) const; CoverageData getCoverageForExpansion(const ExpansionRecord &Expansion) const;
}; };
@ -677,7 +674,7 @@ template <class IntPtrT> struct CovMapTraits<CovMapVersion::Version1, IntPtrT> {
} // end namespace coverage } // end namespace coverage
/// \brief Provide DenseMapInfo for CounterExpression /// Provide DenseMapInfo for CounterExpression
template<> struct DenseMapInfo<coverage::CounterExpression> { template<> struct DenseMapInfo<coverage::CounterExpression> {
static inline coverage::CounterExpression getEmptyKey() { static inline coverage::CounterExpression getEmptyKey() {
using namespace coverage; using namespace coverage;