Lines Matching refs:OS
86 virtual void writeAccessors(raw_ostream &OS) const = 0;
87 virtual void writeAccessorDefinitions(raw_ostream &OS) const {}
88 virtual void writeCloneArgs(raw_ostream &OS) const = 0;
89 virtual void writeCtorBody(raw_ostream &OS) const {}
90 virtual void writeCtorInitializers(raw_ostream &OS) const = 0;
91 virtual void writeCtorParameters(raw_ostream &OS) const = 0;
92 virtual void writeDeclarations(raw_ostream &OS) const = 0;
93 virtual void writePCHReadArgs(raw_ostream &OS) const = 0;
94 virtual void writePCHReadDecls(raw_ostream &OS) const = 0;
95 virtual void writePCHWrite(raw_ostream &OS) const = 0;
106 void writeAccessors(raw_ostream &OS) const {
107 OS << " " << type << " get" << getUpperName() << "() const {\n";
108 OS << " return " << getLowerName() << ";\n";
109 OS << " }";
111 void writeCloneArgs(raw_ostream &OS) const {
112 OS << getLowerName();
114 void writeCtorInitializers(raw_ostream &OS) const {
115 OS << getLowerName() << "(" << getUpperName() << ")";
117 void writeCtorParameters(raw_ostream &OS) const {
118 OS << type << " " << getUpperName();
120 void writeDeclarations(raw_ostream &OS) const {
121 OS << type << " " << getLowerName() << ";";
123 void writePCHReadDecls(raw_ostream &OS) const {
125 OS << " " << type << " " << getLowerName() << " = " << read << ";\n";
127 void writePCHReadArgs(raw_ostream &OS) const {
128 OS << getLowerName();
130 void writePCHWrite(raw_ostream &OS) const {
131 OS << " " << WritePCHRecord(type, "SA->get" +
142 void writeAccessors(raw_ostream &OS) const {
143 OS << " llvm::StringRef get" << getUpperName() << "() const {\n";
144 OS << " return llvm::StringRef(" << getLowerName() << ", "
146 OS << " }\n";
147 OS << " unsigned get" << getUpperName() << "Length() const {\n";
148 OS << " return " << getLowerName() << "Length;\n";
149 OS << " }\n";
150 OS << " void set" << getUpperName()
152 OS << " " << getLowerName() << "Length = S.size();\n";
153 OS << " this->" << getLowerName() << " = new (C, 1) char ["
155 OS << " std::memcpy(this->" << getLowerName() << ", S.data(), "
157 OS << " }";
159 void writeCloneArgs(raw_ostream &OS) const {
160 OS << "get" << getUpperName() << "()";
162 void writeCtorBody(raw_ostream &OS) const {
163 OS << " std::memcpy(" << getLowerName() << ", " << getUpperName()
166 void writeCtorInitializers(raw_ostream &OS) const {
167 OS << getLowerName() << "Length(" << getUpperName() << ".size()),"
171 void writeCtorParameters(raw_ostream &OS) const {
172 OS << "llvm::StringRef " << getUpperName();
174 void writeDeclarations(raw_ostream &OS) const {
175 OS << "unsigned " << getLowerName() << "Length;\n";
176 OS << "char *" << getLowerName() << ";";
178 void writePCHReadDecls(raw_ostream &OS) const {
179 OS << " std::string " << getLowerName()
182 void writePCHReadArgs(raw_ostream &OS) const {
183 OS << getLowerName();
185 void writePCHWrite(raw_ostream &OS) const {
186 OS << " AddString(SA->get" << getUpperName() << "(), Record);\n";
196 void writeAccessors(raw_ostream &OS) const {
197 OS << " bool is" << getUpperName() << "Dependent() const;\n";
199 OS << " unsigned get" << getUpperName() << "(ASTContext &Ctx) const;\n";
201 OS << " bool is" << getUpperName() << "Expr() const {\n";
202 OS << " return is" << getLowerName() << "Expr;\n";
203 OS << " }\n";
205 OS << " Expr *get" << getUpperName() << "Expr() const {\n";
206 OS << " assert(is" << getLowerName() << "Expr);\n";
207 OS << " return " << getLowerName() << "Expr;\n";
208 OS << " }\n";
210 OS << " TypeSourceInfo *get" << getUpperName() << "Type() const {\n";
211 OS << " assert(!is" << getLowerName() << "Expr);\n";
212 OS << " return " << getLowerName() << "Type;\n";
213 OS << " }";
215 void writeAccessorDefinitions(raw_ostream &OS) const {
216 OS << "bool " << getAttrName() << "Attr::is" << getUpperName()
218 OS << " if (is" << getLowerName() << "Expr)\n";
219 OS << " return " << getLowerName() << "Expr && (" << getLowerName()
222 OS << " else\n";
223 OS << " return " << getLowerName()
225 OS << "}\n";
232 OS << "unsigned " << getAttrName() << "Attr::get" << getUpperName()
234 OS << " assert(!is" << getUpperName() << "Dependent());\n";
235 OS << " if (is" << getLowerName() << "Expr)\n";
236 OS << " return (" << getLowerName() << "Expr ? " << getLowerName()
239 OS << " else\n";
240 OS << " return 0; // FIXME\n";
241 OS << "}\n";
243 void writeCloneArgs(raw_ostream &OS) const {
244 OS << "is" << getLowerName() << "Expr, is" << getLowerName()
249 void writeCtorBody(raw_ostream &OS) const {
250 OS << " if (is" << getLowerName() << "Expr)\n";
251 OS << " " << getLowerName() << "Expr = reinterpret_cast<Expr *>("
253 OS << " else\n";
254 OS << " " << getLowerName()
258 void writeCtorInitializers(raw_ostream &OS) const {
259 OS << "is" << getLowerName() << "Expr(Is" << getUpperName() << "Expr)";
261 void writeCtorParameters(raw_ostream &OS) const {
262 OS << "bool Is" << getUpperName() << "Expr, void *" << getUpperName();
264 void writeDeclarations(raw_ostream &OS) const {
265 OS << "bool is" << getLowerName() << "Expr;\n";
266 OS << "union {\n";
267 OS << "Expr *" << getLowerName() << "Expr;\n";
268 OS << "TypeSourceInfo *" << getLowerName() << "Type;\n";
269 OS << "};";
271 void writePCHReadArgs(raw_ostream &OS) const {
272 OS << "is" << getLowerName() << "Expr, " << getLowerName() << "Ptr";
274 void writePCHReadDecls(raw_ostream &OS) const {
275 OS << " bool is" << getLowerName() << "Expr = Record[Idx++];\n";
276 OS << " void *" << getLowerName() << "Ptr;\n";
277 OS << " if (is" << getLowerName() << "Expr)\n";
278 OS << " " << getLowerName() << "Ptr = ReadExpr(F);\n";
279 OS << " else\n";
280 OS << " " << getLowerName()
283 void writePCHWrite(raw_ostream &OS) const {
284 OS << " Record.push_back(SA->is" << getUpperName() << "Expr());\n";
285 OS << " if (SA->is" << getUpperName() << "Expr())\n";
286 OS << " AddStmt(SA->get" << getUpperName() << "Expr());\n";
287 OS << " else\n";
288 OS << " AddTypeSourceInfo(SA->get" << getUpperName()
303 void writeAccessors(raw_ostream &OS) const {
304 OS << " typedef " << type << "* " << getLowerName() << "_iterator;\n";
305 OS << " " << getLowerName() << "_iterator " << getLowerName()
307 OS << " return " << getLowerName() << ";\n";
308 OS << " }\n";
309 OS << " " << getLowerName() << "_iterator " << getLowerName()
311 OS << " return " << getLowerName() << " + " << getLowerName()
313 OS << " }\n";
314 OS << " unsigned " << getLowerName() << "_size() const {\n"
316 OS << " }";
318 void writeCloneArgs(raw_ostream &OS) const {
319 OS << getLowerName() << ", " << getLowerName() << "Size";
321 void writeCtorBody(raw_ostream &OS) const {
323 OS << " std::memcpy(" << getLowerName() << ", " << getUpperName()
326 void writeCtorInitializers(raw_ostream &OS) const {
327 OS << getLowerName() << "Size(" << getUpperName() << "Size), "
331 void writeCtorParameters(raw_ostream &OS) const {
332 OS << getType() << " *" << getUpperName() << ", unsigned "
335 void writeDeclarations(raw_ostream &OS) const {
336 OS << " unsigned " << getLowerName() << "Size;\n";
337 OS << " " << getType() << " *" << getLowerName() << ";";
339 void writePCHReadDecls(raw_ostream &OS) const {
340 OS << " unsigned " << getLowerName() << "Size = Record[Idx++];\n";
341 OS << " llvm::SmallVector<" << type << ", 4> " << getLowerName()
343 OS << " " << getLowerName() << ".reserve(" << getLowerName()
345 OS << " for (unsigned i = " << getLowerName() << "Size; i; --i)\n";
348 OS << " " << getLowerName() << ".push_back(" << read << ");\n";
350 void writePCHReadArgs(raw_ostream &OS) const {
351 OS << getLowerName() << ".data(), " << getLowerName() << "Size";
353 void writePCHWrite(raw_ostream &OS) const{
354 OS << " Record.push_back(SA->" << getLowerName() << "_size());\n";
355 OS << " for (" << getAttrName() << "Attr::" << getLowerName()
358 OS << " " << WritePCHRecord(type, "(*i)");
372 void writeAccessors(raw_ostream &OS) const {
373 OS << " " << type << " get" << getUpperName() << "() const {\n";
374 OS << " return " << getLowerName() << ";\n";
375 OS << " }";
377 void writeCloneArgs(raw_ostream &OS) const {
378 OS << getLowerName();
380 void writeCtorInitializers(raw_ostream &OS) const {
381 OS << getLowerName() << "(" << getUpperName() << ")";
383 void writeCtorParameters(raw_ostream &OS) const {
384 OS << type << " " << getUpperName();
386 void writeDeclarations(raw_ostream &OS) const {
400 OS << "public:\n";
401 OS << " enum " << type << " {\n";
403 OS << " " << *i << ",\n";
404 OS << " " << *e << "\n";
405 OS << " };\n";
406 OS << "private:\n";
407 OS << " " << type << " " << getLowerName() << ";";
409 void writePCHReadDecls(raw_ostream &OS) const {
410 OS << " " << getAttrName() << "Attr::" << type << " " << getLowerName()
414 void writePCHReadArgs(raw_ostream &OS) const {
415 OS << getLowerName();
417 void writePCHWrite(raw_ostream &OS) const {
418 OS << "Record.push_back(SA->get" << getUpperName() << "());\n";
428 void writeAccessors(raw_ostream &OS) const {
429 OS << " VersionTuple get" << getUpperName() << "() const {\n";
430 OS << " return " << getLowerName() << ";\n";
431 OS << " }\n";
432 OS << " void set" << getUpperName()
434 OS << " " << getLowerName() << " = V;\n";
435 OS << " }";
437 void writeCloneArgs(raw_ostream &OS) const {
438 OS << "get" << getUpperName() << "()";
440 void writeCtorBody(raw_ostream &OS) const {
442 void writeCtorInitializers(raw_ostream &OS) const {
443 OS << getLowerName() << "(" << getUpperName() << ")";
445 void writeCtorParameters(raw_ostream &OS) const {
446 OS << "VersionTuple " << getUpperName();
448 void writeDeclarations(raw_ostream &OS) const {
449 OS << "VersionTuple " << getLowerName() << ";\n";
451 void writePCHReadDecls(raw_ostream &OS) const {
452 OS << " VersionTuple " << getLowerName()
455 void writePCHReadArgs(raw_ostream &OS) const {
456 OS << getLowerName();
458 void writePCHWrite(raw_ostream &OS) const {
459 OS << " AddVersionTuple(SA->get" << getUpperName() << "(), Record);\n";
505 void ClangAttrClassEmitter::run(raw_ostream &OS) {
506 OS << "// This file is generated by TableGen. Do not edit.\n\n";
507 OS << "#ifndef LLVM_CLANG_ATTR_CLASSES_INC\n";
508 OS << "#define LLVM_CLANG_ATTR_CLASSES_INC\n\n";
517 OS << "class " << R.getName() << "Attr : public " << SuperName << " {\n";
532 Arg->writeDeclarations(OS);
533 OS << "\n\n";
538 OS << "\n public:\n";
539 OS << " " << R.getName() << "Attr(SourceLocation L, ASTContext &Ctx\n";
542 OS << " , ";
543 (*ai)->writeCtorParameters(OS);
544 OS << "\n";
547 OS << " )\n";
548 OS << " : " << SuperName << "(attr::" << R.getName() << ", L)\n";
551 OS << " , ";
552 (*ai)->writeCtorInitializers(OS);
553 OS << "\n";
556 OS << " {\n";
559 (*ai)->writeCtorBody(OS);
560 OS << "\n";
562 OS << " }\n\n";
564 OS << " virtual " << R.getName() << "Attr *clone (ASTContext &C) const;\n";
567 (*ai)->writeAccessors(OS);
568 OS << "\n\n";
571 OS << R.getValueAsCode("AdditionalMembers");
572 OS << "\n\n";
574 OS << " static bool classof(const Attr *A) { return A->getKind() == "
576 OS << " static bool classof(const " << R.getName()
578 OS << "};\n\n";
581 OS << "#endif\n";
584 void ClangAttrImplEmitter::run(raw_ostream &OS) {
585 OS << "// This file is generated by TableGen. Do not edit.\n\n";
599 (*ai)->writeAccessorDefinitions(OS);
601 OS << R.getName() << "Attr *" << R.getName()
603 OS << " return new (C) " << R.getName() << "Attr(getLocation(), C";
605 OS << ", ";
606 (*ai)->writeCloneArgs(OS);
608 OS << ");\n}\n\n";
612 static void EmitAttrList(raw_ostream &OS, StringRef Class,
619 OS << Class << "(" << (*i)->getName() << ")\n";
621 OS << "LAST_" << Class << "(" << (*i)->getName() << ")\n\n";
625 void ClangAttrListEmitter::run(raw_ostream &OS) {
626 OS << "// This file is generated by TableGen. Do not edit.\n\n";
628 OS << "#ifndef LAST_ATTR\n";
629 OS << "#define LAST_ATTR(NAME) ATTR(NAME)\n";
630 OS << "#endif\n\n";
632 OS << "#ifndef INHERITABLE_ATTR\n";
633 OS << "#define INHERITABLE_ATTR(NAME) ATTR(NAME)\n";
634 OS << "#endif\n\n";
636 OS << "#ifndef LAST_INHERITABLE_ATTR\n";
637 OS << "#define LAST_INHERITABLE_ATTR(NAME) INHERITABLE_ATTR(NAME)\n";
638 OS << "#endif\n\n";
640 OS << "#ifndef INHERITABLE_PARAM_ATTR\n";
641 OS << "#define INHERITABLE_PARAM_ATTR(NAME) ATTR(NAME)\n";
642 OS << "#endif\n\n";
644 OS << "#ifndef LAST_INHERITABLE_PARAM_ATTR\n";
645 OS << "#define LAST_INHERITABLE_PARAM_ATTR(NAME)"
647 OS << "#endif\n\n";
663 EmitAttrList(OS, "INHERITABLE_PARAM_ATTR", InhParamAttrs);
664 EmitAttrList(OS, "INHERITABLE_ATTR", InhAttrs);
665 EmitAttrList(OS, "ATTR", NonInhAttrs);
667 OS << "#undef LAST_ATTR\n";
668 OS << "#undef INHERITABLE_ATTR\n";
669 OS << "#undef LAST_INHERITABLE_ATTR\n";
670 OS << "#undef LAST_INHERITABLE_PARAM_ATTR\n";
671 OS << "#undef ATTR\n";
674 void ClangAttrPCHReadEmitter::run(raw_ostream &OS) {
675 OS << "// This file is generated by TableGen. Do not edit.\n\n";
684 OS << " switch (Kind) {\n";
685 OS << " default:\n";
686 OS << " assert(0 && \"Unknown attribute!\");\n";
687 OS << " break;\n";
690 OS << " case attr::" << R.getName() << ": {\n";
692 OS << " bool isInherited = Record[Idx++];\n";
698 A->writePCHReadDecls(OS);
700 OS << " New = new (*Context) " << R.getName() << "Attr(Loc, *Context";
702 OS << ", ";
703 (*ri)->writePCHReadArgs(OS);
705 OS << ");\n";
707 OS << " cast<InheritableAttr>(New)->setInherited(isInherited);\n";
708 OS << " break;\n";
709 OS << " }\n";
711 OS << " }\n";
714 void ClangAttrPCHWriteEmitter::run(raw_ostream &OS) {
719 OS << " switch (A->getKind()) {\n";
720 OS << " default:\n";
721 OS << " llvm_unreachable(\"Unknown attribute kind!\");\n";
722 OS << " break;\n";
725 OS << " case attr::" << R.getName() << ": {\n";
728 OS << " const " << R.getName() << "Attr *SA = cast<" << R.getName()
731 OS << " Record.push_back(SA->isInherited());\n";
733 createArgument(**ai, R.getName())->writePCHWrite(OS);
734 OS << " break;\n";
735 OS << " }\n";
737 OS << " }\n";
740 void ClangAttrSpellingListEmitter::run(raw_ostream &OS) {
741 OS << "// This file is generated by TableGen. Do not edit.\n\n";
752 OS << ".Case(\"" << Spelling << "\", true)\n";