[PATCH] D106644: [clang][analyzer] Add standard streams to alpha.unix.Stream checker.

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 29 01:48:31 PDT 2021


martong added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StreamChecker.cpp:215-236
+const VarDecl *findStdStreamDecl(StringRef StdName, CheckerContext &C) {
+  ASTContext &ACtx = C.getASTContext();
+
+  IdentifierInfo &II = ACtx.Idents.get(StdName);
+  auto LookupRes = ACtx.getTranslationUnitDecl()->lookup(&II);
+  QualType FILEType = ACtx.getFILEType();
+  if (!FILEType.isNull())
----------------
martong wrote:
> Would it be possible to reuse (i.e put in a common place) the StdLibraryFunctionChecker's `lookupTy`? That also handles the cases when FILEType is null or when we have a `typedef struct FILE FILE;`.
Could you please consider the above question?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D106644



More information about the cfe-commits mailing list