Skip to content

Commit 4cd308d

Browse files
committed
Adapt llvmorg-12-init-17739-gf4d02fbe418d: change CanReuse
1 parent aca02d2 commit 4cd308d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/sema_manager.cc

+7-2
Original file line numberDiff line numberDiff line change
@@ -350,14 +350,19 @@ 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
353+
#if LLVM_VERSION_MAJOR >= 12
354+
// llvmorg-12-init-11522-g4c55c3b66de
354355
auto bounds = ComputePreambleBounds(*ci.getLangOpts(), *buf, 0);
356+
// llvmorg-12-init-17739-gf4d02fbe418d
357+
if (!task.from_diag && oldP &&
358+
oldP->preamble.CanReuse(ci, *buf, bounds, *fs))
359+
return;
355360
#else
356361
auto bounds = ComputePreambleBounds(*ci.getLangOpts(), buf.get(), 0);
357-
#endif
358362
if (!task.from_diag && oldP &&
359363
oldP->preamble.CanReuse(ci, buf.get(), bounds, fs.get()))
360364
return;
365+
#endif
361366
// -Werror makes warnings issued as errors, which stops parsing
362367
// prematurely because of -ferror-limit=. This also works around the issue
363368
// of -Werror + -Wunused-parameter in interaction with SkipFunctionBodies.

0 commit comments

Comments
 (0)