Skip to content

Commit 523c471

Browse files
committed
Reapply "[clang] NFCI: Adopt SourceManager::getFileEntryRefForID()"
This reapplies ddbcc10, except for a tiny part that was reverted separately: 65331da. That will be reapplied later on, since it turned out to be more involved. This commit is enabled by 5523fef and f0f548a, specifically the part that makes 'clang-tidy/checkers/misc/header-include-cycle.cpp' separator agnostic.
1 parent a3ba9d6 commit 523c471

30 files changed

+72
-58
lines changed

clang/include/clang/ASTMatchers/ASTMatchers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ AST_POLYMORPHIC_MATCHER_REGEX(isExpansionInFileMatching,
300300
return false;
301301
}
302302
auto FileEntry =
303-
SourceManager.getFileEntryForID(SourceManager.getFileID(ExpansionLoc));
303+
SourceManager.getFileEntryRefForID(SourceManager.getFileID(ExpansionLoc));
304304
if (!FileEntry) {
305305
return false;
306306
}

clang/include/clang/Basic/SourceLocation.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#ifndef LLVM_CLANG_BASIC_SOURCELOCATION_H
1515
#define LLVM_CLANG_BASIC_SOURCELOCATION_H
1616

17+
#include "clang/Basic/FileEntry.h"
1718
#include "clang/Basic/LLVM.h"
1819
#include "llvm/ADT/StringRef.h"
1920
#include <cassert>
@@ -356,8 +357,6 @@ class PresumedLoc {
356357
}
357358
};
358359

359-
class FileEntry;
360-
361360
/// A SourceLocation and its associated SourceManager.
362361
///
363362
/// This is useful for argument passing to functions that expect both objects.
@@ -413,6 +412,7 @@ class FullSourceLoc : public SourceLocation {
413412
unsigned getColumnNumber(bool *Invalid = nullptr) const;
414413

415414
const FileEntry *getFileEntry() const;
415+
OptionalFileEntryRef getFileEntryRef() const;
416416

417417
/// Return a StringRef to the source buffer data for the
418418
/// specified FileID.

clang/lib/ARCMigrate/ARCMT.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,8 @@ bool MigrationProcess::applyTransform(TransformFn trans,
597597
I = rewriter.buffer_begin(), E = rewriter.buffer_end(); I != E; ++I) {
598598
FileID FID = I->first;
599599
RewriteBuffer &buf = I->second;
600-
const FileEntry *file = Ctx.getSourceManager().getFileEntryForID(FID);
600+
OptionalFileEntryRef file =
601+
Ctx.getSourceManager().getFileEntryRefForID(FID);
601602
assert(file);
602603
std::string newFname = std::string(file->getName());
603604
newFname += "-trans";

clang/lib/ARCMigrate/ObjCMT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1785,7 +1785,7 @@ class JSONEditWriter : public edit::EditsReceiver {
17851785
std::tie(FID, Offset) = SourceMgr.getDecomposedLoc(Loc);
17861786
assert(FID.isValid());
17871787
SmallString<200> Path =
1788-
StringRef(SourceMgr.getFileEntryForID(FID)->getName());
1788+
StringRef(SourceMgr.getFileEntryRefForID(FID)->getName());
17891789
llvm::sys::fs::make_absolute(Path);
17901790
OS << " \"file\": \"";
17911791
OS.write_escaped(Path.str()) << "\",\n";

clang/lib/ARCMigrate/PlistReporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void arcmt::writeARCDiagsToPlist(const std::string &outPath,
7272
" <array>\n";
7373

7474
for (FileID FID : Fids)
75-
EmitString(o << " ", SM.getFileEntryForID(FID)->getName()) << '\n';
75+
EmitString(o << " ", SM.getFileEntryRefForID(FID)->getName()) << '\n';
7676

7777
o << " </array>\n"
7878
" <key>diagnostics</key>\n"

clang/lib/AST/MicrosoftMangle.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ MicrosoftMangleContextImpl::MicrosoftMangleContextImpl(ASTContext &Context,
483483
// The generated names are intended to look similar to what MSVC generates,
484484
// which are something like "?A0x01234567@".
485485
SourceManager &SM = Context.getSourceManager();
486-
if (const FileEntry *FE = SM.getFileEntryForID(SM.getMainFileID())) {
486+
if (OptionalFileEntryRef FE = SM.getFileEntryRefForID(SM.getMainFileID())) {
487487
// Truncate the hash so we get 8 characters of hexadecimal.
488488
uint32_t TruncatedHash = uint32_t(xxh3_64bits(FE->getName()));
489489
AnonymousNamespaceHash = llvm::utohexstr(TruncatedHash);

clang/lib/Analysis/PathDiagnostic.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,10 @@ static bool compareCrossTUSourceLocs(FullSourceLoc XL, FullSourceLoc YL) {
336336
std::pair<bool, bool> InSameTU = SM.isInTheSameTranslationUnit(XOffs, YOffs);
337337
if (InSameTU.first)
338338
return XL.isBeforeInTranslationUnitThan(YL);
339-
const FileEntry *XFE = SM.getFileEntryForID(XL.getSpellingLoc().getFileID());
340-
const FileEntry *YFE = SM.getFileEntryForID(YL.getSpellingLoc().getFileID());
339+
OptionalFileEntryRef XFE =
340+
SM.getFileEntryRefForID(XL.getSpellingLoc().getFileID());
341+
OptionalFileEntryRef YFE =
342+
SM.getFileEntryRefForID(YL.getSpellingLoc().getFileID());
341343
if (!XFE || !YFE)
342344
return XFE && !YFE;
343345
int NameCmp = XFE->getName().compare(YFE->getName());

clang/lib/Basic/SourceLocation.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,11 @@ const FileEntry *FullSourceLoc::getFileEntry() const {
227227
return SrcMgr->getFileEntryForID(getFileID());
228228
}
229229

230+
OptionalFileEntryRef FullSourceLoc::getFileEntryRef() const {
231+
assert(isValid());
232+
return SrcMgr->getFileEntryRefForID(getFileID());
233+
}
234+
230235
unsigned FullSourceLoc::getExpansionLineNumber(bool *Invalid) const {
231236
assert(isValid());
232237
return SrcMgr->getExpansionLineNumber(*this, Invalid);

clang/lib/Basic/SourceManager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ SourceLocation SourceManager::getImmediateSpellingLoc(SourceLocation Loc) const{
10181018

10191019
/// Return the filename of the file containing a SourceLocation.
10201020
StringRef SourceManager::getFilename(SourceLocation SpellingLoc) const {
1021-
if (const FileEntry *F = getFileEntryForID(getFileID(SpellingLoc)))
1021+
if (OptionalFileEntryRef F = getFileEntryRefForID(getFileID(SpellingLoc)))
10221022
return F->getName();
10231023
return StringRef();
10241024
}

clang/lib/CodeGen/CodeGenModule.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3215,7 +3215,7 @@ bool CodeGenModule::isInNoSanitizeList(SanitizerMask Kind, llvm::Function *Fn,
32153215
return true;
32163216
// NoSanitize by location. Check "mainfile" prefix.
32173217
auto &SM = Context.getSourceManager();
3218-
const FileEntry &MainFile = *SM.getFileEntryForID(SM.getMainFileID());
3218+
FileEntryRef MainFile = *SM.getFileEntryRefForID(SM.getMainFileID());
32193219
if (NoSanitizeL.containsMainFile(Kind, MainFile.getName()))
32203220
return true;
32213221

@@ -3236,7 +3236,8 @@ bool CodeGenModule::isInNoSanitizeList(SanitizerMask Kind,
32363236
return true;
32373237
auto &SM = Context.getSourceManager();
32383238
if (NoSanitizeL.containsMainFile(
3239-
Kind, SM.getFileEntryForID(SM.getMainFileID())->getName(), Category))
3239+
Kind, SM.getFileEntryRefForID(SM.getMainFileID())->getName(),
3240+
Category))
32403241
return true;
32413242
if (NoSanitizeL.containsLocation(Kind, Loc, Category))
32423243
return true;
@@ -3302,7 +3303,7 @@ CodeGenModule::isFunctionBlockedByProfileList(llvm::Function *Fn,
33023303
// If location is unknown, this may be a compiler-generated function. Assume
33033304
// it's located in the main file.
33043305
auto &SM = Context.getSourceManager();
3305-
if (const auto *MainFile = SM.getFileEntryForID(SM.getMainFileID()))
3306+
if (auto MainFile = SM.getFileEntryRefForID(SM.getMainFileID()))
33063307
if (auto V = ProfileList.isFileExcluded(MainFile->getName(), Kind))
33073308
return *V;
33083309
return ProfileList.getDefault(Kind);

clang/lib/Frontend/ASTUnit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1497,8 +1497,8 @@ StringRef ASTUnit::getMainFileName() const {
14971497
}
14981498

14991499
if (SourceMgr) {
1500-
if (const FileEntry *
1501-
FE = SourceMgr->getFileEntryForID(SourceMgr->getMainFileID()))
1500+
if (OptionalFileEntryRef FE =
1501+
SourceMgr->getFileEntryRefForID(SourceMgr->getMainFileID()))
15021502
return FE->getName();
15031503
}
15041504

clang/lib/Frontend/FrontendAction.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
666666
} else {
667667
auto &OldSM = AST->getSourceManager();
668668
FileID ID = OldSM.getMainFileID();
669-
if (auto *File = OldSM.getFileEntryForID(ID))
669+
if (auto File = OldSM.getFileEntryRefForID(ID))
670670
Input = FrontendInputFile(File->getName(), Kind);
671671
else
672672
Input = FrontendInputFile(OldSM.getBufferOrFake(ID), Kind);
@@ -844,7 +844,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
844844
return false;
845845
}
846846
// We now have the filename...
847-
FileName = FE->getFileEntry().getName();
847+
FileName = FE->getName();
848848
// ... still a header unit, but now use the path as written.
849849
Kind = Input.getKind().withHeaderUnit(InputKind::HeaderUnit_Abs);
850850
Input = FrontendInputFile(FileName, Kind, Input.isSystem());

clang/lib/Frontend/HeaderIncludeGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ void HeaderIncludesCallback::FileSkipped(const FileEntryRef &SkippedFile, const
259259
}
260260

261261
void HeaderIncludesJSONCallback::EndOfMainFile() {
262-
const FileEntry *FE = SM.getFileEntryForID(SM.getMainFileID());
262+
OptionalFileEntryRef FE = SM.getFileEntryRefForID(SM.getMainFileID());
263263
SmallString<256> MainFile(FE->getName());
264264
SM.getFileManager().makeAbsolutePath(MainFile);
265265

clang/lib/Frontend/LogDiagnosticPrinter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
118118
const SourceManager &SM = Info.getSourceManager();
119119
FileID FID = SM.getMainFileID();
120120
if (FID.isValid()) {
121-
if (const FileEntry *FE = SM.getFileEntryForID(FID))
121+
if (OptionalFileEntryRef FE = SM.getFileEntryRefForID(FID))
122122
MainFilename = std::string(FE->getName());
123123
}
124124
}
@@ -147,7 +147,7 @@ void LogDiagnosticPrinter::HandleDiagnostic(DiagnosticsEngine::Level Level,
147147
// At least print the file name if available:
148148
FileID FID = SM.getFileID(Info.getLocation());
149149
if (FID.isValid()) {
150-
if (const FileEntry *FE = SM.getFileEntryForID(FID))
150+
if (OptionalFileEntryRef FE = SM.getFileEntryRefForID(FID))
151151
DE.Filename = std::string(FE->getName());
152152
}
153153
} else {

clang/lib/Frontend/PrecompiledPreamble.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -550,19 +550,19 @@ llvm::ErrorOr<PrecompiledPreamble> PrecompiledPreamble::Build(
550550

551551
SourceManager &SourceMgr = Clang->getSourceManager();
552552
for (auto &Filename : PreambleDepCollector->getDependencies()) {
553-
auto FileOrErr = Clang->getFileManager().getFile(Filename);
554-
if (!FileOrErr ||
555-
*FileOrErr == SourceMgr.getFileEntryForID(SourceMgr.getMainFileID()))
553+
auto MaybeFile = Clang->getFileManager().getOptionalFileRef(Filename);
554+
if (!MaybeFile ||
555+
MaybeFile == SourceMgr.getFileEntryRefForID(SourceMgr.getMainFileID()))
556556
continue;
557-
auto File = *FileOrErr;
558-
if (time_t ModTime = File->getModificationTime()) {
559-
FilesInPreamble[File->getName()] =
560-
PrecompiledPreamble::PreambleFileHash::createForFile(File->getSize(),
557+
auto File = *MaybeFile;
558+
if (time_t ModTime = File.getModificationTime()) {
559+
FilesInPreamble[File.getName()] =
560+
PrecompiledPreamble::PreambleFileHash::createForFile(File.getSize(),
561561
ModTime);
562562
} else {
563563
llvm::MemoryBufferRef Buffer =
564564
SourceMgr.getMemoryBufferForFileOrFake(File);
565-
FilesInPreamble[File->getName()] =
565+
FilesInPreamble[File.getName()] =
566566
PrecompiledPreamble::PreambleFileHash::createForMemoryBuffer(Buffer);
567567
}
568568
}

clang/lib/Frontend/Rewrite/FixItRewriter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ bool FixItRewriter::WriteFixedFiles(
9393
}
9494

9595
for (iterator I = buffer_begin(), E = buffer_end(); I != E; ++I) {
96-
const FileEntry *Entry = Rewrite.getSourceMgr().getFileEntryForID(I->first);
96+
OptionalFileEntryRef Entry =
97+
Rewrite.getSourceMgr().getFileEntryRefForID(I->first);
9798
int fd;
9899
std::string Filename =
99100
FixItOpts->RewriteFilename(std::string(Entry->getName()), fd);

clang/lib/Frontend/Rewrite/HTMLPrint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void HTMLPrinter::HandleTranslationUnit(ASTContext &Ctx) {
6262

6363
// Format the file.
6464
FileID FID = R.getSourceMgr().getMainFileID();
65-
const FileEntry* Entry = R.getSourceMgr().getFileEntryForID(FID);
65+
OptionalFileEntryRef Entry = R.getSourceMgr().getFileEntryRefForID(FID);
6666
StringRef Name;
6767
// In some cases, in particular the case where the input is from stdin,
6868
// there is no entry. Fall back to the memory buffer for a name in those

clang/lib/Frontend/SARIFDiagnostic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ SarifResult SARIFDiagnostic::addLocationToResult(
7070
// At least add the file name if available:
7171
FileID FID = Loc.getFileID();
7272
if (FID.isValid()) {
73-
if (const FileEntry *FE = Loc.getFileEntry()) {
73+
if (OptionalFileEntryRef FE = Loc.getFileEntryRef()) {
7474
emitFilename(FE->getName(), Loc.getManager());
7575
// FIXME(llvm-project/issues/57366): File-only locations
7676
}

clang/lib/Frontend/TextDiagnostic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@ void TextDiagnostic::emitDiagnosticLoc(FullSourceLoc Loc, PresumedLoc PLoc,
779779
if (PLoc.isInvalid()) {
780780
// At least print the file name if available:
781781
if (FileID FID = Loc.getFileID(); FID.isValid()) {
782-
if (const FileEntry *FE = Loc.getFileEntry()) {
782+
if (OptionalFileEntryRef FE = Loc.getFileEntryRef()) {
783783
emitFilename(FE->getName(), Loc.getManager());
784784
OS << ": ";
785785
}

clang/lib/Frontend/VerifyDiagnosticConsumer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,8 +868,8 @@ static unsigned PrintUnexpected(DiagnosticsEngine &Diags, SourceManager *SourceM
868868
OS << "\n (frontend)";
869869
else {
870870
OS << "\n ";
871-
if (const FileEntry *File = SourceMgr->getFileEntryForID(
872-
SourceMgr->getFileID(I->first)))
871+
if (OptionalFileEntryRef File =
872+
SourceMgr->getFileEntryRefForID(SourceMgr->getFileID(I->first)))
873873
OS << " File " << File->getName();
874874
OS << " Line " << SourceMgr->getPresumedLineNumber(I->first);
875875
}

clang/lib/Index/CommentToXML.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ void CommentASTToXMLConverter::visitFullComment(const FullComment *C) {
891891
unsigned FileOffset = LocInfo.second;
892892

893893
if (FID.isValid()) {
894-
if (const FileEntry *FE = SM.getFileEntryForID(FID)) {
894+
if (OptionalFileEntryRef FE = SM.getFileEntryRefForID(FID)) {
895895
Result << " file=\"";
896896
appendToResultWithXMLEscaping(FE->getName());
897897
Result << "\"";

clang/lib/Index/USRGeneration.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static bool printLoc(llvm::raw_ostream &OS, SourceLocation Loc,
3131
}
3232
Loc = SM.getExpansionLoc(Loc);
3333
const std::pair<FileID, unsigned> &Decomposed = SM.getDecomposedLoc(Loc);
34-
const FileEntry *FE = SM.getFileEntryForID(Decomposed.first);
34+
OptionalFileEntryRef FE = SM.getFileEntryRefForID(Decomposed.first);
3535
if (FE) {
3636
OS << llvm::sys::path::filename(FE->getName());
3737
} else {

clang/lib/Sema/Sema.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ class SemaPPCallbacks : public PPCallbacks {
152152
SourceLocation IncludeLoc = SM.getIncludeLoc(SM.getFileID(Loc));
153153
if (IncludeLoc.isValid()) {
154154
if (llvm::timeTraceProfilerEnabled()) {
155-
const FileEntry *FE = SM.getFileEntryForID(SM.getFileID(Loc));
156-
llvm::timeTraceProfilerBegin(
157-
"Source", FE != nullptr ? FE->getName() : StringRef("<unknown>"));
155+
OptionalFileEntryRef FE = SM.getFileEntryRefForID(SM.getFileID(Loc));
156+
llvm::timeTraceProfilerBegin("Source", FE ? FE->getName()
157+
: StringRef("<unknown>"));
158158
}
159159

160160
IncludeStack.push_back(IncludeLoc);

clang/lib/Sema/SemaModule.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,8 @@ void Sema::HandleStartOfHeaderUnit() {
103103

104104
StringRef HUName = getLangOpts().CurrentModule;
105105
if (HUName.empty()) {
106-
HUName = SourceMgr.getFileEntryForID(SourceMgr.getMainFileID())->getName();
106+
HUName =
107+
SourceMgr.getFileEntryRefForID(SourceMgr.getMainFileID())->getName();
107108
const_cast<LangOptions &>(getLangOpts()).CurrentModule = HUName.str();
108109
}
109110

clang/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class HTMLDiagnostics : public PathDiagnosticConsumer {
112112
// Add HTML header/footers to file specified by FID
113113
void FinalizeHTML(const PathDiagnostic &D, Rewriter &R,
114114
const SourceManager &SMgr, const PathPieces &path,
115-
FileID FID, const FileEntry *Entry, const char *declName);
115+
FileID FID, FileEntryRef Entry, const char *declName);
116116

117117
// Rewrite the file specified by FID with HTML formatting.
118118
void RewriteFile(Rewriter &R, const PathPieces &path, FileID FID);
@@ -326,7 +326,7 @@ void HTMLDiagnostics::ReportDiag(const PathDiagnostic& D,
326326
FileID ReportFile =
327327
path.back()->getLocation().asLocation().getExpansionLoc().getFileID();
328328

329-
const FileEntry *Entry = SMgr.getFileEntryForID(ReportFile);
329+
OptionalFileEntryRef Entry = SMgr.getFileEntryRefForID(ReportFile);
330330

331331
FileName << llvm::sys::path::filename(Entry->getName()).str() << "-"
332332
<< declName.c_str() << "-" << offsetDecl << "-";
@@ -396,7 +396,7 @@ std::string HTMLDiagnostics::GenerateHTML(const PathDiagnostic& D, Rewriter &R,
396396
os << "<div class=FileNav><a href=\"#File" << (I - 1)->getHashValue()
397397
<< "\">&#x2190;</a></div>";
398398

399-
os << "<h4 class=FileName>" << SMgr.getFileEntryForID(*I)->getName()
399+
os << "<h4 class=FileName>" << SMgr.getFileEntryRefForID(*I)->getName()
400400
<< "</h4>\n";
401401

402402
// Right nav arrow
@@ -429,8 +429,8 @@ std::string HTMLDiagnostics::GenerateHTML(const PathDiagnostic& D, Rewriter &R,
429429
// Add CSS, header, and footer.
430430
FileID FID =
431431
path.back()->getLocation().asLocation().getExpansionLoc().getFileID();
432-
const FileEntry* Entry = SMgr.getFileEntryForID(FID);
433-
FinalizeHTML(D, R, SMgr, path, FileIDs[0], Entry, declName);
432+
OptionalFileEntryRef Entry = SMgr.getFileEntryRefForID(FID);
433+
FinalizeHTML(D, R, SMgr, path, FileIDs[0], *Entry, declName);
434434

435435
std::string file;
436436
llvm::raw_string_ostream os(file);
@@ -537,16 +537,17 @@ document.addEventListener("DOMContentLoaded", function() {
537537
return s;
538538
}
539539

540-
void HTMLDiagnostics::FinalizeHTML(const PathDiagnostic& D, Rewriter &R,
541-
const SourceManager& SMgr, const PathPieces& path, FileID FID,
542-
const FileEntry *Entry, const char *declName) {
540+
void HTMLDiagnostics::FinalizeHTML(const PathDiagnostic &D, Rewriter &R,
541+
const SourceManager &SMgr,
542+
const PathPieces &path, FileID FID,
543+
FileEntryRef Entry, const char *declName) {
543544
// This is a cludge; basically we want to append either the full
544545
// working directory if we have no directory information. This is
545546
// a work in progress.
546547

547548
llvm::SmallString<0> DirName;
548549

549-
if (llvm::sys::path::is_relative(Entry->getName())) {
550+
if (llvm::sys::path::is_relative(Entry.getName())) {
550551
llvm::sys::fs::current_path(DirName);
551552
DirName += '/';
552553
}
@@ -575,7 +576,7 @@ void HTMLDiagnostics::FinalizeHTML(const PathDiagnostic& D, Rewriter &R,
575576
<< "<h3>Bug Summary</h3>\n<table class=\"simpletable\">\n"
576577
"<tr><td class=\"rowname\">File:</td><td>"
577578
<< html::EscapeText(DirName)
578-
<< html::EscapeText(Entry->getName())
579+
<< html::EscapeText(Entry.getName())
579580
<< "</td></tr>\n<tr><td class=\"rowname\">Warning:</td><td>"
580581
"<a href=\"#EndPath\">line "
581582
<< LineNumber
@@ -656,9 +657,9 @@ void HTMLDiagnostics::FinalizeHTML(const PathDiagnostic& D, Rewriter &R,
656657
if (!BugCategory.empty())
657658
os << "\n<!-- BUGCATEGORY " << BugCategory << " -->\n";
658659

659-
os << "\n<!-- BUGFILE " << DirName << Entry->getName() << " -->\n";
660+
os << "\n<!-- BUGFILE " << DirName << Entry.getName() << " -->\n";
660661

661-
os << "\n<!-- FILENAME " << llvm::sys::path::filename(Entry->getName()) << " -->\n";
662+
os << "\n<!-- FILENAME " << llvm::sys::path::filename(Entry.getName()) << " -->\n";
662663

663664
os << "\n<!-- FUNCTIONNAME " << declName << " -->\n";
664665

@@ -682,7 +683,7 @@ void HTMLDiagnostics::FinalizeHTML(const PathDiagnostic& D, Rewriter &R,
682683
R.InsertTextBefore(SMgr.getLocForStartOfFile(FID), os.str());
683684
}
684685

685-
html::AddHeaderFooterInternalBuiltinCSS(R, FID, Entry->getName());
686+
html::AddHeaderFooterInternalBuiltinCSS(R, FID, Entry.getName());
686687
}
687688

688689
StringRef HTMLDiagnostics::showHelpJavascript() {

0 commit comments

Comments
 (0)