[PATCH] D65382: [analyzer][NFC] Refactoring BugReporter.cpp P4.: If it can be const, make it const

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 30 00:19:13 PDT 2019


baloghadamsoftware added a comment.

In D65382#1605572 <https://reviews.llvm.org/D65382#1605572>, @NoQ wrote:

> It's counter-idiomatic to pass manager objects (`ProgramStateManager`, `SValBuilder`, etc.) as const-references because it tells you pretty much nothing about what you can or cannot do with them. You don't really ever semantically mutate them in the first place. There's no need to mention it every time you pass them around.


Most managers are stateful because they also store the elements they manage (e.g. `ProgramStateManager` stores states, `SValBuilder` owns other managers such as `SymbolManager` that stores symbols etc.) It is also true that `BugReporter` should not change the existing set of states, symbols etc., just use them in a read-only way. However, I see more confusion than help in making them const here and non-const elsewhere.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65382





More information about the cfe-commits mailing list