clang  6.0.0svn
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 
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.
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 
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>
67  const llvm::BitstreamCursor &Stream) override;
68 };
69 
70 } // end namespace clang
71 
72 #endif // LLVM_CLANG_FRONTEND_TESTMODULEFILEEXTENSION_H
std::unique_ptr< ModuleFileExtensionWriter > createExtensionWriter(ASTWriter &Writer) override
Create a new module file extension writer, which will be responsible for writing the extension conten...
A module file extension used for testing purposes.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
TestModuleFileExtension(StringRef BlockName, unsigned MajorVersion, unsigned MinorVersion, bool Hashed, StringRef UserInfo)
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:274
Abstract base class that reads a module file extension block from a module file.
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...
llvm::hash_code hashExtension(llvm::hash_code Code) const override
Hash information about the presence of this extension into the module hash code.
ModuleFileExtensionMetadata getExtensionMetadata() const override
Retrieves the metadata for this module file extension.
Information about a module that has been loaded by the ASTReader.
Definition: Module.h:100
Abstract base class that writes a module file extension block into a module file. ...
Dataflow Directional Tag Classes.
Reads an AST files chain containing the contents of a translation unit.
Definition: ASTReader.h:358
Metadata for a module file extension.
Writes an AST file containing the contents of a translation unit.
Definition: ASTWriter.h:104
An abstract superclass that describes a custom extension to the module/precompiled header file format...