Invalid code in PthreadLockChecker

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Invalid code in PthreadLockChecker

Kristof Beyls via cfe-dev
Hi Devs,
I was going through Clang/Static Analyser in particular
PthreadLockChecker.
There I have find this line
https://github.com/llvm-mirror/clang/blob/master/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp#L115

which I think could be modified like this
if (CE->getNumArgs() !=1)
    return;

since all of the lock/unlock/destroy function is having only single arguments.
Even a simple grep shows that only CE->getArg(0)  is used in the
particular source file.
Please clarify on this.

./Kamlesh
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Invalid code in PthreadLockChecker

Kristof Beyls via cfe-dev
Some of these functions do actually take two arguments, eg.:

  int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr).

We might not query these arguments because they aren't of interest to the checker, but they still exist in the code.

That said, if you're interested in improving this part of the checker, you may try to convert it to CallDescriptionMap which is more specific and less fragile.

On 10/30/19 3:52 AM, kamlesh kumar via cfe-dev wrote:
Hi Devs,
I was going through Clang/Static Analyser in particular
PthreadLockChecker.
There I have find this line
https://github.com/llvm-mirror/clang/blob/master/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp#L115

which I think could be modified like this
if (CE->getNumArgs() !=1)
    return;

since all of the lock/unlock/destroy function is having only single arguments.
Even a simple grep shows that only CE->getArg(0)  is used in the
particular source file.
Please clarify on this.

./Kamlesh
_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev