Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Kotas <jkotas@microsoft.com>2018-03-02 12:00:46 +0300
committerJan Kotas <jkotas@microsoft.com>2018-03-02 12:32:21 +0300
commitfb52cf9bd5edca3077073efbed138ddf211017a3 (patch)
treef2ec8c54d6da577d03d53e170904bbf873357238
parentabb0ce0bcb01064161f0aaf7a60eb7458d77d452 (diff)
CppCodeGen workaround
-rw-r--r--src/ILCompiler.CppCodeGen/src/CppCodeGen/CppWriter.cs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/ILCompiler.CppCodeGen/src/CppCodeGen/CppWriter.cs b/src/ILCompiler.CppCodeGen/src/CppCodeGen/CppWriter.cs
index be4301303..ef08550b7 100644
--- a/src/ILCompiler.CppCodeGen/src/CppCodeGen/CppWriter.cs
+++ b/src/ILCompiler.CppCodeGen/src/CppCodeGen/CppWriter.cs
@@ -316,7 +316,13 @@ namespace ILCompiler.CppCodeGen
public string GetCppFieldName(FieldDesc field)
{
- return _compilation.NameMangler.GetMangledFieldName(field).ToString();
+ string name = _compilation.NameMangler.GetMangledFieldName(field).ToString();
+
+ // TODO: name mangling robustness
+ if (name == "register")
+ name = "_" + name + "_";
+
+ return name;
}
public string GetCppStaticFieldName(FieldDesc field)
@@ -329,7 +335,7 @@ namespace ILCompiler.CppCodeGen
public string SanitizeCppVarName(string varName)
{
// TODO: name mangling robustness
- if (varName == "errno" || varName == "environ" || varName == "template" || varName == "typename") // some names collide with CRT headers
+ if (varName == "errno" || varName == "environ" || varName == "template" || varName == "typename" || varName == "register") // some names collide with CRT headers
return "_" + varName + "_";
return _compilation.NameMangler.SanitizeName(varName);