sammccall added inline comments.

================
Comment at: clang/include/clang/Analysis/FlowSensitive/DataflowEnvironment.h:186
+  Logger &logger() const {
+    return DACtx->getOptions().Log ? *DACtx->getOptions().Log : Logger::null();
+  }
----------------
xazax.hun wrote:
> If we already have a `NullLogger`, I wonder if making 
> `DACtx->getOptions().Log` a reference that points to NullLogger when logging 
> is disabled would be less confusing (and fewer branches).
Made the DataAnalysisContext constructor fill in this field with NullLogger if 
there isn't anything else, to avoid the branch. (Added a comment on the field).

It's still a pointer because of the ergonomic problems with ref fields in 
structs like this (can't initialize incrementally), and because we need a value 
for "no programmatic logging requested, feel free to respect the -dataflow-log 
flag" and using Logger::null() as a sentinel seems pretty surprising.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D144730

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to