diff options
author | Jan Svoboda <jan_svoboda@apple.com> | 2022-04-15 14:48:01 +0200 |
---|---|---|
committer | Jan Svoboda <jan_svoboda@apple.com> | 2022-04-15 15:16:17 +0200 |
commit | 9d98f58959b12b6ddab5ac10453e1464bb830e96 (patch) | |
tree | e3fbe9ddb5f5851ed870c687d23d3d2335efd5e7 | |
parent | f263dac4465c251e37af9787baf5e9f56138e369 (diff) | |
download | llvm-9d98f58959b12b6ddab5ac10453e1464bb830e96.zip llvm-9d98f58959b12b6ddab5ac10453e1464bb830e96.tar.gz llvm-9d98f58959b12b6ddab5ac10453e1464bb830e96.tar.bz2 |
[clang][CodeGen] NFCI: Use FileEntryRef
This patch removes use of the deprecated `DirectoryEntry::getName()` from clangCodeGen by using `{File,Directory}EntryRef` instead.
Reviewed By: bnbarham
Differential Revision: https://reviews.llvm.org/D123768
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 5 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGObjCGNU.cpp | 5 |
2 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index c18dbcc..4bfa846 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -519,8 +519,9 @@ void CGDebugInfo::CreateCompileUnit() { // a relative path, so we look into the actual file entry for the main // file to determine the real absolute path for the file. std::string MainFileDir; - if (const FileEntry *MainFile = SM.getFileEntryForID(SM.getMainFileID())) { - MainFileDir = std::string(MainFile->getDir()->getName()); + if (Optional<FileEntryRef> MainFile = + SM.getFileEntryRefForID(SM.getMainFileID())) { + MainFileDir = std::string(MainFile->getDir().getName()); if (!llvm::sys::path::is_absolute(MainFileName)) { llvm::SmallString<1024> MainFileDirSS(MainFileDir); llvm::sys::path::append(MainFileDirSS, MainFileName); diff --git a/clang/lib/CodeGen/CGObjCGNU.cpp b/clang/lib/CodeGen/CGObjCGNU.cpp index 0301076..ec459f0 100644 --- a/clang/lib/CodeGen/CGObjCGNU.cpp +++ b/clang/lib/CodeGen/CGObjCGNU.cpp @@ -3862,9 +3862,10 @@ llvm::Function *CGObjCGNU::ModuleInitFunction() { // The path to the source file where this module was declared SourceManager &SM = CGM.getContext().getSourceManager(); - const FileEntry *mainFile = SM.getFileEntryForID(SM.getMainFileID()); + Optional<FileEntryRef> mainFile = + SM.getFileEntryRefForID(SM.getMainFileID()); std::string path = - (Twine(mainFile->getDir()->getName()) + "/" + mainFile->getName()).str(); + (mainFile->getDir().getName() + "/" + mainFile->getName()).str(); module.add(MakeConstantString(path, ".objc_source_file_name")); module.add(symtab); |