summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangUserExpression.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-10-24 20:45:49 +0000
committerSean Callanan <scallanan@apple.com>2010-10-24 20:45:49 +0000
commit64186e7faa4cd22f62c0492a6dd4d1e48cd41822 (patch)
treeba0f00a642ac23067cda76ee3090c45a5abf9da2 /lldb/source/Expression/ClangUserExpression.cpp
parentc7932d3ac6e3a59d8a6ba9d9b765218848a7cc11 (diff)
downloadbcm5719-llvm-64186e7faa4cd22f62c0492a6dd4d1e48cd41822.tar.gz
bcm5719-llvm-64186e7faa4cd22f62c0492a6dd4d1e48cd41822.zip
Added a hack so that "unichar" is resolved to
"unsigned short." As discussed in the comments, this is pending a better solution to the problem of types not in the debug information but readily available through headers. llvm-svn: 117247
Diffstat (limited to 'lldb/source/Expression/ClangUserExpression.cpp')
-rw-r--r--lldb/source/Expression/ClangUserExpression.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/lldb/source/Expression/ClangUserExpression.cpp b/lldb/source/Expression/ClangUserExpression.cpp
index d2b35bae912..59b54e1a960 100644
--- a/lldb/source/Expression/ClangUserExpression.cpp
+++ b/lldb/source/Expression/ClangUserExpression.cpp
@@ -91,6 +91,26 @@ ApplyObjcCastHack(std::string &expr)
#undef OBJC_CAST_HACK_FROM
}
+// Another hack, meant to allow use of unichar despite it not being available in
+// the type information. Although we could special-case it in type lookup,
+// hopefully we'll figure out a way to #include the same environment as is
+// present in the original source file rather than try to hack specific type
+// definitions in as needed.
+static void
+ApplyUnicharHack(std::string &expr)
+{
+#define UNICHAR_HACK_FROM "unichar"
+#define UNICHAR_HACK_TO "unsigned short"
+
+ size_t from_offset;
+
+ while ((from_offset = expr.find(UNICHAR_HACK_FROM)) != expr.npos)
+ expr.replace(from_offset, sizeof(UNICHAR_HACK_FROM) - 1, UNICHAR_HACK_TO);
+
+#undef UNICHAR_HACK_TO
+#undef UNICHAR_HACK_FROM
+}
+
bool
ClangUserExpression::Parse (Stream &error_stream, ExecutionContext &exe_ctx)
{
@@ -105,6 +125,7 @@ ClangUserExpression::Parse (Stream &error_stream, ExecutionContext &exe_ctx)
//
ApplyObjcCastHack(m_expr_text);
+ ApplyUnicharHack(m_expr_text);
if (m_cplusplus)
{
OpenPOWER on IntegriCloud