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.


git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@117247 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangUserExpression.cpp b/source/Expression/ClangUserExpression.cpp
index d2b35ba..59b54e1 100644
--- a/source/Expression/ClangUserExpression.cpp
+++ b/source/Expression/ClangUserExpression.cpp
@@ -91,6 +91,26 @@
 #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 @@
     //
     
     ApplyObjcCastHack(m_expr_text);
+    ApplyUnicharHack(m_expr_text);
 
     if (m_cplusplus)
     {