[Lldb-commits] [PATCH] D61805: Add nullptr check in FindLibCppStdFunctionCallableInfo()

Shafik Yaghmour via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 15 11:36:19 PDT 2019


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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61805.199649.patch
Type: text/x-patch
Size: 1233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190515/3a4f8a68/attachment.bin>


More information about the lldb-commits mailing list