[PATCH] D86531: [analyzer][StdLibraryFunctionsChecker][NFC] Use Optionals throughout the summary API

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 26 03:12:47 PDT 2020


balazske added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:851
+  } getPointerTy(ACtx);
+  class {
+  public:
----------------
Why has this class different layout than `GetPointerTy` and `GetRestrictTy` (beneath that here is no `ASTContext`)? It would be better if all these classes look the same way: First is the operator with `QualType`, then operator with `Optional` that calls the other version of the operator. And all of these can be "unnamed" classes?


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:890
 
-  const QualType VoidPtrTy = ACtx.VoidPtrTy; // void *
-  const QualType IntPtrTy = ACtx.getPointerType(IntTy); // int *
+  const QualType VoidPtrTy = getPointerTy(VoidTy); // void *
+  const QualType IntPtrTy = getPointerTy(IntTy);   // int *
----------------
Is it better to use `ACtx.VoidPtrTy`? 


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1321
 
-    Optional<QualType> Mode_tTy = lookupType("mode_t", ACtx);
+    Optional<QualType> Mode_tTy = lookupTy("mode_t");
 
----------------
It is better to get every type at the start before adding functions, or group the functions and get some types at the start of these groups but mark the groups at least with comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86531



More information about the cfe-commits mailing list