slang_rs_backend.h revision fcda2352b9e140529f8f3c89f05b10a70c0048b2
1/*
2 * Copyright 2010, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *     http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _SLANG_COMPILER_RS_BACKEND_H
18#define _SLANG_COMPILER_RENDER_SCRIPT_BACKEND_H
19
20#include "slang_backend.h"
21#include "slang_pragma_recorder.h"
22
23namespace llvm {
24  class NamedMDNode;
25}
26
27namespace clang {
28  class ASTConsumer;
29  class Diagnostic;
30  class TargetOptions;
31  class PragmaList;
32  class CodeGenerator;
33  class ASTContext;
34  class DeclGroupRef;
35}
36
37namespace slang {
38
39class RSContext;
40
41class RSBackend : public Backend {
42 private:
43  RSContext *mContext;
44
45  clang::SourceManager &mSourceMgr;
46
47  bool mAllowRSPrefix;
48
49  llvm::NamedMDNode *mExportVarMetadata;
50  llvm::NamedMDNode *mExportFuncMetadata;
51  llvm::NamedMDNode *mExportTypeMetadata;
52  llvm::NamedMDNode *mExportElementMetadata;
53
54 protected:
55  virtual void HandleTopLevelDecl(clang::DeclGroupRef D);
56
57  virtual void HandleTranslationUnitPre(clang::ASTContext& C);
58
59  virtual void HandleTranslationUnitPost(llvm::Module *M);
60
61 public:
62  RSBackend(RSContext *Context,
63            clang::Diagnostic &Diags,
64            const clang::CodeGenOptions &CodeGenOpts,
65            const clang::TargetOptions &TargetOpts,
66            const PragmaList &Pragmas,
67            llvm::raw_ostream *OS,
68            Slang::OutputType OT,
69            clang::SourceManager &SourceMgr,
70            bool AllowRSPrefix);
71
72  virtual ~RSBackend();
73};
74}
75
76#endif  // _SLANG_COMPILER_BACKEND_H
77