[Lldb-commits] [PATCH] D71289: [FormatManager] Move Language lookup into the obviously non-cached part (NFC)

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 10 15:59:45 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rG70e3d0ea55e8: [FormatManager] Move Language lookup into the obviously non-cached part (NFC) (authored by aprantl).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71289

Files:
  lldb/source/DataFormatters/FormatManager.cpp


Index: lldb/source/DataFormatters/FormatManager.cpp
===================================================================
--- lldb/source/DataFormatters/FormatManager.cpp
+++ lldb/source/DataFormatters/FormatManager.cpp
@@ -630,7 +630,22 @@
     return retval_sp;
 
   Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DATAFORMATTERS));
-  LLDB_LOGF(log, "[%s] Search failed. Giving hardcoded a chance.", __FUNCTION__);
+
+  LLDB_LOGF(log, "[%s] Search failed. Giving language a chance.", __FUNCTION__);
+  for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
+    if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
+      ImplSP retval_sp;
+      if (lang_category->Get(match_data, retval_sp))
+        if (retval_sp) {
+          LLDB_LOGF(log, "[%s] Language search success. Returning.",
+                    __FUNCTION__);
+          return retval_sp;
+        }
+    }
+  }
+
+  LLDB_LOGF(log, "[%s] Search failed. Giving hardcoded a chance.",
+            __FUNCTION__);
   return GetHardcoded<ImplSP>(match_data);
 }
 
@@ -655,21 +670,6 @@
   }
 
   m_categories_map.Get(match_data, retval_sp);
-  if (!retval_sp) {
-    LLDB_LOGF(log, "[%s] Search failed. Giving language a chance.",
-              __FUNCTION__);
-    for (lldb::LanguageType lang_type : match_data.GetCandidateLanguages()) {
-      if (LanguageCategory *lang_category = GetCategoryForLanguage(lang_type)) {
-        if (lang_category->Get(match_data, retval_sp))
-          break;
-      }
-    }
-    if (retval_sp) {
-      LLDB_LOGF(log, "[%s] Language search success. Returning.", __FUNCTION__);
-      return retval_sp;
-    }
-  }
-
   if (match_data.GetTypeForCache() && (!retval_sp || !retval_sp->NonCacheable())) {
     LLDB_LOGF(log, "[%s] Caching %p for type %s", __FUNCTION__,
               static_cast<void *>(retval_sp.get()),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71289.233216.patch
Type: text/x-patch
Size: 1871 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191210/265af004/attachment-0001.bin>


More information about the lldb-commits mailing list