compilerplugins/clang/pluginhandler.cxx |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

New commits:
commit d2346c3d4d38edf5c89c3600caf23baf41164d63
Author:     Stephan Bergmann <stephan.bergm...@allotropia.de>
AuthorDate: Mon Dec 11 08:52:13 2023 +0100
Commit:     Stephan Bergmann <stephan.bergm...@allotropia.de>
CommitDate: Mon Dec 11 12:31:27 2023 +0100

    -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
    
<https://github.com/llvm/llvm-project/commit/d1f86c3d03b7549eb0153c62550ef0f513ff50e8>
    "[clang] NFC: Deprecate `FileEntry::getName()` (#68157)" on LLVM 18 trunk.
    (clang::SourceManager::getFileEntryRefForID exists since
    
<https://github.com/llvm/llvm-project/commit/4dc5573acc0d2e7c59d8bac2543eb25cb4b32984>
    "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<FileEntryRef> 
to
    OptionalFileEntryRef along the way.)
    
    Change-Id: Ie37ba20c18f5ec33bab9ca2a96a9bcf722558c7b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160561
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <stephan.bergm...@allotropia.de>

diff --git a/compilerplugins/clang/pluginhandler.cxx 
b/compilerplugins/clang/pluginhandler.cxx
index f5d27dd76b2b..fdf9658e2765 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>")
         // 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).

Reply via email to