llvm-project/clang/lib/Serialization
Jan Svoboda 4295ae96cd [clang][modules] Use extensible RTTI for ModuleFileExtension
Clang exposes an interface for extending the PCM/PCH file format: `ModuleFileExtension`.

Clang itself has only a single implementation of the interface: `TestModuleFileExtension` that can be instantiated via the `-ftest-module-file_extension=` command line argument (and is stored in `FrontendOptions::ModuleFileExtensions`).

Clients of the Clang library can extend the PCM/PCH file format by pushing an instance of their extension class to the `FrontendOptions::ModuleFileExtensions` vector.

When generating the `-ftest-module-file_extension=` command line argument from `FrontendOptions`, a downcast is used to distinguish between the Clang's testing extension and other (client) extensions.

This functionality is enabled by LLVM-style RTTI. However, this style of RTTI is hard to extend, as it requires patching Clang (adding new case to the `ModuleFileExtensionKind` enum).

This patch switches to the LLVM RTTI for open class hierarchies, which allows libClang users (e.g. Swift) to create implementations of `ModuleFileExtension` without patching Clang. (Documentation of the feature: https://llvm.org/docs/HowToSetUpLLVMStyleRTTI.html#rtti-for-open-class-hierarchies)

Reviewed By: artemcm

Differential Revision: https://reviews.llvm.org/D97702
2021-03-05 11:11:05 +01:00
..
ASTCommon.cpp [Clang][RISCV] Define RISC-V V builtin types 2021-02-18 10:17:31 +08:00
ASTCommon.h [OPENMP 5.0]Add initial support for 'allocate' directive. 2019-03-07 17:54:44 +00:00
ASTReader.cpp [OpenCL] Prevent adding extension pragma by default. 2021-03-03 15:02:21 +00:00
ASTReaderDecl.cpp Recommit of a2fdf9d4d7. 2021-02-05 11:27:30 -05:00
ASTReaderInternals.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ASTReaderStmt.cpp [clang][OpenMP] Use OpenMPIRBuilder for workshare loops. 2021-03-04 22:52:59 -06:00
ASTWriter.cpp [OpenCL] Prevent adding extension pragma by default. 2021-03-03 15:02:21 +00:00
ASTWriterDecl.cpp Revert "[NFC, Refactor] Modernize StorageClass from Specifiers.h to a scoped enum (II)" 2021-01-04 23:17:45 +01:00
ASTWriterStmt.cpp [clang][OpenMP] Use OpenMPIRBuilder for workshare loops. 2021-03-04 22:52:59 -06:00
CMakeLists.txt [openmp] Base of tablegen generated OpenMP common declaration 2020-06-23 10:32:32 -04:00
GeneratePCH.cpp [pch] Honour -fallow-pch-with-compiler-errors for overall compilation status 2020-03-31 13:50:12 -07:00
GlobalModuleIndex.cpp [clang][NFC] Use SmallString instead of SmallVector<char 2020-11-17 13:02:58 +00:00
InMemoryModuleCache.cpp Revert "[modules] Do not cache invalid state for modules that we attempted to load." 2020-03-10 10:59:26 -07:00
ModuleFile.cpp clang/Modules: Move Serialization/Module.{h,cpp} to ModuleFile, NFC 2019-11-21 19:07:00 -08:00
ModuleFileExtension.cpp [clang][modules] Use extensible RTTI for ModuleFileExtension 2021-03-05 11:11:05 +01:00
ModuleManager.cpp Change Module::ASTFile and ModuleFile::File => Optional<FileEntryRef>, NFC 2020-11-02 15:11:51 -05:00
MultiOnDiskHashTable.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
PCHContainerOperations.cpp [Clang] Migrate llvm::make_unique to std::make_unique 2019-08-14 23:04:18 +00:00