[PATCH] D34275: [analyzer] Re-implemente current virtual calls checker in a path-sensitive way
Gábor Horváth via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 20 04:34:52 PDT 2017
xazax.hun added a comment.
Note that when you update the differential revision you need to upload the whole diff. Your diff now only contains the tests but not the code.
In https://reviews.llvm.org/D34275#785189, @wangxindsb wrote:
> > How do you handle the following case?
> >
> > struct A {
> > A() {
> > X x;
> > x.virtualMethod(); // this virtual call is ok
> > }
> > }
> > int main() {
> > A a;
> > }
>
> I use the checker to check the code above, the checker works as expect and doesn't throw the warning.
What about:
struct A {
A() {
X x;
x.virtualMethod(); // this virtual call is ok
foo(); // should warn here
}
virtual foo();
}
int main() {
A a;
}
Does the checker warn on the second call?
================
Comment at: virtualcall.cpp:1
-// RUN: %clang_analyze_cc1 -analyzer-checker=optin.cplusplus.VirtualCall -analyzer-store region -verify -std=c++11 %s
-// RUN: %clang_analyze_cc1 -analyzer-checker=optin.cplusplus.VirtualCall -analyzer-store region -analyzer-config optin.cplusplus.VirtualCall:Interprocedural=true -DINTERPROCEDURAL=1 -verify -std=c++11 %s
----------------
Please add the appropriate run lines so you can run the tests using `make check`.
https://reviews.llvm.org/D34275
More information about the cfe-commits
mailing list