[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
Fri Jul 23 06:05:24 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())
----------------
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;`.
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