22#include "clang/Frontend/FrontendDiagnostic.h"
23#include "clang/Lex/HeaderSearchOptions.h"
24#include "clang/Lex/Preprocessor.h"
25#include "clang/Sema/Sema.h"
26#include "clang/Serialization/ASTReader.h"
28#include "llvm/ADT/Hashing.h"
29#include "llvm/Bitstream/BitstreamWriter.h"
30#include "llvm/Support/FileSystem.h"
31#include "llvm/Support/MemoryBuffer.h"
32#include "llvm/Support/Path.h"
33#include "llvm/Support/raw_ostream.h"
55 const clang::LangOptions &
Opts =
SemaRef.getLangOpts();
56 const clang::Preprocessor &
PP =
SemaRef.getPreprocessor();
58 llvm::StringRef
CachePath =
PP.getHeaderSearchInfo().getHeaderSearchOpts().ModuleCachePath;
60 const std::string
RdictsEnd =
"_rdict.pcm";
63 using namespace clang;
64 using namespace clang::serialization;
66 auto Abv = std::make_shared<BitCodeAbbrev>();
69 auto Abbrev = Stream.EmitAbbrev(std::move(
Abv));
70 auto Abv1 = std::make_shared<BitCodeAbbrev>();
79 if (llvm::sys::fs::is_directory(
FilePath))
85 Stream.EmitRecordWithBlob(
Abbrev, Record, FileName);
88 std::ifstream fp(
FilePath.str(), std::ios::binary);
89 std::ostringstream os;
95 assert(!
EC &&
"Unable to close _rdict file");
103 clang::serialization::ModuleFile &Mod,
104 const llvm::BitstreamCursor &
InStream)
108 llvm::SmallVector<uint64_t, 4> Record;
111 llvm::BitstreamEntry Entry = llvm::cantFail(
Stream.advanceSkippingSubblocks());
112 switch (Entry.Kind) {
113 case llvm::BitstreamEntry::SubBlock:
114 case llvm::BitstreamEntry::EndBlock:
115 case llvm::BitstreamEntry::Error:
return;
117 case llvm::BitstreamEntry::Record:
break;
121 llvm::StringRef
Blob;
123 using namespace clang::serialization;
160std::unique_ptr<clang::ModuleFileExtensionWriter>
163 return std::unique_ptr<clang::ModuleFileExtensionWriter>(
new Writer(
this));
166std::unique_ptr<clang::ModuleFileExtensionReader>
168 clang::ASTReader &
Reader, clang::serialization::ModuleFile &Mod,
169 const llvm::BitstreamCursor &Stream)
171 return std::unique_ptr<clang::ModuleFileExtensionReader>(
constexpr uint16_t ROOT_CLING_RDICT_VERSION_MINOR
Rdict module extension minor version number.
const std::string ROOT_CLING_RDICT_BLOCK_NAME
Rdict module extension block name.
constexpr uint16_t ROOT_CLING_RDICT_VERSION_MAJOR
Rdict module extension major version number.
The file contains facilities to work with C++ module files extensions used to store rdict files.
void TCling__RegisterRdictForLoadPCM(const std::string &pcmFileNameFullPath, llvm::StringRef *pcmContent)
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
llvm::BitstreamCursor Stream
Reader(clang::ModuleFileExtension *Ext, clang::ASTReader &Reader, clang::serialization::ModuleFile &Mod, const llvm::BitstreamCursor &InStream)
void writeExtensionContents(clang::Sema &SemaRef, llvm::BitstreamWriter &Stream) override
std::unique_ptr< clang::ModuleFileExtensionReader > createExtensionReader(const clang::ModuleFileExtensionMetadata &Metadata, clang::ASTReader &Reader, clang::serialization::ModuleFile &Mod, const llvm::BitstreamCursor &Stream) override
clang::ModuleFileExtensionMetadata getExtensionMetadata() const override
std::unique_ptr< clang::ModuleFileExtensionWriter > createExtensionWriter(clang::ASTWriter &Writer) override
~TClingRdictModuleFileExtension() override
void hashExtension(ExtensionHashBuilder &HBuilder) const override