blob: 1eb0c46e021970d4c91b5dbaf21209dd110b3dfe [file] [log] [blame]
Zonr Changc383a502010-10-12 01:52:08 +08001/*
Stephen Hines0a813a32012-08-03 16:52:40 -07002 * Copyright 2010-2012, The Android Open Source Project
Zonr Changc383a502010-10-12 01:52:08 +08003 *
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
Zonr Chang3a9ca1f2010-10-06 17:52:56 +080017#include "slang_rs.h"
18
Shih-wei Liaob81c6a42010-10-10 14:15:00 -070019#include <cstring>
Stephen Hinese639eb52010-11-08 19:27:20 -080020#include <list>
Stephen Hines2e35b132011-07-22 02:50:19 -070021#include <sstream>
Stephen Hinese639eb52010-11-08 19:27:20 -080022#include <string>
23#include <utility>
24#include <vector>
Stephen Hinesfcda2352010-10-19 16:49:32 -070025
Loganbe274822011-02-16 22:02:54 +080026#include "clang/Basic/SourceLocation.h"
27
Zonr Changcf6af6a2010-10-12 12:38:51 +080028#include "clang/Frontend/FrontendDiagnostic.h"
29
Zonr Chang3a9ca1f2010-10-06 17:52:56 +080030#include "clang/Sema/SemaDiagnostic.h"
31
Loganbe274822011-02-16 22:02:54 +080032#include "llvm/Support/Path.h"
Stephen Hinese639eb52010-11-08 19:27:20 -080033
Raphael8d5a2f62011-02-08 00:15:05 -080034#include "os_sep.h"
Zonr Chang3a9ca1f2010-10-06 17:52:56 +080035#include "slang_rs_backend.h"
36#include "slang_rs_context.h"
Zonr Chang641558f2010-10-12 21:07:06 +080037#include "slang_rs_export_type.h"
Zonr Chang3a9ca1f2010-10-06 17:52:56 +080038
Jason Sams1b6a0882012-03-12 15:07:58 -070039#include "slang_rs_reflection_cpp.h"
40
Stephen Hinese639eb52010-11-08 19:27:20 -080041namespace slang {
Zonr Chang3a9ca1f2010-10-06 17:52:56 +080042
Stephen Hines11274a72012-09-26 19:14:20 -070043#define FS_SUFFIX "fs"
44
Zonr Chang3c250c52010-10-07 12:19:23 +080045#define RS_HEADER_SUFFIX "rsh"
46
Stephen Hines2d35edd2011-08-09 11:33:27 -070047/* RS_HEADER_ENTRY(name) */
Zonr Chang3c250c52010-10-07 12:19:23 +080048#define ENUM_RS_HEADER() \
Stephen Hines2d35edd2011-08-09 11:33:27 -070049 RS_HEADER_ENTRY(rs_allocation) \
50 RS_HEADER_ENTRY(rs_atomic) \
51 RS_HEADER_ENTRY(rs_cl) \
52 RS_HEADER_ENTRY(rs_core) \
Stephen Hinesa7ab54d2014-01-08 09:41:49 -080053 RS_HEADER_ENTRY(rs_core_math) \
Stephen Hines2d35edd2011-08-09 11:33:27 -070054 RS_HEADER_ENTRY(rs_debug) \
Alex Sakhartchouk4eb4b382012-03-21 09:58:39 -070055 RS_HEADER_ENTRY(rs_element) \
Stephen Hines2d35edd2011-08-09 11:33:27 -070056 RS_HEADER_ENTRY(rs_graphics) \
57 RS_HEADER_ENTRY(rs_math) \
Alex Sakhartchouk4eb4b382012-03-21 09:58:39 -070058 RS_HEADER_ENTRY(rs_mesh) \
Stephen Hines2d35edd2011-08-09 11:33:27 -070059 RS_HEADER_ENTRY(rs_matrix) \
60 RS_HEADER_ENTRY(rs_object) \
Alex Sakhartchouk4eb4b382012-03-21 09:58:39 -070061 RS_HEADER_ENTRY(rs_program) \
Stephen Hines2d35edd2011-08-09 11:33:27 -070062 RS_HEADER_ENTRY(rs_quaternion) \
Alex Sakhartchouk4eb4b382012-03-21 09:58:39 -070063 RS_HEADER_ENTRY(rs_sampler) \
Stephen Hines2d35edd2011-08-09 11:33:27 -070064 RS_HEADER_ENTRY(rs_time) \
65 RS_HEADER_ENTRY(rs_types) \
66
Stephen Hines11274a72012-09-26 19:14:20 -070067// Returns true if \p Filename ends in ".fs".
68bool SlangRS::isFilterscript(const char *Filename) {
69 const char *c = strrchr(Filename, '.');
70 if (c && !strncmp(FS_SUFFIX, c + 1, strlen(FS_SUFFIX) + 1)) {
71 return true;
72 } else {
73 return false;
74 }
75}
Zonr Chang3c250c52010-10-07 12:19:23 +080076
Zonr Changcf6af6a2010-10-12 12:38:51 +080077bool SlangRS::reflectToJava(const std::string &OutputPathBase,
Stephen Hines44d495d2014-05-22 19:42:55 -070078 const std::string &RSPackageName,
79 bool EmbedBitcodeInJava) {
Zonr Changcf6af6a2010-10-12 12:38:51 +080080 return mRSContext->reflectToJava(OutputPathBase,
Stephen Hines0a813a32012-08-03 16:52:40 -070081 RSPackageName,
Zonr Changcf6af6a2010-10-12 12:38:51 +080082 getInputFileName(),
Stephen Hines44d495d2014-05-22 19:42:55 -070083 getOutputFileName(),
84 EmbedBitcodeInJava);
Zonr Changcf6af6a2010-10-12 12:38:51 +080085}
86
87bool SlangRS::generateBitcodeAccessor(const std::string &OutputPathBase,
88 const std::string &PackageName) {
89 RSSlangReflectUtils::BitCodeAccessorContext BCAccessorContext;
90
91 BCAccessorContext.rsFileName = getInputFileName().c_str();
92 BCAccessorContext.bcFileName = getOutputFileName().c_str();
93 BCAccessorContext.reflectPath = OutputPathBase.c_str();
94 BCAccessorContext.packageName = PackageName.c_str();
95 BCAccessorContext.bcStorage = BCST_JAVA_CODE; // Must be BCST_JAVA_CODE
96
97 return RSSlangReflectUtils::GenerateBitCodeAccessor(BCAccessorContext);
98}
99
Zonr Change86245a2010-10-12 21:42:13 +0800100bool SlangRS::checkODR(const char *CurInputFile) {
Zonr Chang641558f2010-10-12 21:07:06 +0800101 for (RSContext::ExportableList::iterator I = mRSContext->exportable_begin(),
102 E = mRSContext->exportable_end();
103 I != E;
104 I++) {
Stephen Hinesa858cb62011-01-17 12:17:51 -0800105 RSExportable *RSE = *I;
106 if (RSE->getKind() != RSExportable::EX_TYPE)
Zonr Chang641558f2010-10-12 21:07:06 +0800107 continue;
108
Stephen Hinesa858cb62011-01-17 12:17:51 -0800109 RSExportType *ET = static_cast<RSExportType *>(RSE);
Zonr Chang641558f2010-10-12 21:07:06 +0800110 if (ET->getClass() != RSExportType::ExportClassRecord)
111 continue;
112
113 RSExportRecordType *ERT = static_cast<RSExportRecordType *>(ET);
114
115 // Artificial record types (create by us not by user in the source) always
116 // conforms the ODR.
117 if (ERT->isArtificial())
118 continue;
119
120 // Key to lookup ERT in ReflectedDefinitions
121 llvm::StringRef RDKey(ERT->getName());
122 ReflectedDefinitionListTy::const_iterator RD =
123 ReflectedDefinitions.find(RDKey);
124
125 if (RD != ReflectedDefinitions.end()) {
126 const RSExportRecordType *Reflected = RD->getValue().first;
127 // There's a record (struct) with the same name reflected before. Enforce
128 // ODR checking - the Reflected must hold *exactly* the same "definition"
129 // as the one defined previously. We say two record types A and B have the
130 // same definition iff:
131 //
132 // struct A { struct B {
133 // Type(a1) a1, Type(b1) b1,
134 // Type(a2) a2, Type(b1) b2,
135 // ... ...
136 // Type(aN) aN Type(b3) b3,
137 // }; }
138 // Cond. #1. They have same number of fields, i.e., N = M;
139 // Cond. #2. for (i := 1 to N)
140 // Type(ai) = Type(bi) must hold;
141 // Cond. #3. for (i := 1 to N)
142 // Name(ai) = Name(bi) must hold;
143 //
144 // where,
145 // Type(F) = the type of field F and
146 // Name(F) = the field name.
147
148 bool PassODR = false;
149 // Cond. #1 and Cond. #2
150 if (Reflected->equals(ERT)) {
151 // Cond #3.
152 RSExportRecordType::const_field_iterator AI = Reflected->fields_begin(),
153 BI = ERT->fields_begin();
154
155 for (unsigned i = 0, e = Reflected->getFields().size(); i != e; i++) {
156 if ((*AI)->getName() != (*BI)->getName())
157 break;
158 AI++;
159 BI++;
160 }
161 PassODR = (AI == (Reflected->fields_end()));
162 }
163
164 if (!PassODR) {
165 getDiagnostics().Report(mDiagErrorODR) << Reflected->getName()
166 << getInputFileName()
167 << RD->getValue().second;
168 return false;
169 }
170 } else {
171 llvm::StringMapEntry<ReflectedDefinitionTy> *ME =
172 llvm::StringMapEntry<ReflectedDefinitionTy>::Create(RDKey.begin(),
173 RDKey.end());
Zonr Change86245a2010-10-12 21:42:13 +0800174 ME->setValue(std::make_pair(ERT, CurInputFile));
Zonr Chang641558f2010-10-12 21:07:06 +0800175
176 if (!ReflectedDefinitions.insert(ME))
177 delete ME;
178
179 // Take the ownership of ERT such that it won't be freed in ~RSContext().
180 ERT->keep();
181 }
Zonr Chang641558f2010-10-12 21:07:06 +0800182 }
183 return true;
184}
Zonr Changcf6af6a2010-10-12 12:38:51 +0800185
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800186void SlangRS::initDiagnostic() {
Logan Chien9207a2e2011-10-21 15:39:28 +0800187 clang::DiagnosticsEngine &DiagEngine = getDiagnostics();
Zonr Changcf6af6a2010-10-12 12:38:51 +0800188
Logan Chien9207a2e2011-10-21 15:39:28 +0800189 if (DiagEngine.setDiagnosticGroupMapping("implicit-function-declaration",
190 clang::diag::MAP_ERROR))
191 DiagEngine.Report(clang::diag::warn_unknown_warning_option)
192 << "implicit-function-declaration";
193
194 DiagEngine.setDiagnosticMapping(
195 clang::diag::ext_typecheck_convert_discards_qualifiers,
196 clang::diag::MAP_ERROR,
197 clang::SourceLocation());
Zonr Chang641558f2010-10-12 21:07:06 +0800198
199 mDiagErrorInvalidOutputDepParameter =
Logan Chien9207a2e2011-10-21 15:39:28 +0800200 DiagEngine.getCustomDiagID(
201 clang::DiagnosticsEngine::Error,
202 "invalid parameter for output dependencies files.");
Zonr Chang641558f2010-10-12 21:07:06 +0800203
204 mDiagErrorODR =
Logan Chien9207a2e2011-10-21 15:39:28 +0800205 DiagEngine.getCustomDiagID(
206 clang::DiagnosticsEngine::Error,
207 "type '%0' in different translation unit (%1 v.s. %2) "
208 "has incompatible type definition");
Zonr Chang641558f2010-10-12 21:07:06 +0800209
Logan Chien9207a2e2011-10-21 15:39:28 +0800210 mDiagErrorTargetAPIRange =
211 DiagEngine.getCustomDiagID(
212 clang::DiagnosticsEngine::Error,
Stephen Hines2e35b132011-07-22 02:50:19 -0700213 "target API level '%0' is out of range ('%1' - '%2')");
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800214}
215
216void SlangRS::initPreprocessor() {
217 clang::Preprocessor &PP = getPreprocessor();
218
Stephen Hines2e35b132011-07-22 02:50:19 -0700219 std::stringstream RSH;
Jean-Luc Brouillet29689212014-05-27 13:25:31 -0700220 RSH << "#define RS_VERSION " << mTargetAPI << "\n";
221 RSH << "#include \"rs_core." RS_HEADER_SUFFIX "\"\n";
Stephen Hines2e35b132011-07-22 02:50:19 -0700222 PP.setPredefines(RSH.str());
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800223}
224
225void SlangRS::initASTContext() {
Stephen Hines9e5b5032010-11-03 13:19:14 -0700226 mRSContext = new RSContext(getPreprocessor(),
227 getASTContext(),
Stephen Hines3fd0a942011-01-18 12:27:39 -0800228 getTargetInfo(),
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800229 &mPragmas,
Stephen Hines4a4bf922011-08-18 17:20:33 -0700230 mTargetAPI,
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800231 &mGeneratedFileNames);
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800232}
233
234clang::ASTConsumer
235*SlangRS::createBackend(const clang::CodeGenOptions& CodeGenOpts,
236 llvm::raw_ostream *OS,
237 Slang::OutputType OT) {
238 return new RSBackend(mRSContext,
Stephen Hinese639eb52010-11-08 19:27:20 -0800239 &getDiagnostics(),
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800240 CodeGenOpts,
241 getTargetOptions(),
Stephen Hines3fd0a942011-01-18 12:27:39 -0800242 &mPragmas,
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800243 OS,
244 OT,
245 getSourceManager(),
Stephen Hines11274a72012-09-26 19:14:20 -0700246 mAllowRSPrefix,
247 mIsFilterscript);
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800248}
249
Zonr Chang592a9542010-10-07 20:03:58 +0800250bool SlangRS::IsRSHeaderFile(const char *File) {
Stephen Hines2d35edd2011-08-09 11:33:27 -0700251#define RS_HEADER_ENTRY(name) \
Tim Murrayee4016d2014-04-10 15:49:08 -0700252 if (::strcmp(File, #name "." RS_HEADER_SUFFIX) == 0) \
Zonr Chang592a9542010-10-07 20:03:58 +0800253 return true;
254ENUM_RS_HEADER()
255#undef RS_HEADER_ENTRY
Zonr Chang592a9542010-10-07 20:03:58 +0800256 return false;
257}
258
Stephen Hines11274a72012-09-26 19:14:20 -0700259bool SlangRS::IsLocInRSHeaderFile(const clang::SourceLocation &Loc,
260 const clang::SourceManager &SourceMgr) {
261 clang::FullSourceLoc FSL(Loc, SourceMgr);
Stephen Hinesfcda2352010-10-19 16:49:32 -0700262 clang::PresumedLoc PLoc = SourceMgr.getPresumedLoc(FSL);
Stephen Hinesfcda2352010-10-19 16:49:32 -0700263
Stephen Hines688e64b2011-08-23 16:01:25 -0700264 const char *Filename = PLoc.getFilename();
265 if (!Filename) {
266 return false;
267 } else {
268 return IsRSHeaderFile(llvm::sys::path::filename(Filename).data());
269 }
Stephen Hinesfcda2352010-10-19 16:49:32 -0700270}
271
Logan Chien9207a2e2011-10-21 15:39:28 +0800272SlangRS::SlangRS()
Stephen Hines11274a72012-09-26 19:14:20 -0700273 : Slang(), mRSContext(NULL), mAllowRSPrefix(false), mTargetAPI(0),
274 mIsFilterscript(false) {
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800275}
276
Zonr Changcf6af6a2010-10-12 12:38:51 +0800277bool SlangRS::compile(
278 const std::list<std::pair<const char*, const char*> > &IOFiles,
279 const std::list<std::pair<const char*, const char*> > &DepFiles,
280 const std::vector<std::string> &IncludePaths,
281 const std::vector<std::string> &AdditionalDepTargets,
282 Slang::OutputType OutputType, BitCodeStorageType BitcodeStorage,
283 bool AllowRSPrefix, bool OutputDep,
mkopec1c460b372012-01-09 11:21:50 -0500284 unsigned int TargetAPI, bool EmitDebug,
285 llvm::CodeGenOpt::Level OptimizationLevel,
Zonr Changcf6af6a2010-10-12 12:38:51 +0800286 const std::string &JavaReflectionPathBase,
Stephen Hines0a813a32012-08-03 16:52:40 -0700287 const std::string &JavaReflectionPackageName,
288 const std::string &RSPackageName) {
Zonr Changcf6af6a2010-10-12 12:38:51 +0800289 if (IOFiles.empty())
290 return true;
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800291
Zonr Changcf6af6a2010-10-12 12:38:51 +0800292 if (OutputDep && (DepFiles.size() != IOFiles.size())) {
Zonr Chang641558f2010-10-12 21:07:06 +0800293 getDiagnostics().Report(mDiagErrorInvalidOutputDepParameter);
Zonr Changcf6af6a2010-10-12 12:38:51 +0800294 return false;
295 }
296
297 std::string RealPackageName;
298
299 const char *InputFile, *OutputFile, *BCOutputFile, *DepOutputFile;
300 std::list<std::pair<const char*, const char*> >::const_iterator
301 IOFileIter = IOFiles.begin(), DepFileIter = DepFiles.begin();
302
303 setIncludePaths(IncludePaths);
304 setOutputType(OutputType);
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800305 if (OutputDep) {
Zonr Changcf6af6a2010-10-12 12:38:51 +0800306 setAdditionalDepTargets(AdditionalDepTargets);
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800307 }
Zonr Changcf6af6a2010-10-12 12:38:51 +0800308
mkopec1c460b372012-01-09 11:21:50 -0500309 setDebugMetadataEmission(EmitDebug);
310
311 setOptimizationLevel(OptimizationLevel);
312
Zonr Changcf6af6a2010-10-12 12:38:51 +0800313 mAllowRSPrefix = AllowRSPrefix;
314
Stephen Hines2e35b132011-07-22 02:50:19 -0700315 mTargetAPI = TargetAPI;
Stephen Hines4cc499d2011-08-24 19:06:17 -0700316 if (mTargetAPI < SLANG_MINIMUM_TARGET_API ||
317 mTargetAPI > SLANG_MAXIMUM_TARGET_API) {
Stephen Hines2e35b132011-07-22 02:50:19 -0700318 getDiagnostics().Report(mDiagErrorTargetAPIRange) << mTargetAPI
Stephen Hines4cc499d2011-08-24 19:06:17 -0700319 << SLANG_MINIMUM_TARGET_API << SLANG_MAXIMUM_TARGET_API;
Stephen Hines2e35b132011-07-22 02:50:19 -0700320 return false;
321 }
322
Stephen Hinesc632be22011-09-23 15:53:16 -0700323 // Skip generation of warnings a second time if we are doing more than just
324 // a single pass over the input file.
325 bool SuppressAllWarnings = (OutputType != Slang::OT_Dependency);
326
Zonr Changcf6af6a2010-10-12 12:38:51 +0800327 for (unsigned i = 0, e = IOFiles.size(); i != e; i++) {
328 InputFile = IOFileIter->first;
329 OutputFile = IOFileIter->second;
330
331 reset();
332
333 if (!setInputSource(InputFile))
334 return false;
335
336 if (!setOutput(OutputFile))
337 return false;
338
Stephen Hines11274a72012-09-26 19:14:20 -0700339 mIsFilterscript = isFilterscript(InputFile);
340
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800341 if (Slang::compile() > 0)
342 return false;
343
Stephen Hines925879f2013-07-19 18:19:04 -0700344 if (!JavaReflectionPackageName.empty()) {
345 mRSContext->setReflectJavaPackageName(JavaReflectionPackageName);
346 }
347 const std::string &RealPackageName =
348 mRSContext->getReflectJavaPackageName();
349
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800350 if (OutputType != Slang::OT_Dependency) {
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800351
Stephen Hines5c25c512012-02-27 12:58:17 -0800352 if (BitcodeStorage == BCST_CPP_CODE) {
Jason Sams1b6a0882012-03-12 15:07:58 -0700353 RSReflectionCpp R(mRSContext);
354 bool ret = R.reflect(JavaReflectionPathBase, getInputFileName(), getOutputFileName());
355 if (!ret) {
356 return false;
357 }
Stephen Hines5c25c512012-02-27 12:58:17 -0800358 } else {
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800359
Stephen Hines44d495d2014-05-22 19:42:55 -0700360 if (!reflectToJava(JavaReflectionPathBase, RSPackageName, (BitcodeStorage == BCST_JAVA_CODE))) {
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800361 return false;
Stephen Hines5c25c512012-02-27 12:58:17 -0800362 }
363
364 for (std::vector<std::string>::const_iterator
365 I = mGeneratedFileNames.begin(), E = mGeneratedFileNames.end();
366 I != E;
367 I++) {
368 std::string ReflectedName = RSSlangReflectUtils::ComputePackagedPath(
369 JavaReflectionPathBase.c_str(),
370 (RealPackageName + OS_PATH_SEPARATOR_STR + *I).c_str());
371 appendGeneratedFileName(ReflectedName + ".java");
372 }
373
374 if ((OutputType == Slang::OT_Bitcode) &&
375 (BitcodeStorage == BCST_JAVA_CODE) &&
376 !generateBitcodeAccessor(JavaReflectionPathBase,
377 RealPackageName.c_str())) {
378 return false;
379 }
380 }
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800381 }
382
Zonr Changcf6af6a2010-10-12 12:38:51 +0800383 if (OutputDep) {
384 BCOutputFile = DepFileIter->first;
385 DepOutputFile = DepFileIter->second;
386
387 setDepTargetBC(BCOutputFile);
388
389 if (!setDepOutput(DepOutputFile))
390 return false;
391
Stephen Hinesc632be22011-09-23 15:53:16 -0700392 if (SuppressAllWarnings) {
393 getDiagnostics().setSuppressAllDiagnostics(true);
394 }
Zonr Changcf6af6a2010-10-12 12:38:51 +0800395 if (generateDepFile() > 0)
396 return false;
Stephen Hinesc632be22011-09-23 15:53:16 -0700397 if (SuppressAllWarnings) {
398 getDiagnostics().setSuppressAllDiagnostics(false);
399 }
Zonr Changcf6af6a2010-10-12 12:38:51 +0800400
401 DepFileIter++;
402 }
403
Zonr Change86245a2010-10-12 21:42:13 +0800404 if (!checkODR(InputFile))
Zonr Chang641558f2010-10-12 21:07:06 +0800405 return false;
406
Zonr Changcf6af6a2010-10-12 12:38:51 +0800407 IOFileIter++;
408 }
409
410 return true;
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800411}
412
Zonr Chang641558f2010-10-12 21:07:06 +0800413void SlangRS::reset() {
414 delete mRSContext;
415 mRSContext = NULL;
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800416 mGeneratedFileNames.clear();
Zonr Chang641558f2010-10-12 21:07:06 +0800417 Slang::reset();
Zonr Chang641558f2010-10-12 21:07:06 +0800418}
419
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800420SlangRS::~SlangRS() {
421 delete mRSContext;
Zonr Chang641558f2010-10-12 21:07:06 +0800422 for (ReflectedDefinitionListTy::iterator I = ReflectedDefinitions.begin(),
423 E = ReflectedDefinitions.end();
424 I != E;
425 I++) {
426 delete I->getValue().first;
427 }
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800428}
Stephen Hinese639eb52010-11-08 19:27:20 -0800429
430} // namespace slang