Fix build with llvm-15 and llvm-16
https://github.com/KDE/clazy/commit/20fca52da739ebefa47e35f6b338bb99a0da3cfe
https://invent.kde.org/sdk/clazy/-/merge_requests/73

Index: src/SourceCompatibilityHelpers.h
--- src/SourceCompatibilityHelpers.h.orig
+++ src/SourceCompatibilityHelpers.h
@@ -107,8 +107,12 @@ inline clang::tooling::Replacements& DiagnosticFix(cla
 
 inline auto getBuffer(const clang::SourceManager &sm, clang::FileID id, bool *invalid)
 {
-#if LLVM_VERSION_MAJOR >= 12
+#if LLVM_VERSION_MAJOR >= 16
     auto buffer = sm.getBufferOrNone(id);
+    *invalid = !buffer.has_value();
+    return buffer;
+#elif LLVM_VERSION_MAJOR >= 12
+    auto buffer = sm.getBufferOrNone(id);
     *invalid = !buffer.hasValue();
     return buffer;
 #else
@@ -116,11 +120,12 @@ inline auto getBuffer(const clang::SourceManager &sm, 
 #endif
 }
 
-#if LLVM_VERSION_MAJOR >= 12
-
+#if LLVM_VERSION_MAJOR >= 16
 #define GET_LEXER(id, inputFile, sm, lo) \
+clang::Lexer(id, inputFile.value(), sm, lo)
+#elif LLVM_VERSION_MAJOR >= 12
+#define GET_LEXER(id, inputFile, sm, lo) \
 clang::Lexer(id, inputFile.getValue(), sm, lo)
-
 #else
 #define GET_LEXER(id, inputFile, sm, lo) \
 clang::Lexer(id, inputFile, sm, lo)
@@ -141,6 +146,23 @@ inline bool contains_lower(clang::StringRef haystack, 
     return haystack.contains_insensitive(needle);
 #else
     return haystack.contains_lower(needle);
+#endif
+}
+
+#if LLVM_VERSION_MAJOR >= 16
+using OptionalFileEntryRef = clang::CustomizableOptional<clang::FileEntryRef>;
+#elif LLVM_VERSION_MAJOR >= 15
+using OptionalFileEntryRef = clang::Optional<clang::FileEntryRef>;
+#else
+using OptionalFileEntryRef = const clang::FileEntry*;
+#endif
+
+inline bool isAscii(clang::StringLiteral *lt)
+{
+#if LLVM_VERSION_MAJOR >= 15
+    return lt->isOrdinary();
+#else
+    return lt->isAscii();
 #endif
 }
 
