blob: 1f7eefcef6174b457e8df608ac8a31419f983641 [file] [log] [blame]
Zonr Changc383a502010-10-12 01:52:08 +08001/*
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
zonr6315f762010-10-05 15:35:14 +080017#ifndef _SLANG_COMPILER_RS_EXPORT_VAR_H
18#define _SLANG_COMPILER_RS_EXPORT_VAR_H
Shih-wei Liao462aefd2010-06-04 15:32:04 -070019
Zonr Changa41ce1d2010-10-06 02:23:12 +080020#include <string>
21
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070022#include "llvm/ADT/StringRef.h"
Shih-wei Liao462aefd2010-06-04 15:32:04 -070023
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070024#include "clang/AST/Decl.h"
25#include "clang/AST/Expr.h"
Shih-wei Liao462aefd2010-06-04 15:32:04 -070026
Zonr Changa41ce1d2010-10-06 02:23:12 +080027#include "slang_rs_exportable.h"
Shih-wei Liao462aefd2010-06-04 15:32:04 -070028
Shih-wei Liao324c0472010-06-21 13:15:11 -070029namespace clang {
zonr6315f762010-10-05 15:35:14 +080030 class APValue;
Shih-wei Liao324c0472010-06-21 13:15:11 -070031}
32
Shih-wei Liao462aefd2010-06-04 15:32:04 -070033namespace slang {
zonr6315f762010-10-05 15:35:14 +080034 class RSContext;
35 class RSExportType;
Shih-wei Liao462aefd2010-06-04 15:32:04 -070036
Zonr Changa41ce1d2010-10-06 02:23:12 +080037class RSExportVar : public RSExportable {
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070038 friend class RSContext;
39 private:
40 RSContext *mContext;
41 std::string mName;
42 const RSExportType *mET;
43 bool mIsConst;
Shih-wei Liao462aefd2010-06-04 15:32:04 -070044
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070045 clang::Expr::EvalResult mInit;
Shih-wei Liao324c0472010-06-21 13:15:11 -070046
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070047 RSExportVar(RSContext *Context,
48 const clang::VarDecl *VD,
49 const RSExportType *ET);
Shih-wei Liao462aefd2010-06-04 15:32:04 -070050
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070051 public:
52 inline const std::string &getName() const { return mName; }
53 inline const RSExportType *getType() const { return mET; }
54 inline RSContext *getRSContext() const { return mContext; }
55 inline bool isConst() const { return mIsConst; }
Shih-wei Liao462aefd2010-06-04 15:32:04 -070056
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070057 inline const clang::APValue &getInit() const { return mInit.Val; }
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070058}; // RSExportVar
Shih-wei Liao462aefd2010-06-04 15:32:04 -070059
Shih-wei Liao9ef2f782010-10-01 12:31:37 -070060} // namespace slang
Shih-wei Liao462aefd2010-06-04 15:32:04 -070061
zonr6315f762010-10-05 15:35:14 +080062#endif // _SLANG_COMPILER_RS_EXPORT_VAR_H