[Lldb-commits] [lldb] r267842 - Fix an inefficiency in the handling of $__lldb_local_vars in expressions.
Jim Ingham via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 27 19:17:02 PDT 2016
Author: jingham
Date: Wed Apr 27 21:17:02 2016
New Revision: 267842
URL: http://llvm.org/viewvc/llvm-project?rev=267842&view=rev
Log:
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>
Modified:
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.h?rev=267842&r1=267841&r2=267842&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.h (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangASTSource.h Wed Apr 27 21:17:02 2016
@@ -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;
//------------------------------------------------------------------
Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp?rev=267842&r1=267841&r2=267842&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp Wed Apr 27 21:17:02 2016
@@ -866,7 +866,7 @@ ClangExpressionDeclMap::FindExternalVisi
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::FindExternalVisi
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;
}
}
}
More information about the lldb-commits
mailing list