[Lldb-commits] [lldb] b6c29d9 - [lldb][NFC] Remove unused 'type' parameter in ClangExpressionDeclMap::FindGlobalVariable
Raphael Isemann via lldb-commits
lldb-commits at lists.llvm.org
Mon Dec 23 03:44:13 PST 2019
Author: Raphael Isemann
Date: 2019-12-23T12:43:47+01:00
New Revision: b6c29d9de027692cfe93a4f701cf49f1d5f99574
URL: https://github.com/llvm/llvm-project/commit/b6c29d9de027692cfe93a4f701cf49f1d5f99574
DIFF: https://github.com/llvm/llvm-project/commit/b6c29d9de027692cfe93a4f701cf49f1d5f99574.diff
LOG: [lldb][NFC] Remove unused 'type' parameter in ClangExpressionDeclMap::FindGlobalVariable
We never pass something else than a nullptr as the 'type' so the related code in this function is never reached.
Added:
Modified:
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
Removed:
################################################################################
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index 7a7d9b829368..60afa126ce90 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -597,7 +597,7 @@ addr_t ClangExpressionDeclMap::GetSymbolAddress(ConstString name,
lldb::VariableSP ClangExpressionDeclMap::FindGlobalVariable(
Target &target, ModuleSP &module, ConstString name,
- CompilerDeclContext *namespace_decl, TypeFromUser *type) {
+ CompilerDeclContext *namespace_decl) {
VariableList vars;
if (module && namespace_decl)
@@ -605,19 +605,9 @@ lldb::VariableSP ClangExpressionDeclMap::FindGlobalVariable(
else
target.GetImages().FindGlobalVariables(name, -1, vars);
- if (vars.GetSize()) {
- if (type) {
- for (VariableSP var_sp : vars) {
- if (ClangASTContext::AreTypesSame(
- *type, var_sp->GetType()->GetFullCompilerType()))
- return var_sp;
- }
- } else {
- return vars.GetVariableAtIndex(0);
- }
- }
-
- return VariableSP();
+ if (vars.GetSize() == 0)
+ return VariableSP();
+ return vars.GetVariableAtIndex(0);
}
ClangASTContext *ClangExpressionDeclMap::GetClangASTContext() {
@@ -1443,8 +1433,7 @@ void ClangExpressionDeclMap::FindExternalVisibleDecls(
if (target) {
ValueObjectSP valobj;
VariableSP var;
- var =
- FindGlobalVariable(*target, module_sp, name, &namespace_decl, nullptr);
+ var = FindGlobalVariable(*target, module_sp, name, &namespace_decl);
if (var) {
valobj = ValueObjectVariable::Create(target, var);
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
index 41e41c1f1fef..722f5e15a2aa 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
@@ -521,17 +521,11 @@ class ClangExpressionDeclMap : public ClangASTSource {
/// \param[in] namespace_decl
/// If non-NULL and module is non-NULL, the parent namespace.
///
- /// \param[in] type
- /// The required type for the variable. This function may be called
- /// during parsing, in which case we don't know its type; hence the
- /// default.
- ///
/// \return
/// The LLDB Variable found, or NULL if none was found.
lldb::VariableSP FindGlobalVariable(Target &target, lldb::ModuleSP &module,
ConstString name,
- CompilerDeclContext *namespace_decl,
- TypeFromUser *type = nullptr);
+ CompilerDeclContext *namespace_decl);
/// Get the value of a variable in a given execution context and return the
/// associated Types if needed.
More information about the lldb-commits
mailing list