slang_rs_export_var.h revision c383a500aa59423264811be3874461bf8adbfea0
1c383a500aa59423264811be3874461bf8adbfea0Zonr Chang/* 2c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * Copyright 2010, The Android Open Source Project 3c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * 4c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * Licensed under the Apache License, Version 2.0 (the "License"); 5c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * you may not use this file except in compliance with the License. 6c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * You may obtain a copy of the License at 7c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * 8c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * http://www.apache.org/licenses/LICENSE-2.0 9c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * 10c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * Unless required by applicable law or agreed to in writing, software 11c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * distributed under the License is distributed on an "AS IS" BASIS, 12c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * See the License for the specific language governing permissions and 14c383a500aa59423264811be3874461bf8adbfea0Zonr Chang * limitations under the License. 15c383a500aa59423264811be3874461bf8adbfea0Zonr Chang */ 16c383a500aa59423264811be3874461bf8adbfea0Zonr Chang 176315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr#ifndef _SLANG_COMPILER_RS_EXPORT_VAR_H 186315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr#define _SLANG_COMPILER_RS_EXPORT_VAR_H 19462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao 20a41ce1d98094da84643995d40d71c529905123fcZonr Chang#include <string> 21a41ce1d98094da84643995d40d71c529905123fcZonr Chang 229ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao#include "llvm/ADT/StringRef.h" 23462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao 249ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao#include "clang/AST/Decl.h" 259ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao#include "clang/AST/Expr.h" 26462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao 27a41ce1d98094da84643995d40d71c529905123fcZonr Chang#include "slang_rs_exportable.h" 28462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao 29324c0479ec3edda573de60b2e6476507a99d06f7Shih-wei Liaonamespace clang { 306315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr class APValue; 31324c0479ec3edda573de60b2e6476507a99d06f7Shih-wei Liao} 32324c0479ec3edda573de60b2e6476507a99d06f7Shih-wei Liao 33462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liaonamespace slang { 346315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr class RSContext; 356315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr class RSExportType; 36462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao 37a41ce1d98094da84643995d40d71c529905123fcZonr Changclass RSExportVar : public RSExportable { 389ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao friend class RSContext; 399ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao private: 409ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao RSContext *mContext; 419ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao std::string mName; 429ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao const RSExportType *mET; 439ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao bool mIsConst; 44462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao 459ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao clang::Expr::EvalResult mInit; 46324c0479ec3edda573de60b2e6476507a99d06f7Shih-wei Liao 479ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao RSExportVar(RSContext *Context, 489ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao const clang::VarDecl *VD, 499ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao const RSExportType *ET); 50462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao 519ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao public: 529ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao inline const std::string &getName() const { return mName; } 539ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao inline const RSExportType *getType() const { return mET; } 549ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao inline RSContext *getRSContext() const { return mContext; } 559ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao inline bool isConst() const { return mIsConst; } 56462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao 579ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao inline const clang::APValue &getInit() const { return mInit.Val; } 589ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao}; // RSExportVar 59462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao 609ef2f785e0cc490af678dfd685995dec787321ffShih-wei Liao} // namespace slang 61462aefd62cc646d2ff753c1d003ef3cd7bbea26Shih-wei Liao 626315f76e3cc6ff2d012d1183a0b030d4ff0dc808zonr#endif // _SLANG_COMPILER_RS_EXPORT_VAR_H 63