Page MenuHomePhabricator

Fix issues with using clangd with C++ modules
AbandonedPublic

Authored by kuganv on Apr 25 2022, 10:40 PM.

Details

Reviewers
None
Summary

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.

Diff Detail

Unit TestsFailed

TimeTest
5,870 msx64 debian > libFuzzer.libFuzzer::fuzzer-leak.test
Script: -- : 'RUN: at line 3'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/LeakTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/fuzzer-leak.test.tmp-LeakTest

Event Timeline

kuganv created this revision.Apr 25 2022, 10:40 PM
kuganv requested review of this revision.Apr 25 2022, 10:40 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptApr 25 2022, 10:40 PM
kuganv edited the summary of this revision. (Show Details)Apr 25 2022, 10:50 PM
kuganv edited the summary of this revision. (Show Details)Apr 25 2022, 10:58 PM
kuganv edited the summary of this revision. (Show Details)
kuganv updated this revision to Diff 426690.May 3 2022, 6:56 AM
kuganv updated this revision to Diff 426724.May 3 2022, 8:30 AM
kuganv abandoned this revision.May 4 2022, 2:46 AM