[IRGen] Don't emit coverage maps for synthesized Clang decls

We don't need to perform coverage mapping for any
Clang decls we've synthesized, as they have no
user-written code. This is also needed to avoid a
Clang crash when attempting to emit coverage for
decls without source locations (rdar://100172217).

rdar://82820628
This commit is contained in:
Hamish Knight
2022-09-20 15:58:07 +01:00
parent ff768b9024
commit 0431bb2d1c
4 changed files with 26 additions and 0 deletions

View File

@@ -138,6 +138,12 @@ static clang::CodeGenerator *createClangCodeGenerator(ASTContext &Context,
CGO.TrapFuncName = Opts.TrapFuncName;
}
// We don't need to perform coverage mapping for any Clang decls we've
// synthesized, as they have no user-written code. This is also needed to
// avoid a Clang crash when attempting to emit coverage for decls without
// source locations (rdar://100172217).
CGO.CoverageMapping = false;
auto &VFS = Importer->getClangInstance().getVirtualFileSystem();
auto &HSI = Importer->getClangPreprocessor()
.getHeaderSearchInfo()