Summary: public Treat destructors in the same way we treat methods/constructors. It doesn't deal with inheritance/composition - we'll need to add calls to these destructors later Reviewed By: dulmarod Differential Revision: D2769142 fb-gh-sync-id: b1c77e1master
parent
c0f9e31ded
commit
70b003696f
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct A {
|
||||||
|
int f;
|
||||||
|
~A() {
|
||||||
|
f = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
struct B {
|
||||||
|
int f;
|
||||||
|
~B();
|
||||||
|
};
|
||||||
|
|
||||||
|
B::~B() {
|
||||||
|
f = 1;
|
||||||
|
}
|
@ -0,0 +1,24 @@
|
|||||||
|
digraph iCFG {
|
||||||
|
6 [label="6: BinaryOperatorStmt: Assign \n n$0=*&this:class B * [line 23]\n *n$0.f:int =1 [line 23]\n REMOVE_TEMPS(n$0); [line 23]\n NULLIFY(&this,false); [line 23]\n APPLY_ABSTRACTION; [line 23]\n " shape="box"]
|
||||||
|
|
||||||
|
|
||||||
|
6 -> 5 ;
|
||||||
|
5 [label="5: Exit B_~B \n " color=yellow style=filled]
|
||||||
|
|
||||||
|
|
||||||
|
4 [label="4: Start B_~B\nFormals: this:class B *\nLocals: \n DECLARE_LOCALS(&return); [line 22]\n " color=yellow style=filled]
|
||||||
|
|
||||||
|
|
||||||
|
4 -> 6 ;
|
||||||
|
3 [label="3: BinaryOperatorStmt: Assign \n n$0=*&this:class A * [line 13]\n *n$0.f:int =0 [line 13]\n REMOVE_TEMPS(n$0); [line 13]\n NULLIFY(&this,false); [line 13]\n APPLY_ABSTRACTION; [line 13]\n " shape="box"]
|
||||||
|
|
||||||
|
|
||||||
|
3 -> 2 ;
|
||||||
|
2 [label="2: Exit A_~A \n " color=yellow style=filled]
|
||||||
|
|
||||||
|
|
||||||
|
1 [label="1: Start A_~A\nFormals: this:class A *\nLocals: \n DECLARE_LOCALS(&return); [line 12]\n " color=yellow style=filled]
|
||||||
|
|
||||||
|
|
||||||
|
1 -> 3 ;
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013 - present Facebook, Inc.
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the BSD style license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package frontend.cpp;
|
||||||
|
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import utils.DebuggableTemporaryFolder;
|
||||||
|
import utils.InferException;
|
||||||
|
import utils.ClangFrontendUtils;
|
||||||
|
|
||||||
|
public class DestructorsTest {
|
||||||
|
|
||||||
|
String basePath = "infer/tests/codetoanalyze/cpp/frontend/destructors/";
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public DebuggableTemporaryFolder folder = new DebuggableTemporaryFolder();
|
||||||
|
|
||||||
|
void frontendTest(String fileRelative) throws InterruptedException, IOException, InferException {
|
||||||
|
ClangFrontendUtils.createAndCompareCppDotFiles(folder, basePath + fileRelative);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSimpleDeclDotFilesMatch()
|
||||||
|
throws InterruptedException, IOException, InferException {
|
||||||
|
frontendTest("simple_decl.cpp");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in new issue