Skip to content

Commit e75ecaa

Browse files
committed
[clang] NFCI: Use FileEntryRef in CoverageMappingGen
This removes some uses of the deprecated `FileEntry::getName()`.
1 parent 06d2db2 commit e75ecaa

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

clang/lib/CodeGen/CoverageMappingGen.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,12 +322,12 @@ class CoverageMappingBuilder {
322322
for (const auto &FL : FileLocs) {
323323
SourceLocation Loc = FL.first;
324324
FileID SpellingFile = SM.getDecomposedSpellingLoc(Loc).first;
325-
auto Entry = SM.getFileEntryForID(SpellingFile);
325+
auto Entry = SM.getFileEntryRefForID(SpellingFile);
326326
if (!Entry)
327327
continue;
328328

329329
FileIDMapping[SM.getFileID(Loc)] = std::make_pair(Mapping.size(), Loc);
330-
Mapping.push_back(CVM.getFileID(Entry));
330+
Mapping.push_back(CVM.getFileID(*Entry));
331331
}
332332
}
333333

@@ -1740,7 +1740,7 @@ void CoverageMappingModuleGen::addFunctionMappingRecord(
17401740
FilenameStrs[0] = normalizeFilename(getCurrentDirname());
17411741
for (const auto &Entry : FileEntries) {
17421742
auto I = Entry.second;
1743-
FilenameStrs[I] = normalizeFilename(Entry.first->getName());
1743+
FilenameStrs[I] = normalizeFilename(Entry.first.getName());
17441744
}
17451745
ArrayRef<std::string> FilenameRefs = llvm::ArrayRef(FilenameStrs);
17461746
RawCoverageMappingReader Reader(CoverageMapping, FilenameRefs, Filenames,
@@ -1764,7 +1764,7 @@ void CoverageMappingModuleGen::emit() {
17641764
FilenameStrs[0] = normalizeFilename(getCurrentDirname());
17651765
for (const auto &Entry : FileEntries) {
17661766
auto I = Entry.second;
1767-
FilenameStrs[I] = normalizeFilename(Entry.first->getName());
1767+
FilenameStrs[I] = normalizeFilename(Entry.first.getName());
17681768
}
17691769

17701770
std::string Filenames;
@@ -1823,7 +1823,7 @@ void CoverageMappingModuleGen::emit() {
18231823
}
18241824
}
18251825

1826-
unsigned CoverageMappingModuleGen::getFileID(const FileEntry *File) {
1826+
unsigned CoverageMappingModuleGen::getFileID(FileEntryRef File) {
18271827
auto It = FileEntries.find(File);
18281828
if (It != FileEntries.end())
18291829
return It->second;

clang/lib/CodeGen/CoverageMappingGen.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ class CoverageMappingModuleGen {
104104

105105
CodeGenModule &CGM;
106106
CoverageSourceInfo &SourceInfo;
107-
llvm::SmallDenseMap<const FileEntry *, unsigned, 8> FileEntries;
107+
llvm::SmallDenseMap<FileEntryRef, unsigned, 8> FileEntries;
108108
std::vector<llvm::Constant *> FunctionNames;
109109
std::vector<FunctionInfo> FunctionRecords;
110110

@@ -137,7 +137,7 @@ class CoverageMappingModuleGen {
137137

138138
/// Return the coverage mapping translation unit file id
139139
/// for the given file.
140-
unsigned getFileID(const FileEntry *File);
140+
unsigned getFileID(FileEntryRef File);
141141

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

0 commit comments

Comments
 (0)