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

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 5 00:45:27 PDT 2018


whisperity added a subscriber: martong.
whisperity added a comment.

Make sure you use only the C++ projects like BitCoin, LLVM/Clang, ProtoBuf and such from the Xazax CSA Test suite because this checker is not really applicable to C projects.

Generally I like the idea (personally I've ran into a similar issue to ordering of sets in Java missed and on another OS we failed the tests where they tried to stringify elements and compare the output...) very much, this is one of those subleties you can really miss when writing and when reviewing code, and it will only bite you in the ass months down the line.

I think I'll summon @martong here, //ASTMatchers// are not my fortée, but he has been tinkering with them much recently.



================
Comment at: lib/StaticAnalyzer/Checkers/PointerSortingChecker.cpp:108-110
+void ento::registerPointerSortingChecker(CheckerManager &Mgr) {
+  Mgr.registerChecker<PointerSortingChecker>();
+}
----------------
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;
```


Repository:
  rC Clang

https://reviews.llvm.org/D50488





More information about the cfe-commits mailing list