[PATCH] D127898: [clang][dataflow] Add API to separate analysis from diagnosis
Gábor Horváth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 24 09:15:29 PDT 2022
xazax.hun added inline comments.
Comment at: clang/include/clang/Analysis/FlowSensitive/Models/UncheckedOptionalAccessModel.h:85
+ ASTContext &Context;
> 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.
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
More information about the cfe-commits