Skip to content

Commit

Permalink
Use UTF8 literals for single characters too
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulusParssinen committed May 11, 2024
1 parent 00d4e54 commit 8a97513
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 17 deletions.
7 changes: 0 additions & 7 deletions src/coreclr/tools/Common/Internal/Text/Utf8StringBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ public Utf8StringBuilder Append(ReadOnlySpan<byte> value)
return this;
}

public Utf8StringBuilder Append(byte value)
{
Ensure(1);
_buffer[_length++] = value;
return this;
}

public Utf8StringBuilder Append(string value)
{
int length = Encoding.UTF8.GetByteCount(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)

foreach (TypeDesc instArg in _details)
{
sb.Append((byte)'_');
sb.Append("_"u8);
sb.Append(nameMangler.GetMangledTypeName(instArg));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)

for (int i = 0; i < _details.Variance.Length; i++)
{
sb.Append((byte)'_');
sb.Append("_"u8);
sb.Append((checked((byte)_details.Variance[i])).ToStringInvariant());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)

if (_callSiteIdentifier != null)
{
sb.Append((byte)'_');
sb.Append("_"u8);
_callSiteIdentifier.AppendMangledName(nameMangler, sb);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ public int CompareTo(PInvokeModuleData other, CompilerComparer comparer)
public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb)
{
sb.Append(nameMangler.GetMangledTypeName(DeclaringModule.GetGlobalModuleType()));
sb.Append((byte)'_');
sb.Append("_"u8);
sb.Append(nameMangler.SanitizeName(ModuleName));
if (DllImportSearchPath.HasValue)
{
sb.Append((byte)'_');
sb.Append("_"u8);
sb.Append(((int)DllImportSearchPath.Value).ToString());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,26 +55,26 @@ private void WriteCie(DwarfCie cie)

if (cie.FdesHaveAugmentationData)
{
augmentationString.Append((byte)'z');
augmentationString.Append("z"u8);
}
if (cie.PersonalitySymbolName != null)
{
augmentationString.Append((byte)'P');
augmentationString.Append("P"u8);
augmentationLength += 1u + AddressSize(cie.PersonalityEncoding);
}
if (cie.LsdaEncoding != 0)
{
augmentationString.Append((byte)'L');
augmentationString.Append("L"u8);
augmentationLength++;
}
if (cie.PointerEncoding != 0)
{
augmentationString.Append((byte)'R');
augmentationString.Append("R"u8);
augmentationLength++;
}
if (cie.IsSignalFrame)
{
augmentationString.Append((byte)'S');
augmentationString.Append("S"u8);
}

uint length =
Expand Down

0 comments on commit 8a97513

Please sign in to comment.