Skip to content

Commit a7f62b5

Browse files
committed
Handle C++ const, volatile and references
1 parent ed6541f commit a7f62b5

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

solution/GraphicalDebugging/ExpressionLoader.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,11 @@ public Loader FindByType(IKindConstraint kindConstraint, string name, string typ
479479
: language == "Basic" ? Instance.loadersCacheBasic
480480
: null;
481481

482+
if (language == "C++")
483+
{
484+
type = Util.CppRemoveCVRef(type);
485+
}
486+
482487
if (loadersCache != null)
483488
{
484489
Loader loader = loadersCache.Find(type, kindConstraint);

solution/GraphicalDebugging/Util.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,19 @@ public static string CppNormalizeType(string type)
134134
return result;
135135
}
136136

137+
public static string CppRemoveCVRef(string type)
138+
{
139+
if (type.StartsWith("const "))
140+
type = type.Remove(0, 6);
141+
if (type.StartsWith("volatile "))
142+
type = type.Remove(0, 9);
143+
if (type.EndsWith(" const"))
144+
type = type.Remove(type.Length - 6);
145+
if (type.EndsWith(" &"))
146+
type = type.Remove(type.Length - 2);
147+
return type;
148+
}
149+
137150
// TODO: Basic generic parameters
138151
public static List<string> TypesList(string type,
139152
char begCh = '<',

0 commit comments

Comments
 (0)