diff options
author | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2023-12-18 15:15:09 +0100 |
---|---|---|
committer | Stephan Bergmann <stephan.bergmann@allotropia.de> | 2023-12-18 17:40:26 +0100 |
commit | d2c54902102ab9ee40cca16ae21f1bf3ad7c4066 (patch) | |
tree | b5a1cd806ad4ca2c5a7a4cd488a05a76773d79ef /compilerplugins/clang/plugin.cxx | |
parent | 3174749bb826fd653c923cadc98c7045a70bfd2f (diff) |
-Werror,-Wdeprecated-declarations
> compilerplugins/clang/casttovoid.cxx:452:18: error: 'endswith' is deprecated: Use ends_with instead [-Werror,-Wdeprecated-declarations]
> .endswith(".h"));
> ^~~~~~~~
> ends_with
> ~/llvm/inst/include/llvm/ADT/StringRef.h:276:19: note: 'endswith' has been explicitly marked deprecated here
> [[nodiscard]] LLVM_DEPRECATED(
> ^
etc. after
<https://github.com/llvm/llvm-project/commit/5ac12951b4e9bbfcc5791282d0961ec2b65575e9>
"[ADT] Deprecate StringRef::{starts,ends}with (#75491)" on Clang 18 trunk, where
<https://github.com/llvm/llvm-project/commit/1b97645e56bf321b06d1353024339958b64fd242>
"[ADT] Introduce StringRef::{starts,ends}_width{,_insensitive}" had been added
towards Clang 16
Change-Id: Icb3e43b7d6be6f877815285913d846f766eddebf
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160919
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Diffstat (limited to 'compilerplugins/clang/plugin.cxx')
-rw-r--r-- | compilerplugins/clang/plugin.cxx | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx index 10102d426079..8d8207d30437 100644 --- a/compilerplugins/clang/plugin.cxx +++ b/compilerplugins/clang/plugin.cxx @@ -203,7 +203,7 @@ bool Plugin::suppressWarningAt(SourceLocation location) const { if (isDebugMode()) { report(DiagnosticsEngine::Fatal, "failed to getSpelling", prev); } - } else if (!spell.startswith("/*")) { + } else if (!compat::starts_with(spell, "/*")) { continue; } } @@ -441,7 +441,7 @@ StringRef Plugin::getFilenameOfLocation(SourceLocation spellingLocation) const return fn; } #if !defined _WIN32 - assert(fn.startswith("/") || fn == "<stdin>"); + assert(compat::starts_with(fn, "/") || fn == "<stdin>"); #endif s_Mode = fn == "<stdin>" ? STDIN : GOOD; return getFilenameOfLocation(spellingLocation); @@ -862,9 +862,8 @@ bool RewritePlugin::wouldRewriteWorkdir(SourceLocation loc) if (loc.isInvalid() || loc.isMacroID()) { return false; } - return - getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(loc)) - .startswith(WORKDIR "/"); + return compat::starts_with( + getFilenameOfLocation(compiler.getSourceManager().getSpellingLoc(loc)), WORKDIR "/"); } bool RewritePlugin::reportEditFailure( SourceLocation loc ) @@ -918,7 +917,7 @@ bool hasPathnamePrefix(StringRef pathname, StringRef prefix) { return checkPathname( pathname, prefix, - [](StringRef p, StringRef a) { return p.startswith(a); }); + [](StringRef p, StringRef a) { return compat::starts_with(p, a); }); } bool isSamePathname(StringRef pathname, StringRef other) |