This is an archive of the discontinued LLVM Phabricator instance.

When generating C++ code, use C++ string escaping.
ClosedPublic

Authored by matthiaskramm on Oct 25 2021, 10:14 AM.

Diff Detail

Event Timeline

matthiaskramm created this revision.Oct 25 2021, 10:14 AM
matthiaskramm requested review of this revision.Oct 25 2021, 10:14 AM

Could you add a test where this difference let to a bug that could be used for regression testing?

I also see similar method used here and there across the codebase. Might be good to expose this as a utility method and reuse.

Yeah, I agree. You can probably move this to mlir/TableGen/CodeGenHelpers.h and unify it with the other version in RewriterGen.cpp.

Thanks for the quick review!

Moved escapeString() into CodeGenHelpers.cpp, and added a test.

Adjust commit description.

Mogball requested changes to this revision.Oct 25 2021, 2:44 PM
Mogball added inline comments.
mlir/tools/mlir-tblgen/CodeGenHelpers.cpp
141–149

Function definitions shouldn't be enclosed in namespaces.

This revision now requires changes to proceed.Oct 25 2021, 2:44 PM

Fold namespaces into prototype.

Make opL test case slightly more realistic.

Mogball accepted this revision.Oct 25 2021, 3:52 PM

Thanks

This revision is now accepted and ready to land.Oct 25 2021, 3:52 PM
This revision was automatically updated to reflect the committed changes.