summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangASTSource.cpp
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2010-09-14 21:59:34 +0000
committerSean Callanan <scallanan@apple.com>2010-09-14 21:59:34 +0000
commit44096b1a7e04ef2aa2e24db9360b843bff88a33c (patch)
treef3134d39a9b9c0c84e57efdd11305f1f3f358471 /lldb/source/Expression/ClangASTSource.cpp
parent86ac3fc9af774b49ed51a446830e5c4382bc8199 (diff)
downloadbcm5719-llvm-44096b1a7e04ef2aa2e24db9360b843bff88a33c.tar.gz
bcm5719-llvm-44096b1a7e04ef2aa2e24db9360b843bff88a33c.zip
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. llvm-svn: 113866
Diffstat (limited to 'lldb/source/Expression/ClangASTSource.cpp')
-rw-r--r--lldb/source/Expression/ClangASTSource.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/lldb/source/Expression/ClangASTSource.cpp b/lldb/source/Expression/ClangASTSource.cpp
index 7176cbef76f..299524b144f 100644
--- a/lldb/source/Expression/ClangASTSource.cpp
+++ b/lldb/source/Expression/ClangASTSource.cpp
@@ -85,11 +85,20 @@ clang::ASTContext *NameSearchContext::GetASTContext() {
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,
OpenPOWER on IntegriCloud