[clang] [analyzer] Refactor recognition of the errno getter functions (PR #91531)
Balázs Kéri via cfe-commits
cfe-commits at lists.llvm.org
Fri May 10 04:07:13 PDT 2024
================
@@ -74,9 +73,13 @@ REGISTER_TRAIT_WITH_PROGRAMSTATE(ErrnoRegion, const MemRegion *)
REGISTER_TRAIT_WITH_PROGRAMSTATE(ErrnoState, errno_modeling::ErrnoCheckState)
-/// Search for a variable called "errno" in the AST.
-/// Return nullptr if not found.
-static const VarDecl *getErrnoVar(ASTContext &ACtx) {
+void ErrnoModeling::checkASTDecl(const TranslationUnitDecl *D,
+ AnalysisManager &Mgr, BugReporter &BR) const {
+ // Try to find the declaration of the external variable `int errno;`.
+ // There are also C library implementations, where the `errno` location is
+ // accessed via a function that returns its address; in those environments
+ // this callback does nothing.
----------------
balazske wrote:
```suggestion
// this callback has no effect.
```
https://github.com/llvm/llvm-project/pull/91531
More information about the cfe-commits
mailing list