Skip to content

Commit

Permalink
[clang] NFCI: Use FileEntryRef in CoverageMappingGen
Browse files Browse the repository at this point in the history
This removes some uses of the deprecated `FileEntry::getName()`.
  • Loading branch information
jansvoboda11 committed Sep 6, 2023
1 parent 06d2db2 commit e75ecaa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions clang/lib/CodeGen/CoverageMappingGen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,12 +322,12 @@ class CoverageMappingBuilder {
for (const auto &FL : FileLocs) {
SourceLocation Loc = FL.first;
FileID SpellingFile = SM.getDecomposedSpellingLoc(Loc).first;
auto Entry = SM.getFileEntryForID(SpellingFile);
auto Entry = SM.getFileEntryRefForID(SpellingFile);
if (!Entry)
continue;

FileIDMapping[SM.getFileID(Loc)] = std::make_pair(Mapping.size(), Loc);
Mapping.push_back(CVM.getFileID(Entry));
Mapping.push_back(CVM.getFileID(*Entry));
}
}

Expand Down Expand Up @@ -1740,7 +1740,7 @@ void CoverageMappingModuleGen::addFunctionMappingRecord(
FilenameStrs[0] = normalizeFilename(getCurrentDirname());
for (const auto &Entry : FileEntries) {
auto I = Entry.second;
FilenameStrs[I] = normalizeFilename(Entry.first->getName());
FilenameStrs[I] = normalizeFilename(Entry.first.getName());
}
ArrayRef<std::string> FilenameRefs = llvm::ArrayRef(FilenameStrs);
RawCoverageMappingReader Reader(CoverageMapping, FilenameRefs, Filenames,
Expand All @@ -1764,7 +1764,7 @@ void CoverageMappingModuleGen::emit() {
FilenameStrs[0] = normalizeFilename(getCurrentDirname());
for (const auto &Entry : FileEntries) {
auto I = Entry.second;
FilenameStrs[I] = normalizeFilename(Entry.first->getName());
FilenameStrs[I] = normalizeFilename(Entry.first.getName());
}

std::string Filenames;
Expand Down Expand Up @@ -1823,7 +1823,7 @@ void CoverageMappingModuleGen::emit() {
}
}

unsigned CoverageMappingModuleGen::getFileID(const FileEntry *File) {
unsigned CoverageMappingModuleGen::getFileID(FileEntryRef File) {
auto It = FileEntries.find(File);
if (It != FileEntries.end())
return It->second;
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CoverageMappingGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class CoverageMappingModuleGen {

CodeGenModule &CGM;
CoverageSourceInfo &SourceInfo;
llvm::SmallDenseMap<const FileEntry *, unsigned, 8> FileEntries;
llvm::SmallDenseMap<FileEntryRef, unsigned, 8> FileEntries;
std::vector<llvm::Constant *> FunctionNames;
std::vector<FunctionInfo> FunctionRecords;

Expand Down Expand Up @@ -137,7 +137,7 @@ class CoverageMappingModuleGen {

/// Return the coverage mapping translation unit file id
/// for the given file.
unsigned getFileID(const FileEntry *File);
unsigned getFileID(FileEntryRef File);

/// Return an interface into CodeGenModule.
CodeGenModule &getCodeGenModule() { return CGM; }
Expand Down

0 comments on commit e75ecaa

Please sign in to comment.