mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
Adapt llvmorg-18-init-4877-g62e576b454e1: getLangOpts
This commit is contained in:
parent
ee2d4f5b9a
commit
7b17426b9f
@ -163,10 +163,16 @@ buildCompilerInvocation(const std::string &main, std::vector<const char *> args,
|
||||
ci->getFrontendOpts().DisableFree = false;
|
||||
// Enable IndexFrontendAction::shouldSkipFunctionBody.
|
||||
ci->getFrontendOpts().SkipFunctionBodies = true;
|
||||
#if LLVM_VERSION_MAJOR >= 18
|
||||
ci->getLangOpts().SpellChecking = false;
|
||||
ci->getLangOpts().RecoveryAST = true;
|
||||
ci->getLangOpts().RecoveryASTType = true;
|
||||
#else
|
||||
ci->getLangOpts()->SpellChecking = false;
|
||||
#if LLVM_VERSION_MAJOR >= 11
|
||||
ci->getLangOpts()->RecoveryAST = true;
|
||||
ci->getLangOpts()->RecoveryASTType = true;
|
||||
#endif
|
||||
#endif
|
||||
auto &isec = ci->getFrontendOpts().Inputs;
|
||||
if (isec.size())
|
||||
|
@ -1294,9 +1294,15 @@ index(SemaManager *manager, WorkingFiles *wfiles, VFS *vfs,
|
||||
ok = false;
|
||||
// -fparse-all-comments enables documentation in the indexer and in
|
||||
// code completion.
|
||||
#if LLVM_VERSION_MAJOR >= 18
|
||||
ci->getLangOpts().CommentOpts.ParseAllComments =
|
||||
g_config->index.comments > 1;
|
||||
ci->getLangOpts().RetainCommentsFromSystemHeaders = true;
|
||||
#else
|
||||
ci->getLangOpts()->CommentOpts.ParseAllComments =
|
||||
g_config->index.comments > 1;
|
||||
ci->getLangOpts()->RetainCommentsFromSystemHeaders = true;
|
||||
#endif
|
||||
std::string buf = wfiles->getContent(main);
|
||||
std::vector<std::unique_ptr<llvm::MemoryBuffer>> bufs;
|
||||
if (buf.size())
|
||||
|
@ -368,8 +368,12 @@ void buildPreamble(Session &session, CompilerInvocation &ci,
|
||||
std::unique_ptr<llvm::MemoryBuffer> buf =
|
||||
llvm::MemoryBuffer::getMemBuffer(content);
|
||||
#if LLVM_VERSION_MAJOR >= 12
|
||||
#if LLVM_VERSION_MAJOR >= 18
|
||||
auto bounds = ComputePreambleBounds(ci.getLangOpts(), *buf, 0);
|
||||
#else
|
||||
// llvmorg-12-init-11522-g4c55c3b66de
|
||||
auto bounds = ComputePreambleBounds(*ci.getLangOpts(), *buf, 0);
|
||||
#endif
|
||||
// llvmorg-12-init-17739-gf4d02fbe418d
|
||||
if (!task.from_diag && oldP &&
|
||||
oldP->preamble.CanReuse(ci, *buf, bounds, *fs))
|
||||
@ -387,8 +391,13 @@ void buildPreamble(Session &session, CompilerInvocation &ci,
|
||||
ws.erase(std::remove(ws.begin(), ws.end(), "error"), ws.end());
|
||||
ci.getDiagnosticOpts().IgnoreWarnings = false;
|
||||
ci.getFrontendOpts().SkipFunctionBodies = true;
|
||||
#if LLVM_VERSION_MAJOR >= 18
|
||||
ci.getLangOpts().CommentOpts.ParseAllComments = g_config->index.comments > 1;
|
||||
ci.getLangOpts().RetainCommentsFromSystemHeaders = true;
|
||||
#else
|
||||
ci.getLangOpts()->CommentOpts.ParseAllComments = g_config->index.comments > 1;
|
||||
ci.getLangOpts()->RetainCommentsFromSystemHeaders = true;
|
||||
#endif
|
||||
|
||||
StoreDiags dc(task.path);
|
||||
IntrusiveRefCntPtr<DiagnosticsEngine> de =
|
||||
@ -498,12 +507,19 @@ void *completionMain(void *manager_) {
|
||||
fOpts.CodeCompletionAt.FileName = task->path;
|
||||
fOpts.CodeCompletionAt.Line = task->position.line + 1;
|
||||
fOpts.CodeCompletionAt.Column = task->position.character + 1;
|
||||
#if LLVM_VERSION_MAJOR >= 18
|
||||
ci->getLangOpts().CommentOpts.ParseAllComments = true;
|
||||
#else
|
||||
ci->getLangOpts()->CommentOpts.ParseAllComments = true;
|
||||
#endif
|
||||
|
||||
DiagnosticConsumer dc;
|
||||
std::string content = manager->wfiles->getContent(task->path);
|
||||
auto buf = llvm::MemoryBuffer::getMemBuffer(content);
|
||||
#if LLVM_VERSION_MAJOR >= 12 // llvmorg-12-init-11522-g4c55c3b66de
|
||||
#if LLVM_VERSION_MAJOR >= 18
|
||||
PreambleBounds bounds =
|
||||
ComputePreambleBounds(ci->getLangOpts(), *buf, 0);
|
||||
#elif LLVM_VERSION_MAJOR >= 12 // llvmorg-12-init-11522-g4c55c3b66de
|
||||
PreambleBounds bounds =
|
||||
ComputePreambleBounds(*ci->getLangOpts(), *buf, 0);
|
||||
#else
|
||||
@ -601,7 +617,10 @@ void *diagnosticMain(void *manager_) {
|
||||
if (!rebuild) {
|
||||
std::string content = manager->wfiles->getContent(task.path);
|
||||
auto buf = llvm::MemoryBuffer::getMemBuffer(content);
|
||||
#if LLVM_VERSION_MAJOR >= 12 // llvmorg-12-init-11522-g4c55c3b66de
|
||||
#if LLVM_VERSION_MAJOR >= 18
|
||||
PreambleBounds bounds =
|
||||
ComputePreambleBounds(ci->getLangOpts(), *buf, 0);
|
||||
#elif LLVM_VERSION_MAJOR >= 12 // llvmorg-12-init-11522-g4c55c3b66de
|
||||
PreambleBounds bounds =
|
||||
ComputePreambleBounds(*ci->getLangOpts(), *buf, 0);
|
||||
#else
|
||||
@ -622,7 +641,11 @@ void *diagnosticMain(void *manager_) {
|
||||
ci->getDiagnosticOpts().Warnings.push_back("no-unused-function");
|
||||
ci->getDiagnosticOpts().IgnoreWarnings = false;
|
||||
ci->getFrontendOpts().SkipFunctionBodies = false;
|
||||
#if LLVM_VERSION_MAJOR >= 18
|
||||
ci->getLangOpts().SpellChecking = g_config->diagnostics.spellChecking;
|
||||
#else
|
||||
ci->getLangOpts()->SpellChecking = g_config->diagnostics.spellChecking;
|
||||
#endif
|
||||
StoreDiags dc(task.path);
|
||||
std::string content = manager->wfiles->getContent(task.path);
|
||||
auto buf = llvm::MemoryBuffer::getMemBuffer(content);
|
||||
|
Loading…
Reference in New Issue
Block a user