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/ClangASTSource.cpp b/source/Expression/ClangASTSource.cpp
index 7176cbe..299524b 100644
--- a/source/Expression/ClangASTSource.cpp
+++ b/source/Expression/ClangASTSource.cpp
@@ -85,11 +85,20 @@
return &ASTSource.Context;
}
-clang::NamedDecl *NameSearchContext::AddVarDecl(void *type) {
+clang::NamedDecl *NameSearchContext::AddVarDecl(void *type,
+ const char *override_name) {
+ IdentifierInfo *ii = NULL;
+
+ if (override_name)
+ ii = &ASTSource.Context.Idents.get(override_name);
+ else
+ ii = Name.getAsIdentifierInfo();
+
+
clang::NamedDecl *Decl = VarDecl::Create(ASTSource.Context,
const_cast<DeclContext*>(DC),
SourceLocation(),
- Name.getAsIdentifierInfo(),
+ ii,
QualType::getFromOpaquePtr(type),
0,
VarDecl::Static,