Skip to content

Commit

Permalink
Adapt llvmorg-12-init-11522-g4c55c3b66de: change ComputePreambleBounds
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Nov 19, 2020
1 parent 8939f8e commit ee29996
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/sema_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ void buildPreamble(Session &session, CompilerInvocation &ci,
std::string content = session.wfiles->getContent(task.path);
std::unique_ptr<llvm::MemoryBuffer> buf =
llvm::MemoryBuffer::getMemBuffer(content);
#if LLVM_VERSION_MAJOR >= 12 // llvmorg-12-init-11522-g4c55c3b66de
auto bounds = ComputePreambleBounds(*ci.getLangOpts(), *buf, 0);
#else
auto bounds = ComputePreambleBounds(*ci.getLangOpts(), buf.get(), 0);
#endif
if (!task.from_diag && oldP &&
oldP->preamble.CanReuse(ci, buf.get(), bounds, fs.get()))
return;
Expand Down Expand Up @@ -472,8 +476,13 @@ void *completionMain(void *manager_) {
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
PreambleBounds bounds =
ComputePreambleBounds(*ci->getLangOpts(), *buf, 0);
#else
PreambleBounds bounds =
ComputePreambleBounds(*ci->getLangOpts(), buf.get(), 0);
#endif
bool in_preamble =
getOffsetForPosition({task->position.line, task->position.character},
content) < (int)bounds.Size;
Expand Down

0 comments on commit ee29996

Please sign in to comment.