@@ -42,10 +42,10 @@ static raw_ostream &emitCPPType(StringRef type, raw_ostream &os) {
4242// / Emit the method name and argument list for the given method. If 'addThisArg'
4343// / is true, then an argument is added to the beginning of the argument list for
4444// / the concrete value.
45- static void emitMethodNameAndArgs (const InterfaceMethod &method,
45+ static void emitMethodNameAndArgs (const InterfaceMethod &method, StringRef name,
4646 raw_ostream &os, StringRef valueType,
4747 bool addThisArg, bool addConst) {
48- os << method. getName () << ' (' ;
48+ os << name << ' (' ;
4949 if (addThisArg) {
5050 if (addConst)
5151 os << " const " ;
@@ -183,11 +183,13 @@ static void emitInterfaceDefMethods(StringRef interfaceQualName,
183183 emitInterfaceMethodDoc (method, os);
184184 emitCPPType (method.getReturnType (), os);
185185 os << interfaceQualName << " ::" ;
186- emitMethodNameAndArgs (method, os, valueType, /* addThisArg=*/ false ,
186+ emitMethodNameAndArgs (method, method.getName (), os, valueType,
187+ /* addThisArg=*/ false ,
187188 /* addConst=*/ !isOpInterface);
188189
189190 // Forward to the method on the concrete operation type.
190- os << " {\n return " << implValue << " ->" << method.getName () << ' (' ;
191+ os << " {\n return " << implValue << " ->" << method.getUniqueName ()
192+ << ' (' ;
191193 if (!method.isStatic ()) {
192194 os << implValue << " , " ;
193195 os << (isOpInterface ? " getOperation()" : " *this" );
@@ -239,7 +241,7 @@ void InterfaceGenerator::emitConceptDecl(const Interface &interface) {
239241 for (auto &method : interface.getMethods ()) {
240242 os << " " ;
241243 emitCPPType (method.getReturnType (), os);
242- os << " (*" << method.getName () << " )(" ;
244+ os << " (*" << method.getUniqueName () << " )(" ;
243245 if (!method.isStatic ()) {
244246 os << " const Concept *impl, " ;
245247 emitCPPType (valueType, os) << (method.arg_empty () ? " " : " , " );
@@ -289,13 +291,13 @@ void InterfaceGenerator::emitModelDecl(const Interface &interface) {
289291 os << " " << modelClass << " () : Concept{" ;
290292 llvm::interleaveComma (
291293 interface.getMethods (), os,
292- [&](const InterfaceMethod &method) { os << method.getName (); });
294+ [&](const InterfaceMethod &method) { os << method.getUniqueName (); });
293295 os << " } {}\n\n " ;
294296
295297 // Insert each of the virtual method overrides.
296298 for (auto &method : interface.getMethods ()) {
297299 emitCPPType (method.getReturnType (), os << " static inline " );
298- emitMethodNameAndArgs (method, os, valueType,
300+ emitMethodNameAndArgs (method, method. getUniqueName (), os, valueType,
299301 /* addThisArg=*/ !method.isStatic (),
300302 /* addConst=*/ false );
301303 os << " ;\n " ;
@@ -319,7 +321,7 @@ void InterfaceGenerator::emitModelDecl(const Interface &interface) {
319321 if (method.isStatic ())
320322 os << " static " ;
321323 emitCPPType (method.getReturnType (), os);
322- os << method.getName () << " (" ;
324+ os << method.getUniqueName () << " (" ;
323325 if (!method.isStatic ()) {
324326 emitCPPType (valueType, os);
325327 os << " tablegen_opaque_val" ;
@@ -350,7 +352,7 @@ void InterfaceGenerator::emitModelMethodsDef(const Interface &interface) {
350352 emitCPPType (method.getReturnType (), os);
351353 os << " detail::" << interface.getName () << " InterfaceTraits::Model<"
352354 << valueTemplate << " >::" ;
353- emitMethodNameAndArgs (method, os, valueType,
355+ emitMethodNameAndArgs (method, method. getUniqueName (), os, valueType,
354356 /* addThisArg=*/ !method.isStatic (),
355357 /* addConst=*/ false );
356358 os << " {\n " ;
@@ -384,7 +386,7 @@ void InterfaceGenerator::emitModelMethodsDef(const Interface &interface) {
384386 emitCPPType (method.getReturnType (), os);
385387 os << " detail::" << interface.getName () << " InterfaceTraits::FallbackModel<"
386388 << valueTemplate << " >::" ;
387- emitMethodNameAndArgs (method, os, valueType,
389+ emitMethodNameAndArgs (method, method. getUniqueName (), os, valueType,
388390 /* addThisArg=*/ !method.isStatic (),
389391 /* addConst=*/ false );
390392 os << " {\n " ;
@@ -396,7 +398,7 @@ void InterfaceGenerator::emitModelMethodsDef(const Interface &interface) {
396398 os << " return static_cast<const " << valueTemplate << " *>(impl)->" ;
397399
398400 // Add the arguments to the call.
399- os << method.getName () << ' (' ;
401+ os << method.getUniqueName () << ' (' ;
400402 if (!method.isStatic ())
401403 os << " tablegen_opaque_val" << (method.arg_empty () ? " " : " , " );
402404 llvm::interleaveComma (
@@ -416,7 +418,7 @@ void InterfaceGenerator::emitModelMethodsDef(const Interface &interface) {
416418 << " InterfaceTraits::ExternalModel<ConcreteModel, " << valueTemplate
417419 << " >::" ;
418420
419- os << method.getName () << " (" ;
421+ os << method.getUniqueName () << " (" ;
420422 if (!method.isStatic ()) {
421423 emitCPPType (valueType, os);
422424 os << " tablegen_opaque_val" ;
@@ -477,7 +479,8 @@ void InterfaceGenerator::emitInterfaceTraitDecl(const Interface &interface) {
477479 emitInterfaceMethodDoc (method, os, " " );
478480 os << " " << (method.isStatic () ? " static " : " " );
479481 emitCPPType (method.getReturnType (), os);
480- emitMethodNameAndArgs (method, os, valueType, /* addThisArg=*/ false ,
482+ emitMethodNameAndArgs (method, method.getName (), os, valueType,
483+ /* addThisArg=*/ false ,
481484 /* addConst=*/ !isOpInterface && !method.isStatic ());
482485 os << " {\n " << tblgen::tgfmt (defaultImpl->trim (), &traitMethodFmt)
483486 << " \n }\n " ;
@@ -514,7 +517,8 @@ static void emitInterfaceDeclMethods(const Interface &interface,
514517 for (auto &method : interface.getMethods ()) {
515518 emitInterfaceMethodDoc (method, os, " " );
516519 emitCPPType (method.getReturnType (), os << " " );
517- emitMethodNameAndArgs (method, os, valueType, /* addThisArg=*/ false ,
520+ emitMethodNameAndArgs (method, method.getName (), os, valueType,
521+ /* addThisArg=*/ false ,
518522 /* addConst=*/ !isOpInterface);
519523 os << " ;\n " ;
520524 }
0 commit comments