[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / lib / Frontend / TestModuleFileExtension.h
blobe22c87ed2d1b588fa058ebdc5879e856dabab34d
1 //===-- TestModuleFileExtension.h - Module Extension Tester -----*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 #ifndef LLVM_CLANG_FRONTEND_TESTMODULEFILEEXTENSION_H
9 #define LLVM_CLANG_FRONTEND_TESTMODULEFILEEXTENSION_H
11 #include "clang/Serialization/ModuleFileExtension.h"
12 #include "clang/Basic/LLVM.h"
13 #include "llvm/ADT/StringRef.h"
14 #include "llvm/Bitstream/BitstreamReader.h"
15 #include <string>
17 namespace clang {
19 /// A module file extension used for testing purposes.
20 class TestModuleFileExtension
21 : public llvm::RTTIExtends<TestModuleFileExtension, ModuleFileExtension> {
22 std::string BlockName;
23 unsigned MajorVersion;
24 unsigned MinorVersion;
25 bool Hashed;
26 std::string UserInfo;
28 class Writer : public ModuleFileExtensionWriter {
29 public:
30 Writer(ModuleFileExtension *Ext) : ModuleFileExtensionWriter(Ext) { }
31 ~Writer() override;
33 void writeExtensionContents(Sema &SemaRef,
34 llvm::BitstreamWriter &Stream) override;
37 class Reader : public ModuleFileExtensionReader {
38 llvm::BitstreamCursor Stream;
40 public:
41 ~Reader() override;
43 Reader(ModuleFileExtension *Ext, const llvm::BitstreamCursor &InStream);
46 public:
47 static char ID;
49 TestModuleFileExtension(StringRef BlockName, unsigned MajorVersion,
50 unsigned MinorVersion, bool Hashed,
51 StringRef UserInfo)
52 : BlockName(BlockName), MajorVersion(MajorVersion),
53 MinorVersion(MinorVersion), Hashed(Hashed), UserInfo(UserInfo) {}
54 ~TestModuleFileExtension() override;
56 ModuleFileExtensionMetadata getExtensionMetadata() const override;
58 void hashExtension(ExtensionHashBuilder &HBuilder) const override;
60 std::unique_ptr<ModuleFileExtensionWriter>
61 createExtensionWriter(ASTWriter &Writer) override;
63 std::unique_ptr<ModuleFileExtensionReader>
64 createExtensionReader(const ModuleFileExtensionMetadata &Metadata,
65 ASTReader &Reader, serialization::ModuleFile &Mod,
66 const llvm::BitstreamCursor &Stream) override;
68 std::string str() const;
71 } // end namespace clang
73 #endif // LLVM_CLANG_FRONTEND_TESTMODULEFILEEXTENSION_H