[clang] 715257e - [clang] NFCI: Use `FileEntryRef` in `Sarif.cpp`
Jan Svoboda via cfe-commits
cfe-commits at lists.llvm.org
Sat Sep 9 20:57:02 PDT 2023
Author: Jan Svoboda
Date: 2023-09-09T20:56:46-07:00
New Revision: 715257eac76cafef483014e01c3b4abed964815f
URL: https://github.com/llvm/llvm-project/commit/715257eac76cafef483014e01c3b4abed964815f
DIFF: https://github.com/llvm/llvm-project/commit/715257eac76cafef483014e01c3b4abed964815f.diff
LOG: [clang] NFCI: Use `FileEntryRef` in `Sarif.cpp`
Added:
Modified:
clang/lib/Basic/Sarif.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Sarif.cpp b/clang/lib/Basic/Sarif.cpp
index e2af25c8143b33e..e71f4b3337fcef4 100644
--- a/clang/lib/Basic/Sarif.cpp
+++ b/clang/lib/Basic/Sarif.cpp
@@ -36,8 +36,8 @@ using namespace llvm;
using clang::detail::SarifArtifact;
using clang::detail::SarifArtifactLocation;
-static StringRef getFileName(const FileEntry &FE) {
- StringRef Filename = FE.tryGetRealPathName();
+static StringRef getFileName(FileEntryRef FE) {
+ StringRef Filename = FE.getFileEntry().tryGetRealPathName();
if (Filename.empty())
Filename = FE.getName();
return Filename;
@@ -215,8 +215,8 @@ SarifDocumentWriter::createPhysicalLocation(const CharSourceRange &R) {
assert(R.isCharRange() &&
"Cannot create a physicalLocation from a token range!");
FullSourceLoc Start{R.getBegin(), SourceMgr};
- const FileEntry *FE = Start.getExpansionLoc().getFileEntry();
- assert(FE != nullptr && "Diagnostic does not exist within a valid file!");
+ OptionalFileEntryRef FE = Start.getExpansionLoc().getFileEntryRef();
+ assert(FE && "Diagnostic does not exist within a valid file!");
const std::string &FileURI = fileNameToURI(getFileName(*FE));
auto I = CurrentArtifacts.find(FileURI);
More information about the cfe-commits
mailing list