[PATCH] D50488: [Analyzer] Checker for non-determinism caused by sorting of pointer-like elements

Umann Kristóf via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 5 11:31:01 PDT 2018


Szelethus added a comment.

> How then do you think I should try matching the IntPointerArray example? I am now leaning towards not doing this via AST Matchers as I am not sure if I can easily match more complex cases.

I've sadly reached the end of my knowledge on AST based analysis, but just to throw this in there, are you aware of this amazing guide about the static analyzer? https://github.com/haoNoQ/clang-analyzer-guide/releases There are a couple sections I believe could help you.



================
Comment at: lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp:108-110
+void ento::registerPointerSortingChecker(CheckerManager &Mgr) {
+  Mgr.registerChecker<PointerSortingChecker>();
+}
----------------
whisperity wrote:
> Speaking of not being applicable to C code, I think this snippet here should allow you to skip running the checker if you are not on a C++ file:
> 
> ```
> if (!Mgr.getLangOpts().CPlusPlus)
>       return;
> ```
Actually, I'm very much shooting in the dark here, but wouldn't this work with objective C++?


https://reviews.llvm.org/D50488





More information about the cfe-commits mailing list