@@ -195,7 +195,7 @@ class {0}Base : public {1} {
195195 }
196196 ::llvm::StringRef getArgument() const override { return "{2}"; }
197197
198- ::llvm::StringRef getDescription() const override { return " {3}"; }
198+ ::llvm::StringRef getDescription() const override { return R"PD( {3})PD "; }
199199
200200 /// Returns the derived pass name.
201201 static constexpr ::llvm::StringLiteral getPassName() {
@@ -271,9 +271,9 @@ static void emitPassOptionDecls(const Pass &pass, raw_ostream &os) {
271271 os.indent (2 ) << " ::mlir::Pass::"
272272 << (opt.isListOption () ? " ListOption" : " Option" );
273273
274- os << formatv (R"( <{0}> {1}{{*this, "{2}", ::llvm::cl::desc(" {3}"))" ,
274+ os << formatv (R"( <{0}> {1}{{*this, "{2}", ::llvm::cl::desc(R"PO( {3})PO "))" ,
275275 opt.getType (), opt.getCppVariableName (), opt.getArgument (),
276- opt.getDescription ());
276+ opt.getDescription (). trim () );
277277 if (std::optional<StringRef> defaultVal = opt.getDefaultValue ())
278278 os << " , ::llvm::cl::init(" << defaultVal << " )" ;
279279 if (std::optional<StringRef> additionalFlags = opt.getAdditionalFlags ())
@@ -285,9 +285,10 @@ static void emitPassOptionDecls(const Pass &pass, raw_ostream &os) {
285285// / Emit the declarations for each of the pass statistics.
286286static void emitPassStatisticDecls (const Pass &pass, raw_ostream &os) {
287287 for (const PassStatistic &stat : pass.getStatistics ()) {
288- os << formatv (" ::mlir::Pass::Statistic {0}{{this, \" {1}\" , \" {2}\" };\n " ,
289- stat.getCppVariableName (), stat.getName (),
290- stat.getDescription ());
288+ os << formatv (
289+ " ::mlir::Pass::Statistic {0}{{this, \" {1}\" , R\" PS({2})PS\" };\n " ,
290+ stat.getCppVariableName (), stat.getName (),
291+ stat.getDescription ().trim ());
291292 }
292293}
293294
@@ -320,7 +321,7 @@ static void emitPassDefs(const Pass &pass, raw_ostream &os) {
320321
321322 os << " namespace impl {\n " ;
322323 os << formatv (baseClassBegin, passName, pass.getBaseClass (),
323- pass.getArgument (), pass.getSummary (),
324+ pass.getArgument (), pass.getSummary (). trim () ,
324325 dependentDialectRegistrations);
325326
326327 if (ArrayRef<PassOption> options = pass.getOptions (); !options.empty ()) {
@@ -393,7 +394,7 @@ class {0}Base : public {1} {
393394 }
394395 ::llvm::StringRef getArgument() const override { return "{2}"; }
395396
396- ::llvm::StringRef getDescription() const override { return " {3}"; }
397+ ::llvm::StringRef getDescription() const override { return R"PD( {3})PD "; }
397398
398399 /// Returns the derived pass name.
399400 static constexpr ::llvm::StringLiteral getPassName() {
@@ -439,7 +440,7 @@ static void emitOldPassDecl(const Pass &pass, raw_ostream &os) {
439440 " \n " );
440441 }
441442 os << formatv (oldPassDeclBegin, defName, pass.getBaseClass (),
442- pass.getArgument (), pass.getSummary (),
443+ pass.getArgument (), pass.getSummary (). trim () ,
443444 dependentDialectRegistrations);
444445 emitPassOptionDecls (pass, os);
445446 emitPassStatisticDecls (pass, os);
0 commit comments