@@ -2451,19 +2451,26 @@ void EmitClangAttrASTVisitor(RecordKeeper &Records, raw_ostream &OS) {
2451
2451
OS << "#endif // ATTR_VISITOR_DECLS_ONLY\n";
2452
2452
}
2453
2453
2454
- void EmitClangAttrTemplateInstantiateHelper(const std::vector<Record *> &Attrs,
2455
- raw_ostream &OS,
2456
- bool AppliesToDecl) {
2454
+ // Emits code to instantiate dependent attributes on templates.
2455
+ void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
2456
+ emitSourceFileHeader("Template instantiation code for attributes", OS);
2457
+
2458
+ std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
2459
+
2460
+ OS << "namespace clang {\n"
2461
+ << "namespace sema {\n\n"
2462
+ << "Attr *instantiateTemplateAttribute(const Attr *At, ASTContext &C, "
2463
+ << "Sema &S,\n"
2464
+ << " const MultiLevelTemplateArgumentList &TemplateArgs) {\n"
2465
+ << " switch (At->getKind()) {\n";
2457
2466
2458
- OS << " switch (At->getKind()) {\n";
2459
2467
for (const auto *Attr : Attrs) {
2460
2468
const Record &R = *Attr;
2461
2469
if (!R.getValueAsBit("ASTNode"))
2462
2470
continue;
2471
+
2463
2472
OS << " case attr::" << R.getName() << ": {\n";
2464
- bool ShouldClone = R.getValueAsBit("Clone") &&
2465
- (!AppliesToDecl ||
2466
- R.getValueAsBit("MeaningfulToClassTemplateDefinition"));
2473
+ bool ShouldClone = R.getValueAsBit("Clone");
2467
2474
2468
2475
if (!ShouldClone) {
2469
2476
OS << " return nullptr;\n";
@@ -2500,27 +2507,8 @@ void EmitClangAttrTemplateInstantiateHelper(const std::vector<Record *> &Attrs,
2500
2507
}
2501
2508
OS << " } // end switch\n"
2502
2509
<< " llvm_unreachable(\"Unknown attribute!\");\n"
2503
- << " return nullptr;\n";
2504
- }
2505
-
2506
- // Emits code to instantiate dependent attributes on templates.
2507
- void EmitClangAttrTemplateInstantiate(RecordKeeper &Records, raw_ostream &OS) {
2508
- emitSourceFileHeader("Template instantiation code for attributes", OS);
2509
-
2510
- std::vector<Record*> Attrs = Records.getAllDerivedDefinitions("Attr");
2511
-
2512
- OS << "namespace clang {\n"
2513
- << "namespace sema {\n\n"
2514
- << "Attr *instantiateTemplateAttribute(const Attr *At, ASTContext &C, "
2515
- << "Sema &S,\n"
2516
- << " const MultiLevelTemplateArgumentList &TemplateArgs) {\n";
2517
- EmitClangAttrTemplateInstantiateHelper(Attrs, OS, /*AppliesToDecl*/false);
2518
- OS << "}\n\n"
2519
- << "Attr *instantiateTemplateAttributeForDecl(const Attr *At,\n"
2520
- << " ASTContext &C, Sema &S,\n"
2521
- << " const MultiLevelTemplateArgumentList &TemplateArgs) {\n";
2522
- EmitClangAttrTemplateInstantiateHelper(Attrs, OS, /*AppliesToDecl*/true);
2523
- OS << "}\n\n"
2510
+ << " return nullptr;\n"
2511
+ << "}\n\n"
2524
2512
<< "} // end namespace sema\n"
2525
2513
<< "} // end namespace clang\n";
2526
2514
}
0 commit comments