[clang] [analyzer] Match standard libraries regardless `restrict` qualifier (PR #238383)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 4 05:06:20 PST 2026
================
@@ -1490,33 +1490,15 @@ bool StdLibraryFunctionsChecker::evalCall(const CallEvent &Call,
llvm_unreachable("Unknown invalidation kind!");
}
-/// Returns whether the signatures should match based on the restrict
-/// qualifier.
-/// The "restrict" keyword is illegal in C++, however, many libc
-/// implementations use the "__restrict" compiler intrinsic in functions
-/// prototypes. The "__restrict" keyword qualifies a type as a restricted type
-/// even in C++.
-/// In case of any non-C99 languages, we don't want to match based on the
-/// restrict qualifier because we cannot know if the given libc implementation
-/// qualifies the paramter type or not.
-/// The Microsoft C runtime (e.g. UCRT) omits the restrict qualifiers of the
-/// standard prototypes even in C99 and later, so we don't match based on the
-/// restrict qualifier when targeting the MSVC environment either.
-static bool isRestrictSignificant(const ASTContext &ACtx) {
- return ACtx.getLangOpts().C99 &&
- !ACtx.getTargetInfo().getTriple().isWindowsMSVCEnvironment();
-}
-
bool StdLibraryFunctionsChecker::Signature::matches(
const FunctionDecl *FD) const {
assert(!isInvalid());
// Check the number of arguments.
if (FD->param_size() != ArgTys.size())
return false;
- auto RemoveRestrict = [&FD](QualType T) {
- if (!isRestrictSignificant(FD->getASTContext()))
- T.removeLocalRestrict();
+ auto RemoveRestrict = [](QualType T) {
+ T.removeLocalRestrict();
----------------
NagyDonat wrote:
Thanks!
https://github.com/llvm/llvm-project/pull/238383
More information about the cfe-commits
mailing list