xazax.hun added inline comments.
================
Comment at: 
clang/include/clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h:85
+private:
+  ASTContext &Context;
+  MatchSwitch<DiagnoseState<llvm::DenseSet<SourceLocation>>>
----------------
samestep wrote:
> samestep wrote:
> > xazax.hun wrote:
> > > Do we expect this to modify the ASTContext? Could this be a const ref 
> > > instead?
> > I'd guess it shouldn't; I was mostly just copying the `ASTContext &` field 
> > from the `DataflowAnalysis` class, which is not `const`. I can try changing 
> > it to `const` here, though.
> @xazax.hun Coming back to this today, I remembered why it has to be 
> `ASTContext &` and not `const ASTContext &`: because `MatchSwitch` requires 
> it to not be `const`.
Thanks! Do you mean `MatchSwitch` cannot be refactored to use `const 
ASTContext&`? I quickly skimmed through the code and it looks like almost every 
instance of `ASTContext` is non-const.  So I think it is ok to leave as is for 
this PR. I am also not sure if making it const at more places would bring any 
significant value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127898

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

Reply via email to