[Lldb-commits] [lldb] 77d2f26 - [lldb] Remove unused portion of GetFunctionMethodInfo signature (NFC)
Dave Lee via lldb-commits
lldb-commits at lists.llvm.org
Sat Mar 4 19:36:08 PST 2023
Author: Dave Lee
Date: 2023-03-04T19:35:57-08:00
New Revision: 77d2f263c0f3d9c2e7064c6317d41e18aff14289
URL: https://github.com/llvm/llvm-project/commit/77d2f263c0f3d9c2e7064c6317d41e18aff14289
DIFF: https://github.com/llvm/llvm-project/commit/77d2f263c0f3d9c2e7064c6317d41e18aff14289.diff
LOG: [lldb] Remove unused portion of GetFunctionMethodInfo signature (NFC)
This applies to IsClassMethod as well.
Added:
Modified:
lldb/include/lldb/Symbol/CompilerDeclContext.h
lldb/include/lldb/Symbol/SymbolContext.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
lldb/source/Symbol/CompilerDeclContext.cpp
lldb/source/Symbol/SymbolContext.cpp
lldb/source/Target/StackFrame.cpp
Removed:
################################################################################
diff --git a/lldb/include/lldb/Symbol/CompilerDeclContext.h b/lldb/include/lldb/Symbol/CompilerDeclContext.h
index 87d4ca30884e9..ca404a6641d5e 100644
--- a/lldb/include/lldb/Symbol/CompilerDeclContext.h
+++ b/lldb/include/lldb/Symbol/CompilerDeclContext.h
@@ -61,16 +61,6 @@ class CompilerDeclContext {
/// Checks if this decl context represents a method of a class.
///
- /// \param[out] language_ptr
- /// If non NULL and \b true is returned from this function,
- /// this will indicate if the language that respresents the method.
- ///
- /// \param[out] is_instance_method_ptr
- /// If non NULL and \b true is returned from this function,
- /// this will indicate if the method is an instance function (true)
- /// or a class method (false indicating the function is static, or
- /// doesn't require an instance of the class to be called).
- ///
/// \param[out] language_object_name_ptr
/// If non NULL and \b true is returned from this function,
/// this will indicate if implicit object name for the language
@@ -79,9 +69,7 @@ class CompilerDeclContext {
/// \return
/// Returns true if this is a decl context that represents a method
/// in a struct, union or class.
- bool IsClassMethod(lldb::LanguageType *language_ptr,
- bool *is_instance_method_ptr,
- ConstString *language_object_name_ptr);
+ bool IsClassMethod(ConstString *language_object_name_ptr = nullptr);
/// Check if the given other decl context is contained in the lookup
/// of this decl context (for example because the other context is a nested
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h
index cac951bc19b92..bb9e031daaaa4 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -248,13 +248,6 @@ class SymbolContext {
/// If this symbol context represents a function that is a method, return
/// true and provide information about the method.
///
- /// \param[out] language
- /// If \b true is returned, the language for the method.
- ///
- /// \param[out] is_instance_method
- /// If \b true is returned, \b true if this is a instance method,
- /// \b false if this is a static/class function.
- ///
/// \param[out] language_object_name
/// If \b true is returned, the name of the artificial variable
/// for the language ("this" for C++, "self" for ObjC).
@@ -262,9 +255,7 @@ class SymbolContext {
/// \return
/// \b True if this symbol context represents a function that
/// is a method of a class, \b false otherwise.
- bool GetFunctionMethodInfo(lldb::LanguageType &language,
- bool &is_instance_method,
- ConstString &language_object_name);
+ bool GetFunctionMethodInfo(ConstString &language_object_name);
/// Sorts the types in TypeMap according to SymbolContext to TypeList
///
diff --git a/lldb/include/lldb/Symbol/TypeSystem.h b/lldb/include/lldb/Symbol/TypeSystem.h
index 9c27fd92906a6..7681a700766a2 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -127,9 +127,9 @@ class TypeSystem : public PluginInterface,
virtual ConstString
DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) = 0;
- virtual bool DeclContextIsClassMethod(
- void *opaque_decl_ctx, lldb::LanguageType *language_ptr,
- bool *is_instance_method_ptr, ConstString *language_object_name_ptr) = 0;
+ virtual bool
+ DeclContextIsClassMethod(void *opaque_decl_ctx,
+ ConstString *language_object_name_ptr) = 0;
virtual bool DeclContextIsContainedInLookup(void *opaque_decl_ctx,
void *other_opaque_decl_ctx) = 0;
diff --git a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
index c573b8b8154a0..d478b0838f068 100644
--- a/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
@@ -1172,8 +1172,7 @@ SymbolContextList ClangExpressionDeclMap::SearchFunctionsInSymbolContexts(
// class/instance methods, since they'll be skipped in the code that
// follows anyway.
CompilerDeclContext func_decl_context = function->GetDeclContext();
- if (!func_decl_context ||
- func_decl_context.IsClassMethod(nullptr, nullptr, nullptr))
+ if (!func_decl_context || func_decl_context.IsClassMethod())
continue;
// We can only prune functions for which we can copy the type.
CompilerType func_clang_type = function->GetType()->GetFullCompilerType();
@@ -1307,7 +1306,7 @@ void ClangExpressionDeclMap::LookupFunction(
continue;
// Filter out class/instance methods.
- if (decl_ctx.IsClassMethod(nullptr, nullptr, nullptr))
+ if (decl_ctx.IsClassMethod())
continue;
AddOneFunction(context, sym_ctx.function, nullptr);
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
index aefc67ba10b37..f26147e7d408e 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
@@ -9751,36 +9751,25 @@ TypeSystemClang::DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) {
}
bool TypeSystemClang::DeclContextIsClassMethod(
- void *opaque_decl_ctx, lldb::LanguageType *language_ptr,
- bool *is_instance_method_ptr, ConstString *language_object_name_ptr) {
+ void *opaque_decl_ctx, ConstString *language_object_name_ptr) {
if (opaque_decl_ctx) {
clang::DeclContext *decl_ctx = (clang::DeclContext *)opaque_decl_ctx;
if (ObjCMethodDecl *objc_method =
llvm::dyn_cast<clang::ObjCMethodDecl>(decl_ctx)) {
- if (is_instance_method_ptr)
- *is_instance_method_ptr = objc_method->isInstanceMethod();
- if (language_ptr)
- *language_ptr = eLanguageTypeObjC;
- if (language_object_name_ptr)
- language_object_name_ptr->SetCString("self");
+ if (objc_method->isInstanceMethod())
+ if (language_object_name_ptr)
+ language_object_name_ptr->SetCString("self");
return true;
} else if (CXXMethodDecl *cxx_method =
llvm::dyn_cast<clang::CXXMethodDecl>(decl_ctx)) {
- if (is_instance_method_ptr)
- *is_instance_method_ptr = cxx_method->isInstance();
- if (language_ptr)
- *language_ptr = eLanguageTypeC_plus_plus;
- if (language_object_name_ptr)
- language_object_name_ptr->SetCString("this");
+ if (cxx_method->isInstance())
+ if (language_object_name_ptr)
+ language_object_name_ptr->SetCString("this");
return true;
} else if (clang::FunctionDecl *function_decl =
llvm::dyn_cast<clang::FunctionDecl>(decl_ctx)) {
ClangASTMetadata *metadata = GetMetadata(function_decl);
if (metadata && metadata->HasObjectPtr()) {
- if (is_instance_method_ptr)
- *is_instance_method_ptr = true;
- if (language_ptr)
- *language_ptr = eLanguageTypeObjC;
if (language_object_name_ptr)
language_object_name_ptr->SetCString(metadata->GetObjectPtrName());
return true;
diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
index d6c09cf3725f3..99021f9b76bda 100644
--- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
+++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
@@ -580,8 +580,6 @@ class TypeSystemClang : public TypeSystem {
ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override;
bool DeclContextIsClassMethod(void *opaque_decl_ctx,
- lldb::LanguageType *language_ptr,
- bool *is_instance_method_ptr,
ConstString *language_object_name_ptr) override;
bool DeclContextIsContainedInLookup(void *opaque_decl_ctx,
diff --git a/lldb/source/Symbol/CompilerDeclContext.cpp b/lldb/source/Symbol/CompilerDeclContext.cpp
index a3af568e7c99b..5b3049f74bbc8 100644
--- a/lldb/source/Symbol/CompilerDeclContext.cpp
+++ b/lldb/source/Symbol/CompilerDeclContext.cpp
@@ -34,13 +34,10 @@ ConstString CompilerDeclContext::GetScopeQualifiedName() const {
return ConstString();
}
-bool CompilerDeclContext::IsClassMethod(lldb::LanguageType *language_ptr,
- bool *is_instance_method_ptr,
- ConstString *language_object_name_ptr) {
+bool CompilerDeclContext::IsClassMethod(ConstString *language_object_name_ptr) {
if (IsValid())
- return m_type_system->DeclContextIsClassMethod(
- m_opaque_decl_ctx, language_ptr, is_instance_method_ptr,
- language_object_name_ptr);
+ return m_type_system->DeclContextIsClassMethod(m_opaque_decl_ctx,
+ language_object_name_ptr);
return false;
}
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 2ccc248d839ec..8453c1f116fef 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -539,17 +539,12 @@ Block *SymbolContext::GetFunctionBlock() {
return nullptr;
}
-bool SymbolContext::GetFunctionMethodInfo(lldb::LanguageType &language,
- bool &is_instance_method,
- ConstString &language_object_name)
-
-{
+bool SymbolContext::GetFunctionMethodInfo(ConstString &language_object_name) {
Block *function_block = GetFunctionBlock();
if (function_block) {
CompilerDeclContext decl_ctx = function_block->GetDeclContext();
if (decl_ctx)
- return decl_ctx.IsClassMethod(&language, &is_instance_method,
- &language_object_name);
+ return decl_ctx.IsClassMethod(&language_object_name);
}
return false;
}
diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp
index c04b58e80523b..fa74b5d0ac2c6 100644
--- a/lldb/source/Target/StackFrame.cpp
+++ b/lldb/source/Target/StackFrame.cpp
@@ -567,12 +567,9 @@ ValueObjectSP StackFrame::GetValueForVariableExpressionPath(
// Check for direct ivars access which helps us with implicit access to
// ivars using "this" or "self".
GetSymbolContext(eSymbolContextFunction | eSymbolContextBlock);
- lldb::LanguageType method_language = eLanguageTypeUnknown;
- bool is_instance_method = false;
ConstString method_object_name;
- if (m_sc.GetFunctionMethodInfo(method_language, is_instance_method,
- method_object_name)) {
- if (is_instance_method && method_object_name) {
+ if (m_sc.GetFunctionMethodInfo(method_object_name)) {
+ if (method_object_name) {
var_sp = variable_list->FindVariable(method_object_name);
if (var_sp) {
separator_idx = 0;
More information about the lldb-commits
mailing list