shafik updated this revision to Diff 199649.
shafik marked 4 inline comments as done.
shafik added a comment.

Simplified the checking of symbol being a `nullptr`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61805/new/

https://reviews.llvm.org/D61805

Files:
  source/Target/CPPLanguageRuntime.cpp


Index: source/Target/CPPLanguageRuntime.cpp
===================================================================
--- source/Target/CPPLanguageRuntime.cpp
+++ source/Target/CPPLanguageRuntime.cpp
@@ -204,6 +204,9 @@
     symbol = sc.symbol;
   }
 
+  if (symbol == nullptr)
+    return optional_info;
+    
   auto get_name = [&first_template_parameter, &symbol]() {
     // Given case 1:
     //
@@ -214,8 +217,7 @@
       return llvm::Regex::escape(first_template_parameter.str()) +
              R"(::operator\(\)\(.*\))";
 
-    if (symbol != NULL &&
-        symbol->GetName().GetStringRef().contains("__invoke")) {
+    if (symbol->GetName().GetStringRef().contains("__invoke")) {
 
       llvm::StringRef symbol_name = symbol->GetName().GetStringRef();
       size_t pos2 = symbol_name.find_last_of(':');
@@ -260,8 +262,7 @@
       addr.CalculateSymbolContextLineEntry(line_entry);
 
       if (first_template_parameter.contains("$_") ||
-          (symbol != nullptr &&
-           symbol->GetName().GetStringRef().contains("__invoke"))) {
+          symbol->GetName().GetStringRef().contains("__invoke")) {
         // Case 1 and 2
         optional_info.callable_case = LibCppStdFunctionCallableCase::Lambda;
       } else {


Index: source/Target/CPPLanguageRuntime.cpp
===================================================================
--- source/Target/CPPLanguageRuntime.cpp
+++ source/Target/CPPLanguageRuntime.cpp
@@ -204,6 +204,9 @@
     symbol = sc.symbol;
   }
 
+  if (symbol == nullptr)
+    return optional_info;
+    
   auto get_name = [&first_template_parameter, &symbol]() {
     // Given case 1:
     //
@@ -214,8 +217,7 @@
       return llvm::Regex::escape(first_template_parameter.str()) +
              R"(::operator\(\)\(.*\))";
 
-    if (symbol != NULL &&
-        symbol->GetName().GetStringRef().contains("__invoke")) {
+    if (symbol->GetName().GetStringRef().contains("__invoke")) {
 
       llvm::StringRef symbol_name = symbol->GetName().GetStringRef();
       size_t pos2 = symbol_name.find_last_of(':');
@@ -260,8 +262,7 @@
       addr.CalculateSymbolContextLineEntry(line_entry);
 
       if (first_template_parameter.contains("$_") ||
-          (symbol != nullptr &&
-           symbol->GetName().GetStringRef().contains("__invoke"))) {
+          symbol->GetName().GetStringRef().contains("__invoke")) {
         // Case 1 and 2
         optional_info.callable_case = LibCppStdFunctionCallableCase::Lambda;
       } else {
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to