forked from OSchip/llvm-project
[Coverage] Assert that filenames in a TU are unique, NFC
llvm-svn: 372024
This commit is contained in:
parent
dd63b9f570
commit
95de24978e
|
@ -30,8 +30,7 @@ class CoverageFilenamesSectionWriter {
|
|||
ArrayRef<StringRef> Filenames;
|
||||
|
||||
public:
|
||||
CoverageFilenamesSectionWriter(ArrayRef<StringRef> Filenames)
|
||||
: Filenames(Filenames) {}
|
||||
CoverageFilenamesSectionWriter(ArrayRef<StringRef> Filenames);
|
||||
|
||||
/// Write encoded filenames to the given output stream.
|
||||
void write(raw_ostream &OS);
|
||||
|
|
|
@ -24,6 +24,16 @@
|
|||
using namespace llvm;
|
||||
using namespace coverage;
|
||||
|
||||
CoverageFilenamesSectionWriter::CoverageFilenamesSectionWriter(
|
||||
ArrayRef<StringRef> Filenames)
|
||||
: Filenames(Filenames) {
|
||||
#ifndef NDEBUG
|
||||
StringSet<> NameSet;
|
||||
for (StringRef Name : Filenames)
|
||||
assert(NameSet.insert(Name).second && "Duplicate filename");
|
||||
#endif
|
||||
}
|
||||
|
||||
void CoverageFilenamesSectionWriter::write(raw_ostream &OS) {
|
||||
encodeULEB128(Filenames.size(), OS);
|
||||
for (const auto &Filename : Filenames) {
|
||||
|
|
Loading…
Reference in New Issue