diff options
author | Fangyi Zhou <me@fangyi.io> | 2025-05-12 13:19:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-12 14:19:44 +0200 |
commit | 6078f5eb214d4cbb74ca9b024b88ff88d963ffd2 (patch) | |
tree | 92f9aadd7725231e0159b44193f6eed928e39705 /clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | |
parent | d5974524de6d7bccb95a1b3f074d1b6b76b60497 (diff) | |
download | llvm-6078f5eb214d4cbb74ca9b024b88ff88d963ffd2.zip llvm-6078f5eb214d4cbb74ca9b024b88ff88d963ffd2.tar.gz llvm-6078f5eb214d4cbb74ca9b024b88ff88d963ffd2.tar.bz2 |
Reland [Clang][analyzer] replace Stmt* with ConstCFGElement in SymbolConjured (#137355)
Closes #57270.
This PR changes the `Stmt *` field in `SymbolConjured` with
`CFGBlock::ConstCFGElementRef`. The motivation is that, when conjuring a
symbol, there might not always be a statement available, causing
information to be lost for conjured symbols, whereas the CFGElementRef
can always be provided at the callsite.
Following the idea, this PR changes callsites of functions to create
conjured symbols, and replaces them with appropriate `CFGElementRef`s.
There is a caveat at loop widening, where the correct location is the
CFG terminator (which is not an element and does not have a ref). In
this case, the first element in the block is passed as a location.
Previous PR #128251, Reverted at #137304.
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp index 17227a2..3c6c312 100644 --- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp @@ -619,7 +619,7 @@ class StdLibraryFunctionsChecker const Summary &Summary, CheckerContext &C) const override { return errno_modeling::setErrnoStdMustBeChecked(State, C, - Call.getOriginExpr()); + Call.getCFGElementRef()); } const std::string describe(CheckerContext &C) const override { |