Fix an inefficiency in the handling of $__lldb_local_vars in expressions.
The code in ClangExpressionDeclMap::FindExternalVisibleDecls figures out what the token
means, and adds the namespace to the lookup context, but since it doesn't mark it as
special in the search context, we go on to pass the name $__lldb_local_vars to the ASTSource
for further lookup. Unless we've done our job wrong, those lookups will always fail, but
the can be costly.
So I added a bit to m_found & use that to short-circuit the lookup.
<rdar://problem/25613384>
llvm-svn: 267842
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
index bb63847..653675e 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
@@ -430,6 +430,7 @@
bool variable : 1;
bool function_with_type_info : 1;
bool function : 1;
+ bool local_vars_nsp : 1;
} m_found;
//------------------------------------------------------------------
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 556b273..4b39863 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -866,7 +866,7 @@
current_id);
}
- if (!context.m_found.variable)
+ if (!context.m_found.variable && !context.m_found.local_vars_nsp)
ClangASTSource::FindExternalVisibleDecls(context);
}
@@ -1199,6 +1199,7 @@
context.AddNamedDecl(namespace_decl);
clang::DeclContext *clang_decl_ctx = clang::Decl::castToDeclContext(namespace_decl);
clang_decl_ctx->setHasExternalVisibleStorage(true);
+ context.m_found.local_vars_nsp = true;
}
}
}