[PATCH] D84415: [analyzer][StdLibraryFunctionsChecker] Add POSIX pthread handling functions

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 14 04:53:25 PDT 2020


martong added a comment.

In D84415#2215780 <https://reviews.llvm.org/D84415#2215780>, @vsavchenko wrote:

> Off-topic: I really think that we should have some sort of DSL for that kind of stuff.

In a sense the API provided in the Checker itself is an (embedded) DSL. Or do you think about being able to provide the summaries by describing them in a JSON or a YAML file?



================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:2013
+    if (Pthread_tTy) {
+      Pthread_tPtrTy = ACtx.getPointerType(*Pthread_tTy);
+      Pthread_tPtrRestrictTy = getRestrictTy(*Pthread_tPtrTy);
----------------
vsavchenko wrote:
> It feels like the readability of the code here can be drastically improved by introducing functions `getPointerType`, `getRestrictType`, and similar accepting `Optional` arguments. 
Yeah, we already have `getRestrictTy`, but never though to have `getPointerTy`, which indeed simplifies the code, thanks!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84415



More information about the cfe-commits mailing list