[PATCH] D75171: [Analyzer] Fix for incorrect use of container and iterator checkers

Kristóf Umann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 6 07:41:54 PST 2020


Szelethus requested changes to this revision.
Szelethus added a comment.
This revision now requires changes to proceed.

You seem to have uploaded the wrong diff :)

In D75171#1908259 <https://reviews.llvm.org/D75171#1908259>, @baloghadamsoftware wrote:

> This is the so called "correct" solution. However, it does not even compile because `getAnalyzerOptions()` and `getASTContext()` are non-const functions of `CheckerManager`, but `shouldRegister`//XXX//`()` functions get it as const reference.


That doesn't sound too drastic, why don't you make those methods const?

> Even if I use `const_cast` (not in this patch, just for testing) it does not work, it does not prevent the crash: when trying to register `IteratorModeling` which depends on `ContainerModeling` both checkers are registered after `shouldRegisterContainerModeling()` function returning false.

Huh, that sounds interesting. I just tried it locally and it works like a charm. Would you mind me commandeering this patch to demonstrate?


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

https://reviews.llvm.org/D75171





More information about the cfe-commits mailing list