aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
diff options
context:
space:
mode:
authorDing Fei <fding@feysh.com>2024-11-15 16:43:32 +0800
committerGitHub <noreply@github.com>2024-11-15 16:43:32 +0800
commit4163136e2ee121a5d7b86cb1262a524dde4a5ec4 (patch)
treee2c0409a169fa7ce73c26c570ccfd92839c64abb /clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
parenta1a1a4ced9d4ecba428175c45a24da476bdc55f4 (diff)
downloadllvm-4163136e2ee121a5d7b86cb1262a524dde4a5ec4.zip
llvm-4163136e2ee121a5d7b86cb1262a524dde4a5ec4.tar.gz
llvm-4163136e2ee121a5d7b86cb1262a524dde4a5ec4.tar.bz2
[analyzer][Solver] Early return if sym is concrete on assuming (#115579)
This could deduce some complex syms derived from simple ones whose values could be constrainted to be concrete during execution, thus reducing some overconstrainted states. This commit also fix `unix.StdCLibraryFunctions` crash due to these overconstrainted states being added to the graph, which is marked as sink node (PosteriorlyOverconstrained). The 'assume' API is used in non-dual style so the checker should protectively test whether these newly added nodes are actually impossible. 1. The crash: https://godbolt.org/z/8KKWeKb86 2. The solver needs to solve equivalent: https://godbolt.org/z/ed8WqsbTh
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
index 4f30b2a..5faaf9c 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -1354,6 +1354,8 @@ void StdLibraryFunctionsChecker::checkPreCall(const CallEvent &Call,
if (BR.isInteresting(ArgSVal))
OS << Msg;
}));
+ if (NewNode->isSink())
+ break;
}
}
}