Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.1)

include(GNUInstallDirs)
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD 20)

add_subdirectory(generator)
add_subdirectory(indexgenerator)
Expand Down
2 changes: 1 addition & 1 deletion generator/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.1)
project(codebrowser_generator)

Find_Package(LLVM 15 REQUIRED CONFIG)
Find_Package(LLVM 16 REQUIRED CONFIG)
message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION} in ${LLVM_INSTALL_PREFIX}")
message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}")
Find_Package(Clang REQUIRED CONFIG HINTS "${LLVM_INSTALL_PREFIX}/lib/cmake/clang")
Expand Down
20 changes: 17 additions & 3 deletions generator/annotator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1038,10 +1038,24 @@ void Annotator::syntaxHighlight(Generator &generator, clang::FileID FID, clang::

clang::Preprocessor &PP = Sema.getPreprocessor();
const clang::SourceManager &SM = getSourceMgr();
llvm::MemoryBufferRef FromFile = SM.getBufferOrFake(FID);
#if CLANG_VERSION_MAJOR >= 16
const llvm::Optional<llvm::MemoryBufferRef> FromFile = SM.getBufferOrNone(FID);
if (!FromFile.has_value()) {
return;
}
Lexer L(FID, *FromFile, SM, getLangOpts());
#elif CLANG_VERSION_MAJOR >= 12
const llvm::Optional<llvm::MemoryBufferRef> FromFile = SM.getBufferOrNone(FID);
if (!FromFile.hasValue()) {
return;
}
Lexer L(FID, FromFile.getValue(), SM, getLangOpts());
#else
const llvm::MemoryBuffer *FromFile = SM.getBuffer(FID);
Lexer L(FID, FromFile, SM, getLangOpts());
const char *BufferStart = FromFile.getBufferStart();
const char *BufferEnd = FromFile.getBufferEnd();
#endif
const char *BufferStart = FromFile->getBufferStart();
const char *BufferEnd = FromFile->getBufferEnd();

// Inform the preprocessor that we want to retain comments as tokens, so we
// can highlight them.
Expand Down
8 changes: 6 additions & 2 deletions generator/preprocessorcallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ void PreprocessorCallback::InclusionDirective(clang::SourceLocation HashLoc,
llvm::StringRef FileName,
bool IsAngled,
clang::CharSourceRange FilenameRange,
#if CLANG_VERSION_MAJOR >= 15
#if CLANG_VERSION_MAJOR >= 16
clang::OptionalFileEntryRef File,
#elif CLANG_VERSION_MAJOR >= 15
llvm::Optional<clang::FileEntryRef> File,
#else
const clang::FileEntry* File,
Expand All @@ -281,7 +283,9 @@ void PreprocessorCallback::InclusionDirective(clang::SourceLocation HashLoc,
if (!annotator.shouldProcess(FID))
return;

#if CLANG_VERSION_MAJOR >= 15
#if CLANG_VERSION_MAJOR >= 16
std::string link = annotator.pathTo(FID, *File);
#elif CLANG_VERSION_MAJOR >= 15
std::string link = annotator.pathTo(FID, File.value());
#else
std::string link = annotator.pathTo(FID, File);
Expand Down
4 changes: 3 additions & 1 deletion generator/preprocessorcallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ class PreprocessorCallback : public clang::PPCallbacks {
llvm::StringRef FileName,
bool IsAngled,
clang::CharSourceRange FilenameRange,
#if CLANG_VERSION_MAJOR >= 15
#if CLANG_VERSION_MAJOR >= 16
clang::OptionalFileEntryRef File,
#elif CLANG_VERSION_MAJOR >= 15
llvm::Optional<clang::FileEntryRef> File,
#else
const clang::FileEntry* File,
Expand Down