aboutsummaryrefslogtreecommitdiff
path: root/clang
diff options
context:
space:
mode:
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Basic/FileManager.h2
-rw-r--r--clang/lib/Basic/FileManager.cpp4
-rw-r--r--clang/lib/ExtractAPI/ExtractAPIConsumer.cpp12
-rw-r--r--clang/lib/Frontend/DependencyFile.cpp2
-rw-r--r--clang/lib/Frontend/SARIFDiagnostic.cpp5
-rw-r--r--clang/lib/Frontend/TextDiagnostic.cpp4
6 files changed, 14 insertions, 15 deletions
diff --git a/clang/include/clang/Basic/FileManager.h b/clang/include/clang/Basic/FileManager.h
index 56c45e3..115558b 100644
--- a/clang/include/clang/Basic/FileManager.h
+++ b/clang/include/clang/Basic/FileManager.h
@@ -327,7 +327,7 @@ public:
/// This is a very expensive operation, despite its results being cached,
/// and should only be used when the physical layout of the file system is
/// required, which is (almost) never.
- StringRef getCanonicalName(const FileEntry *File);
+ StringRef getCanonicalName(FileEntryRef File);
private:
/// Retrieve the canonical name for a given file or directory.
diff --git a/clang/lib/Basic/FileManager.cpp b/clang/lib/Basic/FileManager.cpp
index 30e2916..c80fbfd 100644
--- a/clang/lib/Basic/FileManager.cpp
+++ b/clang/lib/Basic/FileManager.cpp
@@ -636,8 +636,8 @@ StringRef FileManager::getCanonicalName(DirectoryEntryRef Dir) {
return getCanonicalName(Dir, Dir.getName());
}
-StringRef FileManager::getCanonicalName(const FileEntry *File) {
- return getCanonicalName(File, File->getName());
+StringRef FileManager::getCanonicalName(FileEntryRef File) {
+ return getCanonicalName(File, File.getName());
}
StringRef FileManager::getCanonicalName(const void *Entry, StringRef Name) {
diff --git a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
index 50c2236..3aba3bf 100644
--- a/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
+++ b/clang/lib/ExtractAPI/ExtractAPIConsumer.cpp
@@ -177,17 +177,17 @@ struct LocationFileChecker {
if (FID.isInvalid())
return false;
- const auto *File = SM.getFileEntryForID(FID);
+ OptionalFileEntryRef File = SM.getFileEntryRefForID(FID);
if (!File)
return false;
- if (KnownFileEntries.count(File))
+ if (KnownFileEntries.count(*File))
return true;
- if (ExternalFileEntries.count(File))
+ if (ExternalFileEntries.count(*File))
return false;
- StringRef FileName = SM.getFileManager().getCanonicalName(File);
+ StringRef FileName = SM.getFileManager().getCanonicalName(*File);
// Try to reduce the include name the same way we tried to include it.
bool IsQuoted = false;
@@ -197,13 +197,13 @@ struct LocationFileChecker {
return KnownFile.first.equals(*IncludeName) &&
KnownFile.second == IsQuoted;
})) {
- KnownFileEntries.insert(File);
+ KnownFileEntries.insert(*File);
return true;
}
// Record that the file was not found to avoid future reverse lookup for
// the same file.
- ExternalFileEntries.insert(File);
+ ExternalFileEntries.insert(*File);
return false;
}
diff --git a/clang/lib/Frontend/DependencyFile.cpp b/clang/lib/Frontend/DependencyFile.cpp
index 1140c09..c2f6f41 100644
--- a/clang/lib/Frontend/DependencyFile.cpp
+++ b/clang/lib/Frontend/DependencyFile.cpp
@@ -159,7 +159,7 @@ void DependencyCollector::maybeAddDependency(StringRef Filename,
bool IsMissing) {
if (sawDependency(Filename, FromModule, IsSystem, IsModuleFile, IsMissing)) {
if (IsSystem && FileMgr && shouldCanonicalizeSystemDependencies()) {
- if (auto F = FileMgr->getFile(Filename))
+ if (auto F = FileMgr->getOptionalFileRef(Filename))
Filename = FileMgr->getCanonicalName(*F);
}
addDependency(Filename);
diff --git a/clang/lib/Frontend/SARIFDiagnostic.cpp b/clang/lib/Frontend/SARIFDiagnostic.cpp
index ee8e8b54..4e36153 100644
--- a/clang/lib/Frontend/SARIFDiagnostic.cpp
+++ b/clang/lib/Frontend/SARIFDiagnostic.cpp
@@ -164,8 +164,7 @@ SARIFDiagnostic::addDiagnosticLevelToRule(SarifRule Rule,
llvm::StringRef SARIFDiagnostic::emitFilename(StringRef Filename,
const SourceManager &SM) {
if (DiagOpts->AbsolutePath) {
- llvm::ErrorOr<const FileEntry *> File =
- SM.getFileManager().getFile(Filename);
+ auto File = SM.getFileManager().getOptionalFileRef(Filename);
if (File) {
// We want to print a simplified absolute path, i. e. without "dots".
//
@@ -182,7 +181,7 @@ llvm::StringRef SARIFDiagnostic::emitFilename(StringRef Filename,
// on Windows we can just use llvm::sys::path::remove_dots(), because,
// on that system, both aforementioned paths point to the same place.
#ifdef _WIN32
- SmallString<256> TmpFilename = (*File)->getName();
+ SmallString<256> TmpFilename = File->getName();
llvm::sys::fs::make_absolute(TmpFilename);
llvm::sys::path::native(TmpFilename);
llvm::sys::path::remove_dots(TmpFilename, /* remove_dot_dot */ true);
diff --git a/clang/lib/Frontend/TextDiagnostic.cpp b/clang/lib/Frontend/TextDiagnostic.cpp
index 7f55854..eaa6e8d 100644
--- a/clang/lib/Frontend/TextDiagnostic.cpp
+++ b/clang/lib/Frontend/TextDiagnostic.cpp
@@ -736,7 +736,7 @@ void TextDiagnostic::emitFilename(StringRef Filename, const SourceManager &SM) {
SmallString<4096> TmpFilename;
#endif
if (DiagOpts->AbsolutePath) {
- auto File = SM.getFileManager().getFile(Filename);
+ auto File = SM.getFileManager().getOptionalFileRef(Filename);
if (File) {
// We want to print a simplified absolute path, i. e. without "dots".
//
@@ -753,7 +753,7 @@ void TextDiagnostic::emitFilename(StringRef Filename, const SourceManager &SM) {
// on Windows we can just use llvm::sys::path::remove_dots(), because,
// on that system, both aforementioned paths point to the same place.
#ifdef _WIN32
- TmpFilename = (*File)->getName();
+ TmpFilename = File->getName();
llvm::sys::fs::make_absolute(TmpFilename);
llvm::sys::path::native(TmpFilename);
llvm::sys::path::remove_dots(TmpFilename, /* remove_dot_dot */ true);