Skip to content

Commit ee29996

Browse files
committed
Adapt llvmorg-12-init-11522-g4c55c3b66de: change ComputePreambleBounds
1 parent 8939f8e commit ee29996

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/sema_manager.cc

+9
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,11 @@ void buildPreamble(Session &session, CompilerInvocation &ci,
350350
std::string content = session.wfiles->getContent(task.path);
351351
std::unique_ptr<llvm::MemoryBuffer> buf =
352352
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
353356
auto bounds = ComputePreambleBounds(*ci.getLangOpts(), buf.get(), 0);
357+
#endif
354358
if (!task.from_diag && oldP &&
355359
oldP->preamble.CanReuse(ci, buf.get(), bounds, fs.get()))
356360
return;
@@ -472,8 +476,13 @@ void *completionMain(void *manager_) {
472476
DiagnosticConsumer dc;
473477
std::string content = manager->wfiles->getContent(task->path);
474478
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
475483
PreambleBounds bounds =
476484
ComputePreambleBounds(*ci->getLangOpts(), buf.get(), 0);
485+
#endif
477486
bool in_preamble =
478487
getOffsetForPosition({task->position.line, task->position.character},
479488
content) < (int)bounds.Size;

0 commit comments

Comments
 (0)