blob: 47324bf3d00f2daacdc418b0593dabb1101143f3 [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 Hines925879f2013-07-19 18:19:04 -070078 const std::string &RSPackageName) {
Zonr Changcf6af6a2010-10-12 12:38:51 +080079 return mRSContext->reflectToJava(OutputPathBase,
Stephen Hines0a813a32012-08-03 16:52:40 -070080 RSPackageName,
Zonr Changcf6af6a2010-10-12 12:38:51 +080081 getInputFileName(),
Stephen Hines925879f2013-07-19 18:19:04 -070082 getOutputFileName());
Zonr Changcf6af6a2010-10-12 12:38:51 +080083}
84
85bool SlangRS::generateBitcodeAccessor(const std::string &OutputPathBase,
86 const std::string &PackageName) {
87 RSSlangReflectUtils::BitCodeAccessorContext BCAccessorContext;
88
89 BCAccessorContext.rsFileName = getInputFileName().c_str();
90 BCAccessorContext.bcFileName = getOutputFileName().c_str();
91 BCAccessorContext.reflectPath = OutputPathBase.c_str();
92 BCAccessorContext.packageName = PackageName.c_str();
93 BCAccessorContext.bcStorage = BCST_JAVA_CODE; // Must be BCST_JAVA_CODE
94
95 return RSSlangReflectUtils::GenerateBitCodeAccessor(BCAccessorContext);
96}
97
Zonr Change86245a2010-10-12 21:42:13 +080098bool SlangRS::checkODR(const char *CurInputFile) {
Zonr Chang641558f2010-10-12 21:07:06 +080099 for (RSContext::ExportableList::iterator I = mRSContext->exportable_begin(),
100 E = mRSContext->exportable_end();
101 I != E;
102 I++) {
Stephen Hinesa858cb62011-01-17 12:17:51 -0800103 RSExportable *RSE = *I;
104 if (RSE->getKind() != RSExportable::EX_TYPE)
Zonr Chang641558f2010-10-12 21:07:06 +0800105 continue;
106
Stephen Hinesa858cb62011-01-17 12:17:51 -0800107 RSExportType *ET = static_cast<RSExportType *>(RSE);
Zonr Chang641558f2010-10-12 21:07:06 +0800108 if (ET->getClass() != RSExportType::ExportClassRecord)
109 continue;
110
111 RSExportRecordType *ERT = static_cast<RSExportRecordType *>(ET);
112
113 // Artificial record types (create by us not by user in the source) always
114 // conforms the ODR.
115 if (ERT->isArtificial())
116 continue;
117
118 // Key to lookup ERT in ReflectedDefinitions
119 llvm::StringRef RDKey(ERT->getName());
120 ReflectedDefinitionListTy::const_iterator RD =
121 ReflectedDefinitions.find(RDKey);
122
123 if (RD != ReflectedDefinitions.end()) {
124 const RSExportRecordType *Reflected = RD->getValue().first;
125 // There's a record (struct) with the same name reflected before. Enforce
126 // ODR checking - the Reflected must hold *exactly* the same "definition"
127 // as the one defined previously. We say two record types A and B have the
128 // same definition iff:
129 //
130 // struct A { struct B {
131 // Type(a1) a1, Type(b1) b1,
132 // Type(a2) a2, Type(b1) b2,
133 // ... ...
134 // Type(aN) aN Type(b3) b3,
135 // }; }
136 // Cond. #1. They have same number of fields, i.e., N = M;
137 // Cond. #2. for (i := 1 to N)
138 // Type(ai) = Type(bi) must hold;
139 // Cond. #3. for (i := 1 to N)
140 // Name(ai) = Name(bi) must hold;
141 //
142 // where,
143 // Type(F) = the type of field F and
144 // Name(F) = the field name.
145
146 bool PassODR = false;
147 // Cond. #1 and Cond. #2
148 if (Reflected->equals(ERT)) {
149 // Cond #3.
150 RSExportRecordType::const_field_iterator AI = Reflected->fields_begin(),
151 BI = ERT->fields_begin();
152
153 for (unsigned i = 0, e = Reflected->getFields().size(); i != e; i++) {
154 if ((*AI)->getName() != (*BI)->getName())
155 break;
156 AI++;
157 BI++;
158 }
159 PassODR = (AI == (Reflected->fields_end()));
160 }
161
162 if (!PassODR) {
163 getDiagnostics().Report(mDiagErrorODR) << Reflected->getName()
164 << getInputFileName()
165 << RD->getValue().second;
166 return false;
167 }
168 } else {
169 llvm::StringMapEntry<ReflectedDefinitionTy> *ME =
170 llvm::StringMapEntry<ReflectedDefinitionTy>::Create(RDKey.begin(),
171 RDKey.end());
Zonr Change86245a2010-10-12 21:42:13 +0800172 ME->setValue(std::make_pair(ERT, CurInputFile));
Zonr Chang641558f2010-10-12 21:07:06 +0800173
174 if (!ReflectedDefinitions.insert(ME))
175 delete ME;
176
177 // Take the ownership of ERT such that it won't be freed in ~RSContext().
178 ERT->keep();
179 }
Zonr Chang641558f2010-10-12 21:07:06 +0800180 }
181 return true;
182}
Zonr Changcf6af6a2010-10-12 12:38:51 +0800183
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800184void SlangRS::initDiagnostic() {
Logan Chien9207a2e2011-10-21 15:39:28 +0800185 clang::DiagnosticsEngine &DiagEngine = getDiagnostics();
Zonr Changcf6af6a2010-10-12 12:38:51 +0800186
Logan Chien9207a2e2011-10-21 15:39:28 +0800187 if (DiagEngine.setDiagnosticGroupMapping("implicit-function-declaration",
188 clang::diag::MAP_ERROR))
189 DiagEngine.Report(clang::diag::warn_unknown_warning_option)
190 << "implicit-function-declaration";
191
192 DiagEngine.setDiagnosticMapping(
193 clang::diag::ext_typecheck_convert_discards_qualifiers,
194 clang::diag::MAP_ERROR,
195 clang::SourceLocation());
Zonr Chang641558f2010-10-12 21:07:06 +0800196
197 mDiagErrorInvalidOutputDepParameter =
Logan Chien9207a2e2011-10-21 15:39:28 +0800198 DiagEngine.getCustomDiagID(
199 clang::DiagnosticsEngine::Error,
200 "invalid parameter for output dependencies files.");
Zonr Chang641558f2010-10-12 21:07:06 +0800201
202 mDiagErrorODR =
Logan Chien9207a2e2011-10-21 15:39:28 +0800203 DiagEngine.getCustomDiagID(
204 clang::DiagnosticsEngine::Error,
205 "type '%0' in different translation unit (%1 v.s. %2) "
206 "has incompatible type definition");
Zonr Chang641558f2010-10-12 21:07:06 +0800207
Logan Chien9207a2e2011-10-21 15:39:28 +0800208 mDiagErrorTargetAPIRange =
209 DiagEngine.getCustomDiagID(
210 clang::DiagnosticsEngine::Error,
Stephen Hines2e35b132011-07-22 02:50:19 -0700211 "target API level '%0' is out of range ('%1' - '%2')");
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800212}
213
214void SlangRS::initPreprocessor() {
215 clang::Preprocessor &PP = getPreprocessor();
216
Stephen Hines2e35b132011-07-22 02:50:19 -0700217 std::stringstream RSH;
218 RSH << "#define RS_VERSION " << mTargetAPI << std::endl;
Stephen Hines2d35edd2011-08-09 11:33:27 -0700219 RSH << "#include \"rs_core." RS_HEADER_SUFFIX "\"" << std::endl;
Stephen Hines2e35b132011-07-22 02:50:19 -0700220 PP.setPredefines(RSH.str());
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800221}
222
223void SlangRS::initASTContext() {
Stephen Hines9e5b5032010-11-03 13:19:14 -0700224 mRSContext = new RSContext(getPreprocessor(),
225 getASTContext(),
Stephen Hines3fd0a942011-01-18 12:27:39 -0800226 getTargetInfo(),
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800227 &mPragmas,
Stephen Hines4a4bf922011-08-18 17:20:33 -0700228 mTargetAPI,
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800229 &mGeneratedFileNames);
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800230}
231
232clang::ASTConsumer
233*SlangRS::createBackend(const clang::CodeGenOptions& CodeGenOpts,
234 llvm::raw_ostream *OS,
235 Slang::OutputType OT) {
236 return new RSBackend(mRSContext,
Stephen Hinese639eb52010-11-08 19:27:20 -0800237 &getDiagnostics(),
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800238 CodeGenOpts,
239 getTargetOptions(),
Stephen Hines3fd0a942011-01-18 12:27:39 -0800240 &mPragmas,
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800241 OS,
242 OT,
243 getSourceManager(),
Stephen Hines11274a72012-09-26 19:14:20 -0700244 mAllowRSPrefix,
245 mIsFilterscript);
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800246}
247
Zonr Chang592a9542010-10-07 20:03:58 +0800248bool SlangRS::IsRSHeaderFile(const char *File) {
Stephen Hines2d35edd2011-08-09 11:33:27 -0700249#define RS_HEADER_ENTRY(name) \
Tim Murrayee4016d2014-04-10 15:49:08 -0700250 if (::strcmp(File, #name "." RS_HEADER_SUFFIX) == 0) \
Zonr Chang592a9542010-10-07 20:03:58 +0800251 return true;
252ENUM_RS_HEADER()
253#undef RS_HEADER_ENTRY
Zonr Chang592a9542010-10-07 20:03:58 +0800254 return false;
255}
256
Stephen Hines11274a72012-09-26 19:14:20 -0700257bool SlangRS::IsLocInRSHeaderFile(const clang::SourceLocation &Loc,
258 const clang::SourceManager &SourceMgr) {
259 clang::FullSourceLoc FSL(Loc, SourceMgr);
Stephen Hinesfcda2352010-10-19 16:49:32 -0700260 clang::PresumedLoc PLoc = SourceMgr.getPresumedLoc(FSL);
Stephen Hinesfcda2352010-10-19 16:49:32 -0700261
Stephen Hines688e64b2011-08-23 16:01:25 -0700262 const char *Filename = PLoc.getFilename();
263 if (!Filename) {
264 return false;
265 } else {
266 return IsRSHeaderFile(llvm::sys::path::filename(Filename).data());
267 }
Stephen Hinesfcda2352010-10-19 16:49:32 -0700268}
269
Logan Chien9207a2e2011-10-21 15:39:28 +0800270SlangRS::SlangRS()
Stephen Hines11274a72012-09-26 19:14:20 -0700271 : Slang(), mRSContext(NULL), mAllowRSPrefix(false), mTargetAPI(0),
272 mIsFilterscript(false) {
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800273}
274
Zonr Changcf6af6a2010-10-12 12:38:51 +0800275bool SlangRS::compile(
276 const std::list<std::pair<const char*, const char*> > &IOFiles,
277 const std::list<std::pair<const char*, const char*> > &DepFiles,
278 const std::vector<std::string> &IncludePaths,
279 const std::vector<std::string> &AdditionalDepTargets,
280 Slang::OutputType OutputType, BitCodeStorageType BitcodeStorage,
281 bool AllowRSPrefix, bool OutputDep,
mkopec1c460b372012-01-09 11:21:50 -0500282 unsigned int TargetAPI, bool EmitDebug,
283 llvm::CodeGenOpt::Level OptimizationLevel,
Zonr Changcf6af6a2010-10-12 12:38:51 +0800284 const std::string &JavaReflectionPathBase,
Stephen Hines0a813a32012-08-03 16:52:40 -0700285 const std::string &JavaReflectionPackageName,
286 const std::string &RSPackageName) {
Zonr Changcf6af6a2010-10-12 12:38:51 +0800287 if (IOFiles.empty())
288 return true;
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800289
Zonr Changcf6af6a2010-10-12 12:38:51 +0800290 if (OutputDep && (DepFiles.size() != IOFiles.size())) {
Zonr Chang641558f2010-10-12 21:07:06 +0800291 getDiagnostics().Report(mDiagErrorInvalidOutputDepParameter);
Zonr Changcf6af6a2010-10-12 12:38:51 +0800292 return false;
293 }
294
295 std::string RealPackageName;
296
297 const char *InputFile, *OutputFile, *BCOutputFile, *DepOutputFile;
298 std::list<std::pair<const char*, const char*> >::const_iterator
299 IOFileIter = IOFiles.begin(), DepFileIter = DepFiles.begin();
300
301 setIncludePaths(IncludePaths);
302 setOutputType(OutputType);
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800303 if (OutputDep) {
Zonr Changcf6af6a2010-10-12 12:38:51 +0800304 setAdditionalDepTargets(AdditionalDepTargets);
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800305 }
Zonr Changcf6af6a2010-10-12 12:38:51 +0800306
mkopec1c460b372012-01-09 11:21:50 -0500307 setDebugMetadataEmission(EmitDebug);
308
309 setOptimizationLevel(OptimizationLevel);
310
Zonr Changcf6af6a2010-10-12 12:38:51 +0800311 mAllowRSPrefix = AllowRSPrefix;
312
Stephen Hines2e35b132011-07-22 02:50:19 -0700313 mTargetAPI = TargetAPI;
Stephen Hines4cc499d2011-08-24 19:06:17 -0700314 if (mTargetAPI < SLANG_MINIMUM_TARGET_API ||
315 mTargetAPI > SLANG_MAXIMUM_TARGET_API) {
Stephen Hines2e35b132011-07-22 02:50:19 -0700316 getDiagnostics().Report(mDiagErrorTargetAPIRange) << mTargetAPI
Stephen Hines4cc499d2011-08-24 19:06:17 -0700317 << SLANG_MINIMUM_TARGET_API << SLANG_MAXIMUM_TARGET_API;
Stephen Hines2e35b132011-07-22 02:50:19 -0700318 return false;
319 }
320
Stephen Hinesc632be22011-09-23 15:53:16 -0700321 // Skip generation of warnings a second time if we are doing more than just
322 // a single pass over the input file.
323 bool SuppressAllWarnings = (OutputType != Slang::OT_Dependency);
324
Zonr Changcf6af6a2010-10-12 12:38:51 +0800325 for (unsigned i = 0, e = IOFiles.size(); i != e; i++) {
326 InputFile = IOFileIter->first;
327 OutputFile = IOFileIter->second;
328
329 reset();
330
331 if (!setInputSource(InputFile))
332 return false;
333
334 if (!setOutput(OutputFile))
335 return false;
336
Stephen Hines11274a72012-09-26 19:14:20 -0700337 mIsFilterscript = isFilterscript(InputFile);
338
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800339 if (Slang::compile() > 0)
340 return false;
341
Stephen Hines925879f2013-07-19 18:19:04 -0700342 if (!JavaReflectionPackageName.empty()) {
343 mRSContext->setReflectJavaPackageName(JavaReflectionPackageName);
344 }
345 const std::string &RealPackageName =
346 mRSContext->getReflectJavaPackageName();
347
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800348 if (OutputType != Slang::OT_Dependency) {
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800349
Stephen Hines5c25c512012-02-27 12:58:17 -0800350 if (BitcodeStorage == BCST_CPP_CODE) {
Jason Sams1b6a0882012-03-12 15:07:58 -0700351 RSReflectionCpp R(mRSContext);
352 bool ret = R.reflect(JavaReflectionPathBase, getInputFileName(), getOutputFileName());
353 if (!ret) {
354 return false;
355 }
Stephen Hines5c25c512012-02-27 12:58:17 -0800356 } else {
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800357
Stephen Hines925879f2013-07-19 18:19:04 -0700358 if (!reflectToJava(JavaReflectionPathBase, RSPackageName)) {
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800359 return false;
Stephen Hines5c25c512012-02-27 12:58:17 -0800360 }
361
362 for (std::vector<std::string>::const_iterator
363 I = mGeneratedFileNames.begin(), E = mGeneratedFileNames.end();
364 I != E;
365 I++) {
366 std::string ReflectedName = RSSlangReflectUtils::ComputePackagedPath(
367 JavaReflectionPathBase.c_str(),
368 (RealPackageName + OS_PATH_SEPARATOR_STR + *I).c_str());
369 appendGeneratedFileName(ReflectedName + ".java");
370 }
371
372 if ((OutputType == Slang::OT_Bitcode) &&
373 (BitcodeStorage == BCST_JAVA_CODE) &&
374 !generateBitcodeAccessor(JavaReflectionPathBase,
375 RealPackageName.c_str())) {
376 return false;
377 }
378 }
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800379 }
380
Zonr Changcf6af6a2010-10-12 12:38:51 +0800381 if (OutputDep) {
382 BCOutputFile = DepFileIter->first;
383 DepOutputFile = DepFileIter->second;
384
385 setDepTargetBC(BCOutputFile);
386
387 if (!setDepOutput(DepOutputFile))
388 return false;
389
Stephen Hinesc632be22011-09-23 15:53:16 -0700390 if (SuppressAllWarnings) {
391 getDiagnostics().setSuppressAllDiagnostics(true);
392 }
Zonr Changcf6af6a2010-10-12 12:38:51 +0800393 if (generateDepFile() > 0)
394 return false;
Stephen Hinesc632be22011-09-23 15:53:16 -0700395 if (SuppressAllWarnings) {
396 getDiagnostics().setSuppressAllDiagnostics(false);
397 }
Zonr Changcf6af6a2010-10-12 12:38:51 +0800398
399 DepFileIter++;
400 }
401
Zonr Change86245a2010-10-12 21:42:13 +0800402 if (!checkODR(InputFile))
Zonr Chang641558f2010-10-12 21:07:06 +0800403 return false;
404
Zonr Changcf6af6a2010-10-12 12:38:51 +0800405 IOFileIter++;
406 }
407
408 return true;
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800409}
410
Zonr Chang641558f2010-10-12 21:07:06 +0800411void SlangRS::reset() {
412 delete mRSContext;
413 mRSContext = NULL;
Stephen Hines4cc67fc2011-01-31 16:48:57 -0800414 mGeneratedFileNames.clear();
Zonr Chang641558f2010-10-12 21:07:06 +0800415 Slang::reset();
416 return;
417}
418
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800419SlangRS::~SlangRS() {
420 delete mRSContext;
Zonr Chang641558f2010-10-12 21:07:06 +0800421 for (ReflectedDefinitionListTy::iterator I = ReflectedDefinitions.begin(),
422 E = ReflectedDefinitions.end();
423 I != E;
424 I++) {
425 delete I->getValue().first;
426 }
Zonr Chang3a9ca1f2010-10-06 17:52:56 +0800427 return;
428}
Stephen Hinese639eb52010-11-08 19:27:20 -0800429
430} // namespace slang