[Lldb-commits] [lldb] c3f0d9f - [IRExecutionUnit] Early returns for clarity. NFCI.

Davide Italiano via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 5 14:52:44 PDT 2020


Author: Davide Italiano
Date: 2020-06-05T14:52:36-07:00
New Revision: c3f0d9f3d22d7a3770f2886df9c554e1c277e45a

URL: https://github.com/llvm/llvm-project/commit/c3f0d9f3d22d7a3770f2886df9c554e1c277e45a
DIFF: https://github.com/llvm/llvm-project/commit/c3f0d9f3d22d7a3770f2886df9c554e1c277e45a.diff

LOG: [IRExecutionUnit] Early returns for clarity. NFCI.

Added: 
    

Modified: 
    lldb/source/Expression/IRExecutionUnit.cpp
    lldb/source/Expression/IRInterpreter.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Expression/IRExecutionUnit.cpp b/lldb/source/Expression/IRExecutionUnit.cpp
index 36ac5913abbc..1bcd6aa918e9 100644
--- a/lldb/source/Expression/IRExecutionUnit.cpp
+++ b/lldb/source/Expression/IRExecutionUnit.cpp
@@ -741,19 +741,22 @@ void IRExecutionUnit::CollectFallbackNames(
   for (const SearchSpec &C_spec : C_specs) {
     ConstString name = C_spec.name;
 
-    if (CPlusPlusLanguage::IsCPPMangledName(name.GetCString())) {
-      Mangled mangled_name(name);
-      ConstString demangled_name = mangled_name.GetDemangledName();
-      if (!demangled_name.IsEmpty()) {
-        const char *demangled_cstr = demangled_name.AsCString();
-        const char *lparen_loc = strchr(demangled_cstr, '(');
-        if (lparen_loc) {
-          llvm::StringRef base_name(demangled_cstr,
-                                    lparen_loc - demangled_cstr);
-          fallback_specs.push_back(ConstString(base_name));
-        }
-      }
-    }
+    if (!CPlusPlusLanguage::IsCPPMangledName(name.GetCString()))
+      continue;
+
+    Mangled mangled_name(name);
+    ConstString demangled_name = mangled_name.GetDemangledName();
+    if (demangled_name.IsEmpty())
+      continue;
+
+    const char *demangled_cstr = demangled_name.AsCString();
+    const char *lparen_loc = strchr(demangled_cstr, '(');
+    if (!lparen_loc)
+      continue;
+
+    llvm::StringRef base_name(demangled_cstr,
+                              lparen_loc - demangled_cstr);
+    fallback_specs.push_back(ConstString(base_name));
   }
 }
 

diff  --git a/lldb/source/Expression/IRInterpreter.cpp b/lldb/source/Expression/IRInterpreter.cpp
index 0af767116b74..04d7cb3e74b6 100644
--- a/lldb/source/Expression/IRInterpreter.cpp
+++ b/lldb/source/Expression/IRInterpreter.cpp
@@ -173,24 +173,24 @@ class InterpreterStackFrame {
 
       return AssignToMatchType(scalar, value_apint.getLimitedValue(),
                                value->getType());
-    } else {
-      lldb::addr_t process_address = ResolveValue(value, module);
-      size_t value_size = m_target_data.getTypeStoreSize(value->getType());
+    }
 
-      lldb_private::DataExtractor value_extractor;
-      lldb_private::Status extract_error;
+    lldb::addr_t process_address = ResolveValue(value, module);
+    size_t value_size = m_target_data.getTypeStoreSize(value->getType());
 
-      m_execution_unit.GetMemoryData(value_extractor, process_address,
-                                     value_size, extract_error);
+    lldb_private::DataExtractor value_extractor;
+    lldb_private::Status extract_error;
 
-      if (!extract_error.Success())
-        return false;
+    m_execution_unit.GetMemoryData(value_extractor, process_address,
+                                   value_size, extract_error);
 
-      lldb::offset_t offset = 0;
-      if (value_size <= 8) {
-        uint64_t u64value = value_extractor.GetMaxU64(&offset, value_size);
-        return AssignToMatchType(scalar, u64value, value->getType());
-      }
+    if (!extract_error.Success())
+      return false;
+
+    lldb::offset_t offset = 0;
+    if (value_size <= 8) {
+      uint64_t u64value = value_extractor.GetMaxU64(&offset, value_size);
+      return AssignToMatchType(scalar, u64value, value->getType());
     }
 
     return false;


        


More information about the lldb-commits mailing list