Home | History | Annotate | Download | only in TableGen

Lines Matching refs:OS

115     virtual void writeAccessors(raw_ostream &OS) const = 0;
116 virtual void writeAccessorDefinitions(raw_ostream &OS) const {}
117 virtual void writeCloneArgs(raw_ostream &OS) const = 0;
118 virtual void writeTemplateInstantiationArgs(raw_ostream &OS) const = 0;
119 virtual void writeTemplateInstantiation(raw_ostream &OS) const {}
120 virtual void writeCtorBody(raw_ostream &OS) const {}
121 virtual void writeCtorInitializers(raw_ostream &OS) const = 0;
122 virtual void writeCtorParameters(raw_ostream &OS) const = 0;
123 virtual void writeDeclarations(raw_ostream &OS) const = 0;
124 virtual void writePCHReadArgs(raw_ostream &OS) const = 0;
125 virtual void writePCHReadDecls(raw_ostream &OS) const = 0;
126 virtual void writePCHWrite(raw_ostream &OS) const = 0;
127 virtual void writeValue(raw_ostream &OS) const = 0;
128 virtual void writeDump(raw_ostream &OS) const = 0;
129 virtual void writeDumpChildren(raw_ostream &OS) const {}
130 virtual void writeHasChildren(raw_ostream &OS) const { OS << "false"; }
143 void writeAccessors(raw_ostream &OS) const {
144 OS << " " << type << " get" << getUpperName() << "() const {\n";
145 OS << " return " << getLowerName() << ";\n";
146 OS << " }";
148 void writeCloneArgs(raw_ostream &OS) const {
149 OS << getLowerName();
151 void writeTemplateInstantiationArgs(raw_ostream &OS) const {
152 OS << "A->get" << getUpperName() << "()";
154 void writeCtorInitializers(raw_ostream &OS) const {
155 OS << getLowerName() << "(" << getUpperName() << ")";
157 void writeCtorParameters(raw_ostream &OS) const {
158 OS << type << " " << getUpperName();
160 void writeDeclarations(raw_ostream &OS) const {
161 OS << type << " " << getLowerName() << ";";
163 void writePCHReadDecls(raw_ostream &OS) const {
165 OS << " " << type << " " << getLowerName() << " = " << read << ";\n";
167 void writePCHReadArgs(raw_ostream &OS) const {
168 OS << getLowerName();
170 void writePCHWrite(raw_ostream &OS) const {
171 OS << " " << WritePCHRecord(type, "SA->get" +
174 void writeValue(raw_ostream &OS) const {
176 OS << "\" << get" << getUpperName() << "()->getNameInfo().getAsString() << \"";
178 OS << "\" << get" << getUpperName() << "()->getName() << \"";
180 OS << "\" << get" << getUpperName() << "().getAsString() << \"";
182 OS << "\" << get" << getUpperName() << "().getRawEncoding() << \"";
184 OS << "\" << get" << getUpperName() << "() << \"";
187 void writeDump(raw_ostream &OS) const {
189 OS << " OS << \" \";\n";
190 OS << " dumpBareDeclRef(SA->get" << getUpperName() << "());\n";
192 OS << " OS << \" \" << SA->get" << getUpperName()
195 OS << " OS << \" \" << SA->get" << getUpperName()
198 OS << " OS << \" \";\n";
199 OS << " SA->get" << getUpperName() << "().print(OS, *SM);\n";
201 OS << " if (SA->get" << getUpperName() << "()) OS << \" "
204 OS << " OS << \" \" << SA->get" << getUpperName() << "();\n";
217 void writeAccessors(raw_ostream &OS) const {
218 OS << " llvm::StringRef get" << getUpperName() << "() const {\n";
219 OS << " return llvm::StringRef(" << getLowerName() << ", "
221 OS << " }\n";
222 OS << " unsigned get" << getUpperName() << "Length() const {\n";
223 OS << " return " << getLowerName() << "Length;\n";
224 OS << " }\n";
225 OS << " void set" << getUpperName()
227 OS << " " << getLowerName() << "Length = S.size();\n";
228 OS << " this->" << getLowerName() << " = new (C, 1) char ["
230 OS << " std::memcpy(this->" << getLowerName() << ", S.data(), "
232 OS << " }";
234 void writeCloneArgs(raw_ostream &OS) const {
235 OS << "get" << getUpperName() << "()";
237 void writeTemplateInstantiationArgs(raw_ostream &OS) const {
238 OS << "A->get" << getUpperName() << "()";
240 void writeCtorBody(raw_ostream &OS) const {
241 OS << " std::memcpy(" << getLowerName() << ", " << getUpperName()
244 void writeCtorInitializers(raw_ostream &OS) const {
245 OS << getLowerName() << "Length(" << getUpperName() << ".size()),"
249 void writeCtorParameters(raw_ostream &OS) const {
250 OS << "llvm::StringRef " << getUpperName();
252 void writeDeclarations(raw_ostream &OS) const {
253 OS << "unsigned " << getLowerName() << "Length;\n";
254 OS << "char *" << getLowerName() << ";";
256 void writePCHReadDecls(raw_ostream &OS) const {
257 OS << " std::string " << getLowerName()
260 void writePCHReadArgs(raw_ostream &OS) const {
261 OS << getLowerName();
263 void writePCHWrite(raw_ostream &OS) const {
264 OS << " AddString(SA->get" << getUpperName() << "(), Record);\n";
266 void writeValue(raw_ostream &OS) const {
267 OS << "\\\"\" << get" << getUpperName() << "() << \"\\\"";
269 void writeDump(raw_ostream &OS) const {
270 OS << " OS << \" \\\"\" << SA->get" << getUpperName()
281 void writeAccessors(raw_ostream &OS) const {
282 OS << " bool is" << getUpperName() << "Dependent() const;\n";
284 OS << " unsigned get" << getUpperName() << "(ASTContext &Ctx) const;\n";
286 OS << " bool is" << getUpperName() << "Expr() const {\n";
287 OS << " return is" << getLowerName() << "Expr;\n";
288 OS << " }\n";
290 OS << " Expr *get" << getUpperName() << "Expr() const {\n";
291 OS << " assert(is" << getLowerName() << "Expr);\n";
292 OS << " return " << getLowerName() << "Expr;\n";
293 OS << " }\n";
295 OS << " TypeSourceInfo *get" << getUpperName() << "Type() const {\n";
296 OS << " assert(!is" << getLowerName() << "Expr);\n";
297 OS << " return " << getLowerName() << "Type;\n";
298 OS << " }";
300 void writeAccessorDefinitions(raw_ostream &OS) const {
301 OS << "bool " << getAttrName() << "Attr::is" << getUpperName()
303 OS << " if (is" << getLowerName() << "Expr)\n";
304 OS << " return " << getLowerName() << "Expr && (" << getLowerName()
307 OS << " else\n";
308 OS << " return " << getLowerName()
310 OS << "}\n";
317 OS << "unsigned " << getAttrName() << "Attr::get" << getUpperName()
319 OS << " assert(!is" << getUpperName() << "Dependent());\n";
320 OS << " if (is" << getLowerName() << "Expr)\n";
321 OS << " return (" << getLowerName() << "Expr ? " << getLowerName()
324 OS << " else\n";
325 OS << " return 0; // FIXME\n";
326 OS << "}\n";
328 void writeCloneArgs(raw_ostream &OS) const {
329 OS << "is" << getLowerName() << "Expr, is" << getLowerName()
334 void writeTemplateInstantiationArgs(raw_ostream &OS) const {
338 void writeCtorBody(raw_ostream &OS) const {
339 OS << " if (is" << getLowerName() << "Expr)\n";
340 OS << " " << getLowerName() << "Expr = reinterpret_cast<Expr *>("
342 OS << " else\n";
343 OS << " " << getLowerName()
347 void writeCtorInitializers(raw_ostream &OS) const {
348 OS << "is" << getLowerName() << "Expr(Is" << getUpperName() << "Expr)";
350 void writeCtorParameters(raw_ostream &OS) const {
351 OS << "bool Is" << getUpperName() << "Expr, void *" << getUpperName();
353 void writeDeclarations(raw_ostream &OS) const {
354 OS << "bool is" << getLowerName() << "Expr;\n";
355 OS << "union {\n";
356 OS << "Expr *" << getLowerName() << "Expr;\n";
357 OS << "TypeSourceInfo *" << getLowerName() << "Type;\n";
358 OS << "};";
360 void writePCHReadArgs(raw_ostream &OS) const {
361 OS << "is" << getLowerName() << "Expr, " << getLowerName() << "Ptr";
363 void writePCHReadDecls(raw_ostream &OS) const {
364 OS << " bool is" << getLowerName() << "Expr = Record[Idx++];\n";
365 OS << " void *" << getLowerName() << "Ptr;\n";
366 OS << " if (is" << getLowerName() << "Expr)\n";
367 OS << " " << getLowerName() << "Ptr = ReadExpr(F);\n";
368 OS << " else\n";
369 OS << " " << getLowerName()
372 void writePCHWrite(raw_ostream &OS) const {
373 OS << " Record.push_back(SA->is" << getUpperName() << "Expr());\n";
374 OS << " if (SA->is" << getUpperName() << "Expr())\n";
375 OS << " AddStmt(SA->get" << getUpperName() << "Expr());\n";
376 OS << " else\n";
377 OS << " AddTypeSourceInfo(SA->get" << getUpperName()
380 void writeValue(raw_ostream &OS) const {
381 OS << "\";\n"
382 << " " << getLowerName() << "Expr->printPretty(OS, 0, Policy);\n"
383 << " OS << \"";
385 void writeDump(raw_ostream &OS) const {
387 void writeDumpChildren(raw_ostream &OS) const {
388 OS << " if (SA->is" << getUpperName() << "Expr()) {\n";
389 OS << " lastChild();\n";
390 OS << " dumpStmt(SA->get" << getUpperName() << "Expr());\n";
391 OS << " } else\n";
392 OS << " dumpType(SA->get" << getUpperName()
395 void writeHasChildren(raw_ostream &OS) const {
396 OS << "SA->is" << getUpperName() << "Expr()";
410 void writeAccessors(raw_ostream &OS) const {
411 OS << " typedef " << type << "* " << getLowerName() << "_iterator;\n";
412 OS << " " << getLowerName() << "_iterator " << getLowerName()
414 OS << " return " << getLowerName() << ";\n";
415 OS << " }\n";
416 OS << " " << getLowerName() << "_iterator " << getLowerName()
418 OS << " return " << getLowerName() << " + " << getLowerName()
420 OS << " }\n";
421 OS << " unsigned " << getLowerName() << "_size() const {\n"
423 OS << " }";
425 void writeCloneArgs(raw_ostream &OS) const {
426 OS << getLowerName() << ", " << getLowerName() << "Size";
428 void writeTemplateInstantiationArgs(raw_ostream &OS) const {
430 OS << "A->" << getLowerName() << "_begin(), "
433 void writeCtorBody(raw_ostream &OS) const {
435 OS << " std::memcpy(" << getLowerName() << ", " << getUpperName()
438 void writeCtorInitializers(raw_ostream &OS) const {
439 OS << getLowerName() << "Size(" << getUpperName() << "Size), "
443 void writeCtorParameters(raw_ostream &OS) const {
444 OS << getType() << " *" << getUpperName() << ", unsigned "
447 void writeDeclarations(raw_ostream &OS) const {
448 OS << " unsigned " << getLowerName() << "Size;\n";
449 OS << " " << getType() << " *" << getLowerName() << ";";
451 void writePCHReadDecls(raw_ostream &OS) const {
452 OS << " unsigned " << getLowerName() << "Size = Record[Idx++];\n";
453 OS << " SmallVector<" << type << ", 4> " << getLowerName()
455 OS << " " << getLowerName() << ".reserve(" << getLowerName()
457 OS << " for (unsigned i = " << getLowerName() << "Size; i; --i)\n";
460 OS << " " << getLowerName() << ".push_back(" << read << ");\n";
462 void writePCHReadArgs(raw_ostream &OS) const {
463 OS << getLowerName() << ".data(), " << getLowerName() << "Size";
465 void writePCHWrite(raw_ostream &OS) const{
466 OS << " Record.push_back(SA->" << getLowerName() << "_size());\n";
467 OS << " for (" << getAttrName() << "Attr::" << getLowerName()
470 OS << " " << WritePCHRecord(type, "(*i)");
472 void writeValue(raw_ostream &OS) const {
473 OS << "\";\n";
474 OS << " bool isFirst = true;\n"
479 << " else OS << \", \";\n"
480 << " OS << *i;\n"
482 OS << " OS << \"";
484 void writeDump(raw_ostream &OS) const {
485 OS << " for (" << getAttrName() << "Attr::" << getLowerName()
488 OS << " OS << \" \" << *I;\n";
509 void writeAccessors(raw_ostream &OS) const {
510 OS << " " << type << " get" << getUpperName() << "() const {\n";
511 OS << " return " << getLowerName() << ";\n";
512 OS << " }";
514 void writeCloneArgs(raw_ostream &OS) const {
515 OS << getLowerName();
517 void writeTemplateInstantiationArgs(raw_ostream &OS) const {
518 OS << "A->get" << getUpperName() << "()";
520 void writeCtorInitializers(raw_ostream &OS) const {
521 OS << getLowerName() << "(" << getUpperName() << ")";
523 void writeCtorParameters(raw_ostream &OS) const {
524 OS << type << " " << getUpperName();
526 void writeDeclarations(raw_ostream &OS) const {
532 OS << "public:\n";
533 OS << " enum " << type << " {\n";
535 OS << " " << *i << ",\n";
536 OS << " " << *e << "\n";
537 OS << " };\n";
538 OS << "private:\n";
539 OS << " " << type << " " << getLowerName() << ";";
541 void writePCHReadDecls(raw_ostream &OS) const {
542 OS << " " << getAttrName() << "Attr::" << type << " " << getLowerName()
546 void writePCHReadArgs(raw_ostream &OS) const {
547 OS << getLowerName();
549 void writePCHWrite(raw_ostream &OS) const {
550 OS << "Record.push_back(SA->get" << getUpperName() << "());\n";
552 void writeValue(raw_ostream &OS) const {
553 OS << "\" << get" << getUpperName() << "() << \"";
555 void writeDump(raw_ostream &OS) const {
556 OS << " switch(SA->get" << getUpperName() << "()) {\n";
559 OS << " case " << getAttrName() << "Attr::" << *I << ":\n";
560 OS << " OS << \" " << *I << "\";\n";
561 OS << " break;\n";
563 OS << " }\n";
573 void writeAccessors(raw_ostream &OS) const {
574 OS << " VersionTuple get" << getUpperName() << "() const {\n";
575 OS << " return " << getLowerName() << ";\n";
576 OS << " }\n";
577 OS << " void set" << getUpperName()
579 OS << " " << getLowerName() << " = V;\n";
580 OS << " }";
582 void writeCloneArgs(raw_ostream &OS) const {
583 OS << "get" << getUpperName() << "()";
585 void writeTemplateInstantiationArgs(raw_ostream &OS) const {
586 OS << "A->get" << getUpperName() << "()";
588 void writeCtorBody(raw_ostream &OS) const {
590 void writeCtorInitializers(raw_ostream &OS) const {
591 OS << getLowerName() << "(" << getUpperName() << ")";
593 void writeCtorParameters(raw_ostream &OS) const {
594 OS << "VersionTuple " << getUpperName();
596 void writeDeclarations(raw_ostream &OS) const {
597 OS << "VersionTuple " << getLowerName() << ";\n";
599 void writePCHReadDecls(raw_ostream &OS) const {
600 OS << " VersionTuple " << getLowerName()
603 void writePCHReadArgs(raw_ostream &OS) const {
604 OS << getLowerName();
606 void writePCHWrite(raw_ostream &OS) const {
607 OS << " AddVersionTuple(SA->get" << getUpperName() << "(), Record);\n";
609 void writeValue(raw_ostream &OS) const {
610 OS << getLowerName() << "=\" << get" << getUpperName() << "() << \"";
612 void writeDump(raw_ostream &OS) const {
613 OS << " OS << \" \" << SA->get" << getUpperName() << "();\n";
623 void writeTemplateInstantiationArgs(raw_ostream &OS) const {
624 OS << "tempInst" << getUpperName();
627 void writeTemplateInstantiation(raw_ostream &OS) const {
628 OS << " " << getType() << " tempInst" << getUpperName() << ";\n";
629 OS << " {\n";
630 OS << " EnterExpressionEvaluationContext "
632 OS << " ExprResult " << "Result = S.SubstExpr("
634 OS << " tempInst" << getUpperName() << " = "
636 OS << " }\n";
639 void writeDump(raw_ostream &OS) const {
642 void writeDumpChildren(raw_ostream &OS) const {
643 OS << " lastChild();\n";
644 OS << " dumpStmt(SA->get" << getUpperName() << "());\n";
646 void writeHasChildren(raw_ostream &OS) const { OS << "true"; }
655 void writeTemplateInstantiationArgs(raw_ostream &OS) const {
656 OS << "tempInst" << getUpperName() << ", "
660 void writeTemplateInstantiation(raw_ostream &OS) const {
661 OS << " " << getType() << " *tempInst" << getUpperName()
664 OS << " {\n";
665 OS << " EnterExpressionEvaluationContext "
667 OS << " " << getType() << " *TI = tempInst" << getUpperName()
669 OS << " " << getType() << " *I = A->" << getLowerName()
671 OS << " " << getType() << " *E = A->" << getLowerName()
673 OS << " for (; I != E; ++I, ++TI) {\n";
674 OS << " ExprResult Result = S.SubstExpr(*I, TemplateArgs);\n";
675 OS << " *TI = Result.takeAs<Expr>();\n";
676 OS << " }\n";
677 OS << " }\n";
680 void writeDump(raw_ostream &OS) const {
683 void writeDumpChildren(raw_ostream &OS) const {
684 OS << " for (" << getAttrName() << "Attr::" << getLowerName()
687 OS << " if (I + 1 == E)\n";
688 OS << " lastChild();\n";
689 OS << " dumpStmt(*I);\n";
690 OS << " }\n";
693 void writeHasChildren(raw_ostream &OS) const {
694 OS << "SA->" << getLowerName() << "_begin() != "
744 static void writeAvailabilityValue(raw_ostream &OS) {
745 OS << "\" << getPlatform()->getName();\n"
746 << " if (!getIntroduced().empty()) OS << \", introduced=\" << getIntroduced();\n"
747 << " if (!getDeprecated().empty()) OS << \", deprecated=\" << getDeprecated();\n"
748 << " if (!getObsoleted().empty()) OS << \", obsoleted=\" << getObsoleted();\n"
749 << " if (getUnavailable()) OS << \", unavailable\";\n"
750 << " OS << \"";
754 raw_ostream &OS) {
757 OS << "void " << R.getName() << "Attr::printPretty("
758 << "raw_ostream &OS, const PrintingPolicy &Policy) const {\n";
761 OS << "}\n\n";
765 OS <<
803 OS <<
805 " OS << \"" + Prefix.str() + Spelling.str();
807 if (Args.size()) OS << "(";
809 writeAvailabilityValue(OS);
813 if (I != Args.begin()) OS << ", ";
814 (*I)->writeValue(OS);
818 if (Args.size()) OS << ")";
819 OS << Suffix.str() + "\";\n";
821 OS <<
827 OS << "}\n";
829 OS << "}\n\n";
854 static void writeAttrAccessorDefinition(Record &R, raw_ostream &OS) {
866 OS << " bool " << Name << "() const { return SpellingListIndex == ";
868 OS << getSpellingListIndex(SpellingList, *Spellings[Index]);
870 OS << " ||\n SpellingListIndex == ";
872 OS << "; }\n";
880 void EmitClangAttrClass(RecordKeeper &Records, raw_ostream &OS) {
881 emitSourceFileHeader("Attribute classes' definitions", OS);
883 OS << "#ifndef LLVM_CLANG_ATTR_CLASSES_INC\n";
884 OS << "#define LLVM_CLANG_ATTR_CLASSES_INC\n\n";
897 OS << "class " << R.getName() << "Attr : public " << SuperName << " {\n";
912 Arg->writeDeclarations(OS);
913 OS << "\n\n";
918 OS << "\n public:\n";
919 OS << " " << R.getName() << "Attr(SourceRange R, ASTContext &Ctx\n";
922 OS << " , ";
923 (*ai)->writeCtorParameters(OS);
924 OS << "\n";
927 OS << " , ";
928 OS << "unsigned SI = 0\n";
930 OS << " )\n";
931 OS << " : " << SuperName << "(attr::" << R.getName() << ", R, SI)\n";
934 OS << " , ";
935 (*ai)->writeCtorInitializers(OS);
936 OS << "\n";
939 OS << " {\n";
942 (*ai)->writeCtorBody(OS);
943 OS << "\n";
945 OS << " }\n\n";
947 OS << " virtual " << R.getName() << "Attr *clone (ASTContext &C) const;\n";
948 OS << " virtual void printPretty(raw_ostream &OS,\n"
951 writeAttrAccessorDefinition(R, OS);
954 (*ai)->writeAccessors(OS);
955 OS << "\n\n";
958 OS << R.getValueAsString("AdditionalMembers");
959 OS << "\n\n";
961 OS << " static bool classof(const Attr *A) { return A->getKind() == "
965 OS << " virtual bool isLateParsed() const { return "
968 OS << "};\n\n";
971 OS << "#endif\n";
975 void EmitClangAttrImpl(RecordKeeper &Records, raw_ostream &OS) {
976 emitSourceFileHeader("Attribute classes' member function definitions", OS);
994 (*ai)->writeAccessorDefinitions(OS);
996 OS << R.getName() << "Attr *" << R.getName()
998 OS << " return new (C) " << R.getName() << "Attr(getLocation(), C";
1000 OS << ", ";
1001 (*ai)->writeCloneArgs(OS);
1003 OS << ", getSpellingListIndex());\n}\n\n";
1005 writePrettyPrintFunction(R, Args, OS);
1011 static void EmitAttrList(raw_ostream &OS, StringRef Class,
1021 OS << Class << "(" << (*i)->getName() << ")\n";
1024 OS << "LAST_" << Class << "(" << (*i)->getName() << ")\n\n";
1031 void EmitClangAttrList(RecordKeeper &Records, raw_ostream &OS) {
1032 emitSourceFileHeader("List of all attributes that Clang recognizes", OS);
1034 OS << "#ifndef LAST_ATTR\n";
1035 OS << "#define LAST_ATTR(NAME) ATTR(NAME)\n";
1036 OS << "#endif\n\n";
1038 OS << "#ifndef INHERITABLE_ATTR\n";
1039 OS << "#define INHERITABLE_ATTR(NAME) ATTR(NAME)\n";
1040 OS << "#endif\n\n";
1042 OS << "#ifndef LAST_INHERITABLE_ATTR\n";
1043 OS << "#define LAST_INHERITABLE_ATTR(NAME) INHERITABLE_ATTR(NAME)\n";
1044 OS << "#endif\n\n";
1046 OS << "#ifndef INHERITABLE_PARAM_ATTR\n";
1047 OS << "#define INHERITABLE_PARAM_ATTR(NAME) ATTR(NAME)\n";
1048 OS << "#endif\n\n";
1050 OS << "#ifndef LAST_INHERITABLE_PARAM_ATTR\n";
1051 OS << "#define LAST_INHERITABLE_PARAM_ATTR(NAME)"
1053 OS << "#endif\n\n";
1072 EmitAttrList(OS, "INHERITABLE_PARAM_ATTR", InhParamAttrs);
1073 EmitAttrList(OS, "INHERITABLE_ATTR", InhAttrs);
1074 EmitAttrList(OS, "ATTR", NonInhAttrs);
1076 OS << "#undef LAST_ATTR\n";
1077 OS << "#undef INHERITABLE_ATTR\n";
1078 OS << "#undef LAST_INHERITABLE_ATTR\n";
1079 OS << "#undef LAST_INHERITABLE_PARAM_ATTR\n";
1080 OS << "#undef ATTR\n";
1084 void EmitClangAttrPCHRead(RecordKeeper &Records, raw_ostream &OS) {
1085 emitSourceFileHeader("Attribute deserialization code", OS);
1094 OS << " switch (Kind) {\n";
1095 OS << " default:\n";
1096 OS << " assert(0 && \"Unknown attribute!\");\n";
1097 OS << " break;\n";
1103 OS << " case attr::" << R.getName() << ": {\n";
1105 OS << " bool isInherited = Record[Idx++];\n";
1111 A->writePCHReadDecls(OS);
1113 OS << " New = new (Context) " << R.getName() << "Attr(Range, Context";
1115 OS << ", ";
1116 (*ri)->writePCHReadArgs(OS);
1118 OS << ");\n";
1120 OS << " cast<InheritableAttr>(New)->setInherited(isInherited);\n";
1121 OS << " break;\n";
1122 OS << " }\n";
1124 OS << " }\n";
1128 void EmitClangAttrPCHWrite(RecordKeeper &Records, raw_ostream &OS) {
1129 emitSourceFileHeader("Attribute serialization code", OS);
1135 OS << " switch (A->getKind()) {\n";
1136 OS << " default:\n";
1137 OS << " llvm_unreachable(\"Unknown attribute kind!\");\n";
1138 OS << " break;\n";
1143 OS << " case attr::" << R.getName() << ": {\n";
1146 OS << " const " << R.getName() << "Attr *SA = cast<" << R.getName()
1149 OS << " Record.push_back(SA->isInherited());\n";
1151 createArgument(**ai, R.getName())->writePCHWrite(OS);
1152 OS << " break;\n";
1153 OS << " }\n";
1155 OS << " }\n";
1159 void EmitClangAttrSpellingList(RecordKeeper &Records, raw_ostream &OS) {
1161 OS);
1171 OS << ".Case(\"" << (*I)->getValueAsString("Name") << "\", true)\n";
1177 void EmitClangAttrSpellingListIndex(RecordKeeper &Records, raw_ostream &OS) {
1179 "into internal identifiers", OS);
1181 OS <<
1201 OS <<
1207 OS << " case AT_" << R.getName() << " : {\n";
1215 OS << " if (Name == \""
1228 OS << " break;\n";
1229 OS << " }\n";
1233 OS << " }\n";
1234 OS << " return Index;\n";
1238 void EmitClangAttrLateParsedList(RecordKeeper &Records, raw_ostream &OS) {
1240 "attributes", OS);
1259 OS << ".Case(\"" << (*I)->getValueAsString("Name") << "\", "
1267 void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
1268 emitSourceFileHeader("Template instantiation code for attributes", OS);
1272 OS << "namespace clang {\n"
1287 OS << " case attr::" << R.getName() << ": {\n";
1291 OS << " return NULL;\n";
1292 OS << " }\n";
1296 OS << " const " << R.getName() << "Attr *A = cast<"
1301 OS << " return A->clone(C);\n";
1302 OS << " }\n";
1322 (*ai)->writeTemplateInstantiation(OS);
1324 OS << " return new (C) " << R.getName() << "Attr(A->getLocation(), C";
1326 OS << ", ";
1327 (*ai)->writeTemplateInstantiationArgs(OS);
1329 OS << ");\n }\n";
1331 OS << " } // end switch\n"
1340 void EmitClangAttrParsedAttrList(RecordKeeper &Records, raw_ostream &OS) {
1341 emitSourceFileHeader("List of all attributes that Clang recognizes", OS);
1343 OS << "#ifndef PARSED_ATTR\n";
1344 OS << "#define PARSED_ATTR(NAME) NAME\n";
1345 OS << "#endif\n\n";
1366 OS << "PARSED_ATTR(" << Spelling << ")\n";
1371 OS << "PARSED_ATTR(" << AttrName << ")\n";
1378 void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
1379 emitSourceFileHeader("Attribute name matcher", OS);
1422 OS << "static AttributeList::Kind getAttrKind(StringRef Name) {\n";
1423 StringMatcher("Name", Matches, OS).Emit();
1424 OS << "return AttributeList::UnknownAttribute;\n"
1429 void EmitClangAttrDump(RecordKeeper &Records, raw_ostream &OS) {
1430 emitSourceFileHeader("Attribute dumper", OS);
1432 OS <<
1443 OS << " case attr::" << R.getName() << ": {\n";
1446 OS << " const " << R.getName() << "Attr *SA = cast<" << R.getName()
1450 createArgument(**I, R.getName())->writeDump(OS);
1453 OS << " bool OldMoreChildren = hasMoreChildren();\n";
1454 OS << " bool MoreChildren = OldMoreChildren;\n";
1459 OS << " MoreChildren = OldMoreChildren";
1461 OS << " || ";
1462 createArgument(**Next, R.getName())->writeHasChildren(OS);
1464 OS << ";\n";
1465 OS << " setMoreChildren(MoreChildren);\n";
1467 createArgument(**I, R.getName())->writeDumpChildren(OS);
1471 OS << " setMoreChildren(OldMoreChildren);\n";
1473 OS <<
1477 OS << " }\n";