Added code to support use of "this" and "self" in
expressions. This involved three main changes:
- In ClangUserExpression::ClangUserExpression(),
we now insert the following lines into the
expression:
#define this ___clang_this
#define self ___clang_self
- In ClangExpressionDeclMap::GetDecls(), we
special-case ___clang_(this|self) and instead
look up "this" or "self"
- In ClangASTSource, we introduce the capability
to generate Decls with a different, overridden,
name from the one that was requested, e.g.
this for ___clang_this.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@113866 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Expression/ClangUserExpression.cpp b/source/Expression/ClangUserExpression.cpp
index 4e49c48..6b37656 100644
--- a/source/Expression/ClangUserExpression.cpp
+++ b/source/Expression/ClangUserExpression.cpp
@@ -38,7 +38,13 @@
{
StreamString m_transformed_stream;
- m_transformed_stream.Printf("extern \"C\" void %s(void *___clang_arg) { %s; }\n",
+ m_transformed_stream.Printf("#define this ___clang_this \n"
+ "#define self ___clang_self \n"
+ "extern \"C\" void \n"
+ "%s(void *___clang_arg) \n"
+ "{ \n"
+ "%s; \n"
+ "} \n",
FunctionName(),
m_expr_text.c_str());