[clang] [analyzer] Refactor recognition of the errno getter functions (PR #91531)

Balázs Kéri via cfe-commits cfe-commits at lists.llvm.org
Thu May 9 07:54:31 PDT 2024


================
@@ -39,10 +39,15 @@ namespace {
 // Name of the "errno" variable.
 // FIXME: Is there a system where it is not called "errno" but is a variable?
 const char *ErrnoVarName = "errno";
+
 // Names of functions that return a location of the "errno" value.
 // FIXME: Are there other similar function names?
-const char *ErrnoLocationFuncNames[] = {"__errno_location", "___errno",
-                                        "__errno", "_errno", "__error"};
+CallDescriptionSet ErrnoLocationCalls{
+    {CDM::SimpleFunc, {"__errno_location"}, 0, 0},
+    {CDM::SimpleFunc, {"___errno"}, 0, 0},
+    {CDM::SimpleFunc, {"__errno"}, 0, 0},
+    {CDM::SimpleFunc, {"_errno"}, 0, 0},
+    {CDM::SimpleFunc, {"__error"}, 0, 0}};
----------------
balazske wrote:

Should these be `CLibrary`? Probably not, because these are already internal function names hidden behind a macro ("errno" is the non-internal name). But only global functions should match that are in a system header.

https://github.com/llvm/llvm-project/pull/91531


More information about the cfe-commits mailing list