steakhal marked 2 inline comments as done.
steakhal added inline comments.

================
Comment at: clang/lib/StaticAnalyzer/Core/CallEvent.cpp:490
+    // edge-cases.
+    ArgVal = castArgToParamTypeIfNeeded(Call, Idx, ArgVal, SVB);
+
----------------
steakhal wrote:
> tomasz-kaminski-sonarsource wrote:
> > Previously we didng make bindings if `ArgVal` was unknown, and we may want 
> > to preserve this invariant.
> IDK what are the implications of not having a binding or having a binding to 
> unknown.
> I'll change this anyway. Thanks for noticing.
Hm, I tried to move the `unknown` check after the cast. It would result in a 
difference in the last example:
```lang=C++
void c(); // expected-warning {{a function declaration without a prototype is 
deprecated in all versions of C and is treated as a zero-parameter prototype in 
C2x, conflicting with a subsequent definition}}
void missingPrototypeCallsiteMismatchingArgsAndParams() {
  // expected-warning@+1 {{passing arguments to 'c' without a prototype is 
deprecated in all versions of C and is not supported in C2x}}
  c(&buffer, &buffer);
}
void c(int *c) { // expected-note {{conflicting prototype is here}}
  clang_analyzer_dump(c); // ???
  *c = 42; // no-crash
}
```
The `clang_analyzer_dump(c)` would result in `&SymRegion{reg_$0<int * c>}` 
instead of `Unknown`.
Which is not exactly what I want. I want to bind `Unknown` in case the cast 
would result in `Unknown` or some weird parameter passing is detected, what we 
don't want to support/model, such as mismatching number of arguments & 
parameters, etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136162

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

Reply via email to