From d2346c3d4d38edf5c89c3600caf23baf41164d63 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 11 Dec 2023 08:52:13 +0100 Subject: -Werror,-Wdeprecated-declarations > compilerplugins/clang/pluginhandler.cxx:67:71: error: 'getName' is deprecated: Use FileEntryRef::getName() instead. [-Werror,-Wdeprecated-declarations] > 67 | compiler.getASTContext().getSourceManager().getMainFileID())->getName()); > | ^ > ~/llvm/inst/include/clang/Basic/FileEntry.h:331:3: note: 'getName' has been explicitly marked deprecated here > 331 | LLVM_DEPRECATED("Use FileEntryRef::getName() instead.", "") > | ^ > ~/llvm/inst/include/llvm/Support/Compiler.h:155:50: note: expanded from macro 'LLVM_DEPRECATED' > 155 | #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX))) > | ^ > compilerplugins/clang/pluginhandler.cxx:355:35: error: 'getName' is deprecated: Use FileEntryRef::getName() instead. [-Werror,-Wdeprecated-declarations] > 355 | StringRef const name = e->getName(); > | ^ > ~/llvm/inst/include/clang/Basic/FileEntry.h:331:3: note: 'getName' has been explicitly marked deprecated here > 331 | LLVM_DEPRECATED("Use FileEntryRef::getName() instead.", "") > | ^ > ~/llvm/inst/include/llvm/Support/Compiler.h:155:50: note: expanded from macro 'LLVM_DEPRECATED' > 155 | #define LLVM_DEPRECATED(MSG, FIX) __attribute__((deprecated(MSG, FIX))) > | ^ since "[clang] NFC: Deprecate `FileEntry::getName()` (#68157)" on LLVM 18 trunk. (clang::SourceManager::getFileEntryRefForID exists since "Introduce FileEntryRef and use it when handling includes to report correct dependencies when the FileManager is reused across invocations" towards Clang 10, even when it changed its return type from Optional to OptionalFileEntryRef along the way.) Change-Id: Ie37ba20c18f5ec33bab9ca2a96a9bcf722558c7b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160561 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- compilerplugins/clang/pluginhandler.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'compilerplugins') diff --git a/compilerplugins/clang/pluginhandler.cxx b/compilerplugins/clang/pluginhandler.cxx index f5d27dd76b2ba..fdf9658e2765d 100644 --- a/compilerplugins/clang/pluginhandler.cxx +++ b/compilerplugins/clang/pluginhandler.cxx @@ -63,7 +63,7 @@ static bool unitTestMode = false; StringRef initMainFileName(CompilerInstance& compiler) { - StringRef const& fn(compiler.getASTContext().getSourceManager().getFileEntryForID( + StringRef const& fn(compiler.getASTContext().getSourceManager().getFileEntryRefForID( compiler.getASTContext().getSourceManager().getMainFileID())->getName()); if (fn == "") // stdin means icecream, so we can rely on -main-file-name containing the full path name @@ -342,8 +342,8 @@ void PluginHandler::HandleTranslationUnit( ASTContext& context ) it != rewriter.buffer_end(); ++it ) { - const FileEntry* e = context.getSourceManager().getFileEntryForID( it->first ); - if( e == NULL ) + auto e = context.getSourceManager().getFileEntryRefForID( it->first ); + if( !e ) continue; // Failed modification because of a macro expansion? /* Check where the file actually is, and warn about cases where modification most probably doesn't matter (generated files in workdir). -- cgit