[PATCH] D80016: [analyzer] StdLibraryFunctionsChecker: Add support to lookup types

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 29 08:41:30 PDT 2020


martong marked 2 inline comments as done.
martong added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:739
 
+  Optional<QualType> FileTy = lookupType("FILE", ACtx);
+  Optional<QualType> FilePtrTy, FilePtrRestrictTy;
----------------
balazske wrote:
> There is a `ASTContext::getFILEType` that can be used for this. (But if more types are needed the `lookupType` must be used again.)
Yeah, didn't realize that we have `getFILEType` until now. It's unfortunate that I added the tests for `FILE` in this sense.

`getFILEType` can return a null QualType, which unfortunately can be mixed with `Irrelevant`. I'd like to avoid that. Still, we could initialize the Optional<QualType> with the help of `getFILEType`. Maybe in a later patch it would be worth to do that (and then refactor the lookup.c[pp] tests too).

On the other hand, since we are going to use `lookupType` extensively with other types, I don't see much benefit to make an exemption to `FILE`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80016





More information about the cfe-commits mailing list