From cc9ffdb685119a7c11248f08cf88308927252b85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= Date: Tue, 30 Apr 2024 16:06:28 +0200 Subject: ClangFormat: Fix compiliation with LLVM19 Change-Id: I4b166da2e477ffd101a5c4b9aa07c710f7698da9 Reviewed-by: Christian Kandeler --- src/plugins/clangformat/clangformatbaseindenter.cpp | 4 ++++ src/plugins/clangformat/llvmfilesystem.h | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp index 1d5dc2730c..b491bd293f 100644 --- a/src/plugins/clangformat/clangformatbaseindenter.cpp +++ b/src/plugins/clangformat/clangformatbaseindenter.cpp @@ -65,7 +65,11 @@ static void adjustFormatStyleForLineBreak(clang::format::FormatStyle &style, static llvm::StringRef clearExtraNewline(llvm::StringRef text) { +#if LLVM_VERSION_MAJOR >= 16 + while (text.starts_with("\n\n")) +#else while (text.startswith("\n\n")) +#endif text = text.drop_front(); return text; } diff --git a/src/plugins/clangformat/llvmfilesystem.h b/src/plugins/clangformat/llvmfilesystem.h index fface01fc0..b2d1c5de7e 100644 --- a/src/plugins/clangformat/llvmfilesystem.h +++ b/src/plugins/clangformat/llvmfilesystem.h @@ -127,7 +127,11 @@ public: /// Gets real path of \p Path e.g. collapse all . and .. patterns, resolve /// symlinks. For real file system, this uses `llvm::sys::fs::real_path`. /// This returns errc::operation_not_permitted if not implemented by subclass. - std::error_code getRealPath(const Twine &Path, SmallVectorImpl &Output) const override + std::error_code getRealPath(const Twine &Path, SmallVectorImpl &Output) +#if LLVM_VERSION_MAJOR < 19 + const +#endif + override { Q_UNUSED(Path); Q_UNUSED(Output); -- cgit v1.2.3