@@ -350,7 +350,11 @@ void buildPreamble(Session &session, CompilerInvocation &ci,
350
350
std::string content = session.wfiles ->getContent (task.path );
351
351
std::unique_ptr<llvm::MemoryBuffer> buf =
352
352
llvm::MemoryBuffer::getMemBuffer (content);
353
+ #if LLVM_VERSION_MAJOR >= 12 // llvmorg-12-init-11522-g4c55c3b66de
354
+ auto bounds = ComputePreambleBounds (*ci.getLangOpts (), *buf, 0 );
355
+ #else
353
356
auto bounds = ComputePreambleBounds (*ci.getLangOpts (), buf.get (), 0 );
357
+ #endif
354
358
if (!task.from_diag && oldP &&
355
359
oldP->preamble .CanReuse (ci, buf.get (), bounds, fs.get ()))
356
360
return ;
@@ -472,8 +476,13 @@ void *completionMain(void *manager_) {
472
476
DiagnosticConsumer dc;
473
477
std::string content = manager->wfiles ->getContent (task->path );
474
478
auto buf = llvm::MemoryBuffer::getMemBuffer (content);
479
+ #if LLVM_VERSION_MAJOR >= 12 // llvmorg-12-init-11522-g4c55c3b66de
480
+ PreambleBounds bounds =
481
+ ComputePreambleBounds (*ci->getLangOpts (), *buf, 0 );
482
+ #else
475
483
PreambleBounds bounds =
476
484
ComputePreambleBounds (*ci->getLangOpts (), buf.get (), 0 );
485
+ #endif
477
486
bool in_preamble =
478
487
getOffsetForPosition ({task->position .line , task->position .character },
479
488
content) < (int )bounds.Size ;
0 commit comments