clang 8.0.0

TestModuleFileExtension.h
Go to the documentation of this file.
1 //===-- TestModuleFileExtension.h - Module Extension Tester -----*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 #ifndef LLVM_CLANG_FRONTEND_TESTMODULEFILEEXTENSION_H
10 #define LLVM_CLANG_FRONTEND_TESTMODULEFILEEXTENSION_H
11
12 #include "clang/Serialization/ModuleFileExtension.h"
13 #include "clang/Basic/LLVM.h"
14 #include "llvm/ADT/StringRef.h"
15 #include "llvm/Bitcode/BitstreamReader.h"
16 #include <string>
17
18 namespace clang {
19
20 /// A module file extension used for testing purposes.
21 class TestModuleFileExtension : public ModuleFileExtension {
22 std::string BlockName;
23 unsigned MajorVersion;
24 unsigned MinorVersion;
25 bool Hashed;
26 std::string UserInfo;
27
28 class Writer : public ModuleFileExtensionWriter {
29 public:
30 Writer(ModuleFileExtension *Ext) : ModuleFileExtensionWriter(Ext) { }
31 ~Writer() override;
32
33 void writeExtensionContents(Sema &SemaRef,
34 llvm::BitstreamWriter &Stream) override;
35 };
36
37 class Reader : public ModuleFileExtensionReader {
38 llvm::BitstreamCursor Stream;
39
40 public:
41 ~Reader() override;
42
43 Reader(ModuleFileExtension *Ext, const llvm::BitstreamCursor &InStream);
44 };
45
46 public:
47 TestModuleFileExtension(StringRef BlockName,
48 unsigned MajorVersion,
49 unsigned MinorVersion,
50 bool Hashed,
51 StringRef UserInfo)
52 : BlockName(BlockName),
53 MajorVersion(MajorVersion), MinorVersion(MinorVersion),
54 Hashed(Hashed), UserInfo(UserInfo) { }
55 ~TestModuleFileExtension() override;
56
57 ModuleFileExtensionMetadata getExtensionMetadata() const override;
58
59 llvm::hash_code hashExtension(llvm::hash_code Code) const override;
60
61 std::unique_ptr<ModuleFileExtensionWriter>
62 createExtensionWriter(ASTWriter &Writer) override;
63
64 std::unique_ptr<ModuleFileExtensionReader>
65 createExtensionReader(const ModuleFileExtensionMetadata &Metadata,
66 ASTReader &Reader, serialization::ModuleFile &Mod,
67 const llvm::BitstreamCursor &Stream) override;
68 };
69
70 } // end namespace clang
71
72 #endif // LLVM_CLANG_FRONTEND_TESTMODULEFILEEXTENSION_H
ModuleFileExtension.h
clang::TestModuleFileExtension::createExtensionWriter
std::unique_ptr< ModuleFileExtensionWriter > createExtensionWriter(ASTWriter &Writer) override
Create a new module file extension writer, which will be responsible for writing the extension conten...
Definition: TestModuleFileExtension.cpp:99
clang::TestModuleFileExtension
A module file extension used for testing purposes.
Definition: TestModuleFileExtension.h:21
LLVM.h
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
clang::TestModuleFileExtension::TestModuleFileExtension
TestModuleFileExtension(StringRef BlockName, unsigned MajorVersion, unsigned MinorVersion, bool Hashed, StringRef UserInfo)
Definition: TestModuleFileExtension.h:47
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:278
clang::TestModuleFileExtension::~TestModuleFileExtension
~TestModuleFileExtension() override
Definition: TestModuleFileExtension.cpp:79
clang::ModuleFileExtensionReader
Abstract base class that reads a module file extension block from a module file.
Definition: ModuleFileExtension.h:132
clang::TestModuleFileExtension::createExtensionReader
std::unique_ptr< ModuleFileExtensionReader > createExtensionReader(const ModuleFileExtensionMetadata &Metadata, ASTReader &Reader, serialization::ModuleFile &Mod, const llvm::BitstreamCursor &Stream) override
Create a new module file extension reader, given the metadata read from the block and the cursor into...
Definition: TestModuleFileExtension.cpp:104
clang::TestModuleFileExtension::hashExtension
llvm::hash_code hashExtension(llvm::hash_code Code) const override
Hash information about the presence of this extension into the module hash code.
Definition: TestModuleFileExtension.cpp:86
clang::TestModuleFileExtension::getExtensionMetadata
ModuleFileExtensionMetadata getExtensionMetadata() const override
Retrieves the metadata for this module file extension.
Definition: TestModuleFileExtension.cpp:82
clang::serialization::ModuleFile
Information about a module that has been loaded by the ASTReader.
Definition: Module.h:108
clang::ModuleFileExtensionWriter
Abstract base class that writes a module file extension block into a module file. ...
Definition: ModuleFileExtension.h:105
clang
Dataflow Directional Tag Classes.
Definition: CFGReachabilityAnalysis.h:22
clang::ASTReader
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:355
clang::ModuleFileExtensionMetadata
Metadata for a module file extension.
Definition: ModuleFileExtension.h:35
clang::ASTWriter
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:104
clang::ModuleFileExtension
An abstract superclass that describes a custom extension to the module/precompiled header file format...
Definition: ModuleFileExtension.h:63