llvm/clang/unittests/StaticAnalyzer
Balazs Benics abc873694f [analyzer] Restrict CallDescription fuzzy builtin matching
`CallDescriptions` for builtin functions relaxes the match rules
somewhat, so that the `CallDescription` will match for calls that have
some prefix or suffix. This was achieved by doing a `StringRef::contains()`.
However, this is somewhat problematic for builtins that are substrings
of each other.

Consider the following:

`CallDescription{ builtin, "memcpy"}` will match for
`__builtin_wmemcpy()` calls, which is unfortunate.

This patch addresses/works around the issue by checking if the
characters around the function's name are not part of the 'name'
semantically. In other words, to accept a match for `"memcpy"` the call
should not have alphanumeric (`[a-zA-Z]`) characters around the 'match'.

So, `CallDescription{ builtin, "memcpy"}` will not match on:

 - `__builtin_wmemcpy: there is a `w` alphanumeric character before the match.
 - `__builtin_memcpyFOoBar_inline`: there is a `F` character after the match.
 - `__builtin_memcpyX_inline`: there is an `X` character after the match.

But it will still match for:
 - `memcpy`: exact match
 - `__builtin_memcpy`: there is an _ before the match
 - `__builtin_memcpy_inline`: there is an _ after the match
 - `memcpy_inline_builtinFooBar`: there is an _ after the match

Reviewed By: NoQ

Differential Revision: https://reviews.llvm.org/D118388
2022-02-11 10:45:18 +01:00
..
AnalyzerOptionsTest.cpp
BugReportInterestingnessTest.cpp
CallDescriptionTest.cpp [analyzer] Restrict CallDescription fuzzy builtin matching 2022-02-11 10:45:18 +01:00
CallEventTest.cpp
CheckerRegistration.h
CMakeLists.txt [analyzer]Skip unstable CSA tests failing on several platforms 2021-12-02 18:30:14 -05:00
ConflictingEvalCallsTest.cpp
FalsePositiveRefutationBRVisitorTest.cpp
NoStateChangeFuncVisitorTest.cpp
ParamRegionTest.cpp
RangeSetTest.cpp [analyzer] Implemented RangeSet::Factory::unite function to handle intersections and adjacency 2021-12-10 18:48:02 +02:00
RegisterCustomCheckersTest.cpp
Reusables.h
StoreTest.cpp
SValTest.cpp [analyzer][NFC] Re-enable skipped SValTests by relaxing expectations 2022-01-19 15:16:18 +01:00
SymbolReaperTest.cpp
TestReturnValueUnderConstruction.cpp