diff options
author | Jim Ingham <jingham@apple.com> | 2016-04-28 02:17:02 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2016-04-28 02:17:02 +0000 |
commit | deb384d10313dd10f02373c569b94e9d381fb508 (patch) | |
tree | 39e6b6946fa18b6f469b932d5f9a2cd7bcb2ca92 | |
parent | d016c3e3a0cd1a5709ea180ab11bff9937c7a81c (diff) | |
download | bcm5719-llvm-deb384d10313dd10f02373c569b94e9d381fb508.tar.gz bcm5719-llvm-deb384d10313dd10f02373c569b94e9d381fb508.zip |
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
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h | 1 | ||||
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h index bb6384721f5..653675eb99d 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangASTSource.h @@ -430,6 +430,7 @@ struct NameSearchContext { 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 556b27348e5..4b398631fd4 100644 --- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp +++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp @@ -866,7 +866,7 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context) 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 @@ ClangExpressionDeclMap::FindExternalVisibleDecls (NameSearchContext &context, 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; } } } |