NoQ added a comment.

In D71433#1784920 <https://reviews.llvm.org/D71433#1784920>, @zukatsinadze 
wrote:

> @NoQ I like the idea, but I am not really sure how to do that. I started 
> working on Static Analyzer just lask week.


Let's get the initial attempt right first, and delay this for the next patch. 
You could accomplish this by keeping track of the last `putenv()` in a program 
state trait and moving the warning in `checkEndFunction()`.



================
Comment at: clang/test/Analysis/cert/pos34-c-fp-suppression.cpp:15
+int volatile_memory1(char *a) {
+  return putenv(a);
+  // expected-warning@-1 {{'putenv' function should not be called with auto 
variables}}
----------------
zukatsinadze wrote:
> I need `isPossiblyAutoVar` for this type. 
This test is pretty questionable. There is no indication in the code that `a` 
points to an automatic variable.


================
Comment at: clang/test/Analysis/cert/pos34-c-fp-suppression.cpp:20
+void volatile_memory2(char *a) {
+  char *buff = (char *)"hello";
+  putenv(buff);
----------------
zukatsinadze wrote:
> And `GlobalInternalSpaceRegion` for this.
This test is wrong. `"hello"` is not an automatic variable.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71433/new/

https://reviews.llvm.org/D71433



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to