[Lldb-commits] [PATCH] D86821: [lldb] Make the majority of the lit configuration values optional for the API tests

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 2 09:38:42 PDT 2020


JDevlieghere marked an inline comment as done.
JDevlieghere added inline comments.


================
Comment at: lldb/test/API/lit.cfg.py:88-91
+def is_configured(attr):
+  """Return the configuration attribute if it exists and None otherwise.
+
+  This allows us to check if the attribute exists before trying to access it."""
----------------
labath wrote:
> I don't think this name and the implementation are  a good match. Given that the usages are a matching the name and not the implementation, maybe just change the implementation to `hasattr(config, attr)`?
> 
> That said, I'm not sure that `is_configured("foo")` is significantly better than `hasattr(config, "foo")`, so it might be better to just delete the function altogether.
It does more than just `hasattr(config, "foo")`, is does `hasattr(config, "foo") and config.foo`. The option can exist but be set to `False` or `None`. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86821



More information about the lldb-commits mailing list