slang_rs.h revision c383a500aa59423264811be3874461bf8adbfea0
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_SLANG_RS_HPP
18#define _SLANG_COMPILER_SLANG_RS_HPP
19
20#include "slang.h"
21
22namespace slang {
23  class RSContext;
24
25class SlangRS : public Slang {
26 private:
27  // Context for RenderScript
28  RSContext *mRSContext;
29
30  bool mAllowRSPrefix;
31
32 protected:
33  virtual void initDiagnostic();
34  virtual void initPreprocessor();
35  virtual void initASTContext();
36
37  virtual clang::ASTConsumer
38  *createBackend(const clang::CodeGenOptions& CodeGenOpts,
39                 llvm::raw_ostream *OS,
40                 Slang::OutputType OT);
41
42
43 public:
44  static bool IsRSHeaderFile(const char *File);
45
46  SlangRS(const std::string &Triple, const std::string &CPU,
47          const std::vector<std::string> &Features);
48
49  // The package name that's really applied will be filled in RealPackageName.
50  bool reflectToJava(const std::string &OutputPathBase,
51                     const std::string &OutputPackageName,
52                     std::string *RealPackageName);
53
54  virtual void reset();
55
56  inline void allowRSPrefix(bool V = true) { mAllowRSPrefix = V; }
57
58  virtual ~SlangRS();
59};
60}
61
62#endif  // _SLANG_COMPILER_SLANG_RS_HPP
63