[PATCH] D92968: Frontend: Migrate to FileEntryRef in TextDiagnosticTest, NFC
Duncan P. N. Exon Smith via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 9 13:43:57 PST 2020
dexonsmith created this revision.
dexonsmith added reviewers: arphaman, jansvoboda11.
Herald added a subscriber: ributzka.
dexonsmith requested review of this revision.
Herald added a project: clang.
Migrate over to the `FileEntryRef` overloads of
`SourceManager::createFileID` and `overrideFileContents` (using
`getVirtualFileRef`) in `TextDiagnostic`'s `ShowLine` test.
No functionality change.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D92968
Files:
clang/unittests/Frontend/TextDiagnosticTest.cpp
Index: clang/unittests/Frontend/TextDiagnosticTest.cpp
===================================================================
--- clang/unittests/Frontend/TextDiagnosticTest.cpp
+++ clang/unittests/Frontend/TextDiagnosticTest.cpp
@@ -46,7 +46,7 @@
// Create a dummy file with some contents to produce a test SourceLocation.
const llvm::StringRef file_path = "main.cpp";
const llvm::StringRef main_file_contents = "some\nsource\ncode\n";
- const clang::FileEntry &fe = *FileMgr.getVirtualFile(
+ const clang::FileEntryRef fe = FileMgr.getVirtualFileRef(
file_path,
/*Size=*/static_cast<off_t>(main_file_contents.size()),
/*ModificationTime=*/0);
@@ -55,11 +55,11 @@
buffer.append(main_file_contents.begin(), main_file_contents.end());
auto file_contents = std::make_unique<llvm::SmallVectorMemoryBuffer>(
std::move(buffer), file_path);
- SrcMgr.overrideFileContents(&fe, std::move(file_contents));
+ SrcMgr.overrideFileContents(fe, std::move(file_contents));
// Create the actual file id and use it as the main file.
clang::FileID fid =
- SrcMgr.createFileID(&fe, SourceLocation(), clang::SrcMgr::C_User);
+ SrcMgr.createFileID(fe, SourceLocation(), clang::SrcMgr::C_User);
SrcMgr.setMainFileID(fid);
// Create the source location for the test diagnostic.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92968.310646.patch
Type: text/x-patch
Size: 1325 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201209/dc9255ab/attachment.bin>
More information about the cfe-commits
mailing list