diff options
author | 2011-05-03 21:19:35 -0700 | |
---|---|---|
committer | 2011-05-03 21:19:35 -0700 | |
commit | ca798721a6b6dff5b4948f0650d0292ab8ef3d69 (patch) | |
tree | 096e087a286adac4b3617a126cc931407d3fd7a0 | |
parent | e1376a171abad9fca388a302781e59b404e8c515 (diff) |
Uniquified constant names generated for string literals
Also did some more substitutions to get valid Boogie identifiers
-rw-r--r-- | BCT/BytecodeTranslator/Sink.cs | 2 | ||||
-rw-r--r-- | BCT/BytecodeTranslator/TranslationHelper.cs | 16 |
2 files changed, 3 insertions, 15 deletions
diff --git a/BCT/BytecodeTranslator/Sink.cs b/BCT/BytecodeTranslator/Sink.cs index 6468f0fd..5ba8ab03 100644 --- a/BCT/BytecodeTranslator/Sink.cs +++ b/BCT/BytecodeTranslator/Sink.cs @@ -217,7 +217,7 @@ namespace BytecodeTranslator { if (!this.declaredStringConstants.TryGetValue(str, out c)) {
var tok = Bpl.Token.NoToken;
var t = Heap.RefType;
- var name = "$string_literal_" + TranslationHelper.TurnStringIntoValidIdentifier(str);
+ var name = "$string_literal_" + TranslationHelper.TurnStringIntoValidIdentifier(str) + "_" + declaredStringConstants.Count;
var tident = new Bpl.TypedIdent(tok, name, t);
c = new Bpl.Constant(tok, tident, true);
this.declaredStringConstants.Add(str, c);
diff --git a/BCT/BytecodeTranslator/TranslationHelper.cs b/BCT/BytecodeTranslator/TranslationHelper.cs index 66be116e..6305496e 100644 --- a/BCT/BytecodeTranslator/TranslationHelper.cs +++ b/BCT/BytecodeTranslator/TranslationHelper.cs @@ -88,20 +88,6 @@ namespace BytecodeTranslator { public static string CreateUniqueMethodName(IMethodReference method) {
var containingTypeName = TypeHelper.GetTypeName(method.ContainingType, NameFormattingOptions.None);
- /*
- if (containingTypeName == "Poirot.Poirot")
- {
- string name = method.Name.Value;
- if (name == "BeginAtomic")
- return "corral_atomic_begin";
- else if (name == "EndAtomic")
- return "corral_atomic_end";
- else if (name == "CurrentThreadId")
- return "corral_getThreadID";
- else if (name == "Nondet_int" || name == "Nondet_string")
- return "poirot_nondet";
- }
- */
var s = MemberHelper.GetMethodSignature(method, NameFormattingOptions.DocumentationId);
s = s.Substring(2);
s = s.TrimEnd(')');
@@ -114,6 +100,8 @@ namespace BytecodeTranslator { s = s.Replace("[0:,0:,0:]", "3DArray");
s = s.Replace("[0:,0:,0:,0:]", "4DArray");
s = s.Replace("[0:,0:,0:,0:,0:]", "5DArray");
+ s = s.Replace('!', '$');
+ s = s.Replace('*', '$');
s = s.Replace('(', '$');
s = s.Replace(')', '$');
s = s.Replace(',', '$');
|