Skip to content

Commit 298b73a

Browse files
Single quote must be escaped otherwise ''' is generated instead of '\'' which results in a compiler error (e.g.: CS1011, C1012, etc.). (#249)
1 parent f964eff commit 298b73a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sources/ClangSharp.PInvokeGenerator/PInvokeGenerator.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -664,10 +664,11 @@ private string EscapeAndStripName(string name)
664664
internal static string EscapeCharacter(char value) => EscapeString(value.ToString());
665665

666666
internal static string EscapeString(string value) => value.Replace("\\", "\\\\")
667-
.Replace("\r", "\\r")
668-
.Replace("\n", "\\n")
669-
.Replace("\t", "\\t")
670-
.Replace("\"", "\\\"");
667+
.Replace("\r", "\\r")
668+
.Replace("\n", "\\n")
669+
.Replace("\t", "\\t")
670+
.Replace("\"", "\\\"")
671+
.Replace("\'", "\\'");
671672

672673
private AccessSpecifier GetAccessSpecifier(NamedDecl namedDecl)
673674
{

0 commit comments

Comments
 (0)