blob: 418dbf4cd80fad74d524d28054d5bb81e56aa9cf [file] [log] [blame]
Daniel Dunbar8305d012009-11-14 10:42:46 +00001//===--- FrontendActions.cpp ----------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "clang/Frontend/FrontendActions.h"
11#include "clang/AST/ASTConsumer.h"
Douglas Gregordb1cde72011-11-16 00:09:06 +000012#include "clang/Lex/HeaderSearch.h"
Daniel Dunbarc72cc502010-06-11 20:10:12 +000013#include "clang/Lex/Pragma.h"
Daniel Dunbar5f3b9972009-11-14 10:42:57 +000014#include "clang/Lex/Preprocessor.h"
15#include "clang/Parse/Parser.h"
Daniel Dunbar8305d012009-11-14 10:42:46 +000016#include "clang/Basic/FileManager.h"
Daniel Dunbar8305d012009-11-14 10:42:46 +000017#include "clang/Frontend/ASTConsumers.h"
18#include "clang/Frontend/ASTUnit.h"
19#include "clang/Frontend/CompilerInstance.h"
Daniel Dunbar8305d012009-11-14 10:42:46 +000020#include "clang/Frontend/FrontendDiagnostic.h"
21#include "clang/Frontend/Utils.h"
Sebastian Redl7faa2ec2010-08-18 23:56:37 +000022#include "clang/Serialization/ASTWriter.h"
Nick Lewyckyba5f6ec2010-04-24 01:30:46 +000023#include "llvm/ADT/OwningPtr.h"
Douglas Gregorf033f1d2010-07-20 20:18:03 +000024#include "llvm/Support/MemoryBuffer.h"
Daniel Dunbar8305d012009-11-14 10:42:46 +000025#include "llvm/Support/raw_ostream.h"
Douglas Gregor10efbaf2011-09-23 23:43:36 +000026#include "llvm/Support/system_error.h"
27
Daniel Dunbar8305d012009-11-14 10:42:46 +000028using namespace clang;
29
Daniel Dunbar5f3b9972009-11-14 10:42:57 +000030//===----------------------------------------------------------------------===//
Daniel Dunbar27585952010-03-19 19:44:04 +000031// Custom Actions
32//===----------------------------------------------------------------------===//
33
34ASTConsumer *InitOnlyAction::CreateASTConsumer(CompilerInstance &CI,
Chris Lattner5f9e2722011-07-23 10:55:15 +000035 StringRef InFile) {
Daniel Dunbar27585952010-03-19 19:44:04 +000036 return new ASTConsumer();
37}
38
39void InitOnlyAction::ExecuteAction() {
40}
41
42//===----------------------------------------------------------------------===//
Daniel Dunbar5f3b9972009-11-14 10:42:57 +000043// AST Consumer Actions
44//===----------------------------------------------------------------------===//
45
Daniel Dunbar8305d012009-11-14 10:42:46 +000046ASTConsumer *ASTPrintAction::CreateASTConsumer(CompilerInstance &CI,
Chris Lattner5f9e2722011-07-23 10:55:15 +000047 StringRef InFile) {
48 if (raw_ostream *OS = CI.createDefaultOutputFile(false, InFile))
Daniel Dunbar36043592009-12-03 09:13:30 +000049 return CreateASTPrinter(OS);
50 return 0;
Daniel Dunbar8305d012009-11-14 10:42:46 +000051}
52
Daniel Dunbar8305d012009-11-14 10:42:46 +000053ASTConsumer *ASTDumpAction::CreateASTConsumer(CompilerInstance &CI,
Chris Lattner5f9e2722011-07-23 10:55:15 +000054 StringRef InFile) {
Daniel Dunbar8305d012009-11-14 10:42:46 +000055 return CreateASTDumper();
56}
57
John McCallf3514242010-11-24 11:21:45 +000058ASTConsumer *ASTDumpXMLAction::CreateASTConsumer(CompilerInstance &CI,
Chris Lattner5f9e2722011-07-23 10:55:15 +000059 StringRef InFile) {
60 raw_ostream *OS;
John McCallf3514242010-11-24 11:21:45 +000061 if (CI.getFrontendOpts().OutputFile.empty())
62 OS = &llvm::outs();
63 else
64 OS = CI.createDefaultOutputFile(false, InFile);
65 if (!OS) return 0;
66 return CreateASTDumperXML(*OS);
67}
68
Daniel Dunbar8305d012009-11-14 10:42:46 +000069ASTConsumer *ASTViewAction::CreateASTConsumer(CompilerInstance &CI,
Chris Lattner5f9e2722011-07-23 10:55:15 +000070 StringRef InFile) {
Daniel Dunbar8305d012009-11-14 10:42:46 +000071 return CreateASTViewer();
72}
73
74ASTConsumer *DeclContextPrintAction::CreateASTConsumer(CompilerInstance &CI,
Chris Lattner5f9e2722011-07-23 10:55:15 +000075 StringRef InFile) {
Daniel Dunbar8305d012009-11-14 10:42:46 +000076 return CreateDeclContextPrinter();
77}
78
Daniel Dunbar8305d012009-11-14 10:42:46 +000079ASTConsumer *GeneratePCHAction::CreateASTConsumer(CompilerInstance &CI,
Chris Lattner5f9e2722011-07-23 10:55:15 +000080 StringRef InFile) {
Douglas Gregor1d715ac2010-08-03 08:14:03 +000081 std::string Sysroot;
Argyrios Kyrtzidis8e3df4d2011-02-15 17:54:22 +000082 std::string OutputFile;
Chris Lattner5f9e2722011-07-23 10:55:15 +000083 raw_ostream *OS = 0;
Douglas Gregor9293ba82011-08-25 22:35:51 +000084 if (ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, OS))
Daniel Dunbar8305d012009-11-14 10:42:46 +000085 return 0;
Douglas Gregor1d715ac2010-08-03 08:14:03 +000086
Douglas Gregor832d6202011-07-22 16:35:34 +000087 if (!CI.getFrontendOpts().RelocatablePCH)
88 Sysroot.clear();
Douglas Gregor66490142011-11-29 22:42:06 +000089 return new PCHGenerator(CI.getPreprocessor(), OutputFile, /*Module=*/false,
Douglas Gregor7143aab2011-09-01 17:04:32 +000090 Sysroot, OS);
Douglas Gregor1d715ac2010-08-03 08:14:03 +000091}
92
93bool GeneratePCHAction::ComputeASTConsumerArguments(CompilerInstance &CI,
Chris Lattner5f9e2722011-07-23 10:55:15 +000094 StringRef InFile,
Douglas Gregor1d715ac2010-08-03 08:14:03 +000095 std::string &Sysroot,
Argyrios Kyrtzidis8e3df4d2011-02-15 17:54:22 +000096 std::string &OutputFile,
Douglas Gregor9293ba82011-08-25 22:35:51 +000097 raw_ostream *&OS) {
Douglas Gregor1d715ac2010-08-03 08:14:03 +000098 Sysroot = CI.getHeaderSearchOpts().Sysroot;
99 if (CI.getFrontendOpts().RelocatablePCH && Sysroot.empty()) {
Sebastian Redl11c3dc42010-08-17 17:55:38 +0000100 CI.getDiagnostics().Report(diag::err_relocatable_without_isysroot);
Douglas Gregor1d715ac2010-08-03 08:14:03 +0000101 return true;
Daniel Dunbar8305d012009-11-14 10:42:46 +0000102 }
103
Daniel Dunbarc7a9cda2011-01-31 22:00:44 +0000104 // We use createOutputFile here because this is exposed via libclang, and we
105 // must disable the RemoveFileOnSignal behavior.
Argyrios Kyrtzidis7e909852011-07-28 00:45:10 +0000106 // We use a temporary to avoid race conditions.
Daniel Dunbarc7a9cda2011-01-31 22:00:44 +0000107 OS = CI.createOutputFile(CI.getFrontendOpts().OutputFile, /*Binary=*/true,
Argyrios Kyrtzidis7e909852011-07-28 00:45:10 +0000108 /*RemoveFileOnSignal=*/false, InFile,
109 /*Extension=*/"", /*useTemporary=*/true);
Daniel Dunbar36043592009-12-03 09:13:30 +0000110 if (!OS)
Douglas Gregor1d715ac2010-08-03 08:14:03 +0000111 return true;
Daniel Dunbar36043592009-12-03 09:13:30 +0000112
Argyrios Kyrtzidis8e3df4d2011-02-15 17:54:22 +0000113 OutputFile = CI.getFrontendOpts().OutputFile;
Douglas Gregor1d715ac2010-08-03 08:14:03 +0000114 return false;
Daniel Dunbar8305d012009-11-14 10:42:46 +0000115}
116
Douglas Gregordb1cde72011-11-16 00:09:06 +0000117ASTConsumer *GenerateModuleAction::CreateASTConsumer(CompilerInstance &CI,
118 StringRef InFile) {
119 std::string Sysroot;
120 std::string OutputFile;
121 raw_ostream *OS = 0;
122 if (ComputeASTConsumerArguments(CI, InFile, Sysroot, OutputFile, OS))
123 return 0;
124
125 return new PCHGenerator(CI.getPreprocessor(), OutputFile, /*MakeModule=*/true,
126 Sysroot, OS);
127}
128
Douglas Gregor261e75b2011-11-16 17:04:00 +0000129/// \brief Collect the set of header includes needed to construct the given
130/// module.
131///
132/// \param Module The module we're collecting includes from.
133/// \param ExplicitOnly Whether we should only add headers from explicit
134static void collectModuleHeaderIncludes(const LangOptions &LangOpts,
135 ModuleMap::Module *Module,
136 bool ExplicitOnly,
137 llvm::SmallString<256> &Includes) {
138 if (!ExplicitOnly || Module->IsExplicit) {
139 // Add includes for each of these headers.
140 for (unsigned I = 0, N = Module->Headers.size(); I != N; ++I) {
141 if (LangOpts.ObjC1)
142 Includes += "#import \"";
143 else
144 Includes += "#include \"";
145 Includes += Module->Headers[I]->getName();
146 Includes += "\"\n";
147 }
148 }
149
150 // Recurse into submodules.
151 for (llvm::StringMap<ModuleMap::Module *>::iterator
152 Sub = Module->SubModules.begin(),
153 SubEnd = Module->SubModules.end();
154 Sub != SubEnd; ++Sub) {
155 collectModuleHeaderIncludes(LangOpts, Sub->getValue(),
156 ExplicitOnly && !Module->IsExplicit,
157 Includes);
158 }
159}
160
Douglas Gregordb1cde72011-11-16 00:09:06 +0000161bool GenerateModuleAction::BeginSourceFileAction(CompilerInstance &CI,
162 StringRef Filename) {
163 // Find the module map file.
164 const FileEntry *ModuleMap = CI.getFileManager().getFile(Filename);
165 if (!ModuleMap) {
166 CI.getDiagnostics().Report(diag::err_module_map_not_found)
167 << Filename;
168 return false;
169 }
170
171 // Parse the module map file.
172 HeaderSearch &HS = CI.getPreprocessor().getHeaderSearchInfo();
173 if (HS.loadModuleMapFile(ModuleMap))
174 return false;
175
176 if (CI.getLangOpts().CurrentModule.empty()) {
177 CI.getDiagnostics().Report(diag::err_missing_module_name);
178
179 // FIXME: Eventually, we could consider asking whether there was just
180 // a single module described in the module map, and use that as a
181 // default. Then it would be fairly trivial to just "compile" a module
182 // map with a single module (the common case).
183 return false;
184 }
185
186 // Dig out the module definition.
187 ModuleMap::Module *Module = HS.getModule(CI.getLangOpts().CurrentModule,
188 /*AllowSearch=*/false);
189 if (!Module) {
190 CI.getDiagnostics().Report(diag::err_missing_module)
191 << CI.getLangOpts().CurrentModule << Filename;
192
193 return false;
194 }
195
Douglas Gregor261e75b2011-11-16 17:04:00 +0000196 // Collect the set of #includes we need to build the module.
197 llvm::SmallString<256> HeaderContents;
198 collectModuleHeaderIncludes(CI.getLangOpts(), Module,
199 Module->UmbrellaHeader != 0, HeaderContents);
200 if (Module->UmbrellaHeader && HeaderContents.empty()) {
201 // Simple case: we have an umbrella header and there are no additional
202 // includes, we can just parse the umbrella header directly.
Douglas Gregordb1cde72011-11-16 00:09:06 +0000203 setCurrentFile(Module->UmbrellaHeader->getName(), getCurrentFileKind());
Douglas Gregor261e75b2011-11-16 17:04:00 +0000204 return true;
Douglas Gregordb1cde72011-11-16 00:09:06 +0000205 }
206
Douglas Gregor261e75b2011-11-16 17:04:00 +0000207 FileManager &FileMgr = CI.getFileManager();
208 llvm::SmallString<128> HeaderName;
209 time_t ModTime;
210 if (Module->UmbrellaHeader) {
211 // Read in the umbrella header.
212 // FIXME: Go through the source manager; the umbrella header may have
213 // been overridden.
214 std::string ErrorStr;
215 llvm::MemoryBuffer *UmbrellaContents
216 = FileMgr.getBufferForFile(Module->UmbrellaHeader, &ErrorStr);
217 if (!UmbrellaContents) {
218 CI.getDiagnostics().Report(diag::err_missing_umbrella_header)
219 << Module->UmbrellaHeader->getName() << ErrorStr;
220 return false;
221 }
222
223 // Combine the contents of the umbrella header with the automatically-
224 // generated includes.
225 llvm::SmallString<256> OldContents = HeaderContents;
226 HeaderContents = UmbrellaContents->getBuffer();
227 HeaderContents += "\n\n";
228 HeaderContents += "/* Module includes */\n";
229 HeaderContents += OldContents;
230
231 // Pretend that we're parsing the umbrella header.
232 HeaderName = Module->UmbrellaHeader->getName();
233 ModTime = Module->UmbrellaHeader->getModificationTime();
234
235 delete UmbrellaContents;
236 } else {
237 // Pick an innocuous-sounding name for the umbrella header.
238 HeaderName = Module->Name + ".h";
239 if (FileMgr.getFile(HeaderName, /*OpenFile=*/false,
240 /*CacheFailure=*/false)) {
241 // Try again!
242 HeaderName = Module->Name + "-module.h";
243 if (FileMgr.getFile(HeaderName, /*OpenFile=*/false,
244 /*CacheFailure=*/false)) {
245 // Pick something ridiculous and go with it.
246 HeaderName = Module->Name + "-module.hmod";
247 }
248 }
249 ModTime = time(0);
250 }
251
252 // Remap the contents of the header name we're using to our synthesized
253 // buffer.
254 const FileEntry *HeaderFile = FileMgr.getVirtualFile(HeaderName,
255 HeaderContents.size(),
256 ModTime);
257 llvm::MemoryBuffer *HeaderContentsBuf
258 = llvm::MemoryBuffer::getMemBufferCopy(HeaderContents);
259 CI.getSourceManager().overrideFileContents(HeaderFile, HeaderContentsBuf);
260
261 setCurrentFile(HeaderName, getCurrentFileKind());
Douglas Gregordb1cde72011-11-16 00:09:06 +0000262 return true;
263}
264
265bool GenerateModuleAction::ComputeASTConsumerArguments(CompilerInstance &CI,
266 StringRef InFile,
267 std::string &Sysroot,
268 std::string &OutputFile,
269 raw_ostream *&OS) {
270 // If no output file was provided, figure out where this module would go
271 // in the module cache.
272 if (CI.getFrontendOpts().OutputFile.empty()) {
273 HeaderSearch &HS = CI.getPreprocessor().getHeaderSearchInfo();
274 llvm::SmallString<256> ModuleFileName(HS.getModuleCachePath());
275 llvm::sys::path::append(ModuleFileName,
276 CI.getLangOpts().CurrentModule + ".pcm");
277 CI.getFrontendOpts().OutputFile = ModuleFileName.str();
278 }
279
280 // We use createOutputFile here because this is exposed via libclang, and we
281 // must disable the RemoveFileOnSignal behavior.
282 // We use a temporary to avoid race conditions.
283 OS = CI.createOutputFile(CI.getFrontendOpts().OutputFile, /*Binary=*/true,
284 /*RemoveFileOnSignal=*/false, InFile,
285 /*Extension=*/"", /*useTemporary=*/true);
286 if (!OS)
287 return true;
288
289 OutputFile = CI.getFrontendOpts().OutputFile;
290 return false;
291}
292
Daniel Dunbar8305d012009-11-14 10:42:46 +0000293ASTConsumer *SyntaxOnlyAction::CreateASTConsumer(CompilerInstance &CI,
Chris Lattner5f9e2722011-07-23 10:55:15 +0000294 StringRef InFile) {
Daniel Dunbar8305d012009-11-14 10:42:46 +0000295 return new ASTConsumer();
296}
297
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000298//===----------------------------------------------------------------------===//
299// Preprocessor Actions
300//===----------------------------------------------------------------------===//
301
302void DumpRawTokensAction::ExecuteAction() {
303 Preprocessor &PP = getCompilerInstance().getPreprocessor();
304 SourceManager &SM = PP.getSourceManager();
305
306 // Start lexing the specified input file.
Chris Lattner6e290142009-11-30 04:18:44 +0000307 const llvm::MemoryBuffer *FromFile = SM.getBuffer(SM.getMainFileID());
308 Lexer RawLex(SM.getMainFileID(), FromFile, SM, PP.getLangOptions());
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000309 RawLex.SetKeepWhitespaceMode(true);
310
311 Token RawTok;
312 RawLex.LexFromRawLexer(RawTok);
313 while (RawTok.isNot(tok::eof)) {
314 PP.DumpToken(RawTok, true);
Daniel Dunbar33f57f82009-11-25 10:27:48 +0000315 llvm::errs() << "\n";
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000316 RawLex.LexFromRawLexer(RawTok);
317 }
318}
319
320void DumpTokensAction::ExecuteAction() {
321 Preprocessor &PP = getCompilerInstance().getPreprocessor();
322 // Start preprocessing the specified input file.
323 Token Tok;
Chris Lattnere127a0d2010-04-20 20:35:58 +0000324 PP.EnterMainSourceFile();
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000325 do {
326 PP.Lex(Tok);
327 PP.DumpToken(Tok, true);
Daniel Dunbar33f57f82009-11-25 10:27:48 +0000328 llvm::errs() << "\n";
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000329 } while (Tok.isNot(tok::eof));
330}
331
332void GeneratePTHAction::ExecuteAction() {
333 CompilerInstance &CI = getCompilerInstance();
334 if (CI.getFrontendOpts().OutputFile.empty() ||
335 CI.getFrontendOpts().OutputFile == "-") {
336 // FIXME: Don't fail this way.
337 // FIXME: Verify that we can actually seek in the given file.
Chris Lattner83e7a782010-04-07 22:58:06 +0000338 llvm::report_fatal_error("PTH requires a seekable file for output!");
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000339 }
340 llvm::raw_fd_ostream *OS =
341 CI.createDefaultOutputFile(true, getCurrentFile());
Daniel Dunbar36043592009-12-03 09:13:30 +0000342 if (!OS) return;
343
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000344 CacheTokens(CI.getPreprocessor(), OS);
345}
346
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000347void PreprocessOnlyAction::ExecuteAction() {
348 Preprocessor &PP = getCompilerInstance().getPreprocessor();
349
Daniel Dunbarc72cc502010-06-11 20:10:12 +0000350 // Ignore unknown pragmas.
Argyrios Kyrtzidis9b36c3f2010-07-13 09:07:17 +0000351 PP.AddPragmaHandler(new EmptyPragmaHandler());
Daniel Dunbarc72cc502010-06-11 20:10:12 +0000352
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000353 Token Tok;
354 // Start parsing the specified input file.
Chris Lattnere127a0d2010-04-20 20:35:58 +0000355 PP.EnterMainSourceFile();
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000356 do {
357 PP.Lex(Tok);
358 } while (Tok.isNot(tok::eof));
359}
360
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000361void PrintPreprocessedAction::ExecuteAction() {
362 CompilerInstance &CI = getCompilerInstance();
Douglas Gregor10efbaf2011-09-23 23:43:36 +0000363 // Output file may need to be set to 'Binary', to avoid converting Unix style
Steve Naroffd57d7c02010-01-05 17:33:23 +0000364 // line feeds (<LF>) to Microsoft style line feeds (<CR><LF>).
Douglas Gregor10efbaf2011-09-23 23:43:36 +0000365 //
366 // Look to see what type of line endings the file uses. If there's a
367 // CRLF, then we won't open the file up in binary mode. If there is
368 // just an LF or CR, then we will open the file up in binary mode.
369 // In this fashion, the output format should match the input format, unless
370 // the input format has inconsistent line endings.
371 //
372 // This should be a relatively fast operation since most files won't have
373 // all of their source code on a single line. However, that is still a
374 // concern, so if we scan for too long, we'll just assume the file should
375 // be opened in binary mode.
376 bool BinaryMode = true;
377 bool InvalidFile = false;
378 const SourceManager& SM = CI.getSourceManager();
379 const llvm::MemoryBuffer *Buffer = SM.getBuffer(SM.getMainFileID(),
380 &InvalidFile);
381 if (!InvalidFile) {
382 const char *cur = Buffer->getBufferStart();
383 const char *end = Buffer->getBufferEnd();
384 const char *next = (cur != end) ? cur + 1 : end;
385
386 // Limit ourselves to only scanning 256 characters into the source
387 // file. This is mostly a sanity check in case the file has no
388 // newlines whatsoever.
389 if (end - cur > 256) end = cur + 256;
390
391 while (next < end) {
392 if (*cur == 0x0D) { // CR
393 if (*next == 0x0A) // CRLF
394 BinaryMode = false;
395
396 break;
397 } else if (*cur == 0x0A) // LF
398 break;
399
400 ++cur, ++next;
401 }
402 }
403
404 raw_ostream *OS = CI.createDefaultOutputFile(BinaryMode, getCurrentFile());
Daniel Dunbar36043592009-12-03 09:13:30 +0000405 if (!OS) return;
406
Daniel Dunbar5f3b9972009-11-14 10:42:57 +0000407 DoPrintPreprocessedInput(CI.getPreprocessor(), OS,
408 CI.getPreprocessorOutputOpts());
409}
Douglas Gregorf033f1d2010-07-20 20:18:03 +0000410
411void PrintPreambleAction::ExecuteAction() {
412 switch (getCurrentFileKind()) {
413 case IK_C:
414 case IK_CXX:
415 case IK_ObjC:
416 case IK_ObjCXX:
417 case IK_OpenCL:
Peter Collingbourne895fcca2010-12-01 03:15:20 +0000418 case IK_CUDA:
Douglas Gregorf033f1d2010-07-20 20:18:03 +0000419 break;
420
421 case IK_None:
422 case IK_Asm:
423 case IK_PreprocessedC:
424 case IK_PreprocessedCXX:
425 case IK_PreprocessedObjC:
426 case IK_PreprocessedObjCXX:
427 case IK_AST:
428 case IK_LLVM_IR:
429 // We can't do anything with these.
430 return;
431 }
432
Argyrios Kyrtzidis389db162010-11-03 22:45:23 +0000433 CompilerInstance &CI = getCompilerInstance();
434 llvm::MemoryBuffer *Buffer
Chris Lattner39b49bc2010-11-23 08:35:12 +0000435 = CI.getFileManager().getBufferForFile(getCurrentFile());
Douglas Gregorf033f1d2010-07-20 20:18:03 +0000436 if (Buffer) {
Argyrios Kyrtzidis03c107a2011-08-25 20:39:19 +0000437 unsigned Preamble = Lexer::ComputePreamble(Buffer, CI.getLangOpts()).first;
Douglas Gregorf033f1d2010-07-20 20:18:03 +0000438 llvm::outs().write(Buffer->getBufferStart(), Preamble);
439 delete Buffer;
440 }
441}