[PATCH] D124432: Fix issues with using clangd with C++ modules
Kugan Vivekanandarajah via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 25 22:41:00 PDT 2022
kuganv created this revision.
Herald added subscribers: dexonsmith, usaxena95, kadircet, arphaman.
Herald added a project: All.
kuganv requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added projects: clang, clang-tools-extra.
Fixes following incompatibility issues with c++ modules
(clangd with c++ modules results in assertion failure and pch_langopt_mismatch #1105)
1. Preamble generated by clangd is generated with WriteCommentListToPCH = false;
However, if we are using precompiled modules that have comments in the
serialised AST, following sanity check in the clangd fails.
// Sanity check that the comment does not come from the PCH. We choose to not
// write them into PCH, because they are racy and slow to load.
assert(!Ctx.getSourceManager().isLoadedSourceLocation(RC→getBeginLoc()));
In this patch when we are generating Preamble with
WriteCommentListToPCH, we do not load the comments from AST.
2. If we have modules that are built with RetainCommentsFromSystemHeaders
difference, that would prevent modules from getting loaded. Since this
difference is not critical that should be stopping modules from being loaded,
this patch changes it to be a COMPATIBLE_LANGOPT.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D124432
Files:
clang-tools-extra/clangd/test/modules-options-compatablity-test/A.h
clang-tools-extra/clangd/test/modules-options-compatablity-test/B.h
clang-tools-extra/clangd/test/modules-options-compatablity-test/compile_commands.json
clang-tools-extra/clangd/test/modules-options-compatablity-test/definition.jsonrpc
clang-tools-extra/clangd/test/modules-options-compatablity-test/module.modulemap
clang-tools-extra/clangd/test/modules-options-compatablity-test/use.c
clang-tools-extra/clangd/test/modules-options-compatablity.test
clang/include/clang/Basic/LangOptions.def
clang/lib/Serialization/ASTReader.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124432.425120.patch
Type: text/x-patch
Size: 4858 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220426/672d7b3f/attachment-0001.bin>
More information about the cfe-commits
mailing list