[Lldb-commits] [lldb] r117247 - /lldb/trunk/source/Expression/ClangUserExpression.cpp

Sean Callanan scallanan at apple.com
Sun Oct 24 13:45:49 PDT 2010


Author: spyffe
Date: Sun Oct 24 15:45:49 2010
New Revision: 117247

URL: http://llvm.org/viewvc/llvm-project?rev=117247&view=rev
Log:
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.

Modified:
    lldb/trunk/source/Expression/ClangUserExpression.cpp

Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=117247&r1=117246&r2=117247&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Sun Oct 24 15:45:49 2010
@@ -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)
     {





More information about the lldb-commits mailing list