[Lldb-commits] [PATCH] D67111: Adding caching to libc++ std::function formatter for lookups that require scanning symbols

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 10 15:30:52 PDT 2019


aprantl added inline comments.


================
Comment at: source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp:248
 
+  if (CallableLookupCache.count(func_to_match))
+    return CallableLookupCache[func_to_match];
----------------
This is performing the lookup twice.
```
auto it = CallableLookupCache.find(func_to_match);
if (it != CallableLookupCache.end)
  return *it;
```


================
Comment at: source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp:272
       if (first_template_parameter.contains("$_") ||
+          first_template_parameter.contains("'lambda'") ||
           (symbol != nullptr &&
----------------
Factor these conditions out into a helper function with a descriptive name since it's also used above?


================
Comment at: source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.h:91
+
+  OperatorStringToCallableInfoMap CallableLookupCache;
+
----------------
Since this is used in only one place, I would skip the using statement, but that's more a personal style preference.


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

https://reviews.llvm.org/D67111





More information about the lldb-commits mailing list